Compare commits

...

24 Commits

  1. 23
      app.py
  2. 269
      pages/Irc_basics.md
  3. 16
      pages/info.md
  4. 108
      pages/irc_todo.md
  5. 253
      pages/linux101.md
  6. 130
      pages/python101.md
  7. 122
      pages/upython.md
  8. 6
      pages/variousCli.md
  9. 2
      static/style.css

@ -115,30 +115,11 @@ def search():
@app.route('/webhook', methods=['POST'])
def webhook():
if request.method == 'POST':
repo_path = "http://192.168.178.21:3000/zvevqx/tdtdt.git" # Replace with the actual path
subprocess.run(['git', 'pull', repo_path])
repo_path = "http://git.tdtdt.net:3003/zvevqx/tdtdt.git" # Replace with the actual path
subprocess.run(['git', 'pull'])
return "Webhook received!"
# # Verify the secret (if you used one in Gitea)
# secret = "salut" # Replace with your actual secret
# if secret:
# if 'X-Gitea-Signature' not in request.headers:
# return "Unauthorized", 401
# received_signature = request.headers['X-Gitea-Signature']
# expected_signature = f"sha256={compute_signature(request.data, secret)}"
# if received_signature != expected_signature:
# return "Unauthorized", 401
#
# # Perform Git pull to update the website's code
# # repo_path = "/path/to/your/website/repo" # Replace with the actual path
# # subprocess.run(['git', 'pull'], cwd=repo_path)
# # Restart the Flask app
# #restart_flask_app()
# print("YOLOLYOYLOOLLYYYOOOLLOO il y a un push")
# return "Webhook received and processed successfully", 200
def compute_signature(data, secret):
import hmac
import hashlib

@ -0,0 +1,269 @@
title : IRC basic command
author: zvevqx
published: 2025-11-22
cat: linux
desc: ws
...
👾 source : [https://gist.github.com/xero/2d6e4b061b4ecbeb9f99](https://gist.github.com/xero/2d6e4b061b4ecbeb9f99)
ERG STUDENTS IRC SERVER : `irc.tdtdt.net`
# IRC Reference
Not intended as a guide for newbies, more like a _"cheat sheet"_ for the somewhat experienced IRC user, especially one who wields some power over a channel.
## The Basics
- `/join #channel`
- Joins the specified channel.
- `/part #channel`
- Leaves the specified channel.
- `/quit [message]`
- Disconnects from current server with optional leaving message.
- `/server hostname`
- Connects to the specified server.
- `/list`
- Lists all channels on the current network.
- `/links`
- Lists all servers on the current network. May be disabled "for security reasons".
- `/nick nickname`
- Changes your nick.
- `/names #channel`
- Shows the nicks of all users on #channel.
- `/msg nickname message`
- Sends a private message to a user.
- `/query nickname message`
- Sends a private message to a user and opens a private chat window.
- `/me action`
- Prints "yourname action"
- `/notice nickname message`
- Sends a notice to the specified user. Like a /msg, but usually makes a sound.
- `/whois nickname`
- Shows information about the specified user. This action is not visible to the specified user.
- `/whowas nickname`
- Shows information about a user who has quit.
- `/dns nickname`
- Attempts to resolve the IP address of the specified user. Doesn't work on all networks, doesn't work all the time.
- `/ping nickname`
- Pings the specified user. This action is visible to the specified user.
## Nick Management (NickServ)
All nickserv commands begin with `/ns` or `/msg NickServ`. Depending on your client or network, `/ns` may not work. for berevity i will use the shorthand.
- `/ns register password [email]`
- Registers your current nick with NickServ with the chosen password and binds it to an e-mail address (optional).
- `/ns identify password`
- Identifies your nick to NickServ using the password you set. If you have a nick that's been registered, and you don't i
- `/ns recover nickname password`
- Kills (forcibly disconnects) someone who has your registered nick.
- `/ns ghost nickname password`
- Terminates a "ghost" IRC session that's using your nickname.
- `/ns set password yournewpassword`
- Changes your password. **NOTE:** Under no circumstances should you change your nick to the letter O followed by 8 digit
## Channel modes
set a mode with: `/mode #channel +/-attribute [data]`
- `+n`
- Disallows external messages.
- `+t`
- Only op/hops can set the topic.
- `+p`
- Sets the channel as invisible in /list.
- `+s`
- Sets the channel as invisible in /list and /whois.
- `+i`
- Sets the channel as closed unless the person was invited.
- `+k [pass]`
- Sets a password for the channel which users must enter to join.
- `+l [number]`
- Sets a limit on the number of users who are allowed in the channel at the same time.
- `+m`
- Prevents users who are not opped/hopped/voiced from talking.
- `+R`
- Sets the channel so only registered nicks are allowed in.
- `+M`
- Sets the channel so only registered nicks are allowed to talk.
- `+S`
- Strips formatting from messages, rendering them as plaintext.
- `+c`
- Blocks messages containing color codes.
- `+i`
- A user must be invited to join the channel.
- `+N`
- No nick changes permitted in the channel.
## ChanServ commands
All ChanServ commands begin with `/cs` or `/chanserv` or `/msg ChanServ`. Depending on your client and network, `/cs` or `/chanserv` may not work. I will use the shorthand in these examples.
- `/cs identify #channel <password>`
- Identifies you as the channel's founder and gives you founder-level privileges.
- `/cs set #channel mlock modes`
- Locks the channel's modes. Just + unlocks all.
- `/cs set #channel secureops [on|off]`
- Keeps everyone except aops, sops, and the founder from becoming ops.
- `/cs set #channel keeptopic [on|off]`
- Maintains the topic even if everyone leaves.
- `/cs set #channel enforce [on|off]`
- Restores op/halfop/voice if a person with op/halfop/voice gets de-opped/halfopped/voiced.
- `/cs set #channel leaveops [on|off]`
- Whether or not to allow the first person who join the channel to get ops.
- `/cs register #channel password description`
- Registers the current channel to you with ChanServ and sets its password and description.
- `/cs drop #channel [dropcode]`
- Un-registers the current channel to you with ChanServ.
- `/cs set #channel founder [nickname]`
- Sets the current channel's founder.
- `/cs set #channel password [newpass]`
- Changes the current channel's password to newpass.
- `/cs set #channel desc [description]`
- Changes the current channel's description.
- `/cs set #channel url [address]`
- Associates a URL with the channel.
- `/cs set #channel [email@address]`
- Associates an email address with the channel.
# Other stuff
## Kicking people
- `/kick #channel nickname [reason]`
- temporarily remove user from channel
`/mode nickname +/-attributes [data]`
- Setting people's modes (for current channel only)
## User modes
- `+q`
- User is owner of the current channel (prefix ~ on UnrealIRCd, usually @ elsewhere)
- `+a`
- User is an admin (SOP) on the current channel (prefix & on UnrealIRCd, usually @ elsewhere).
- `+o`
- User is an operator (AOP) on the current channel (prefix @).
- `+h`
- User is a half-op on the current channel (prefix %).
- `+v`
- User has voice on the current channel (prefix +).
## Banning people
- `/mode #channel +b hosts`
- Hosts take the following form: `nickname!userid@hostname`
- Use `/whois`, `/whowas` or `/who` to find the information necessary for a ban.
- `*` is a wildcard and can replace `nickname`, `userid`, parts of nickname or `userid`, `hostname` or a segment of a `hostname`.
## Examples:
- `joe!*@*`
- Will prevent anyone with the nick joe from joining.
- `*myg0t*!*`
- Will prevent anyone whose nick contains myg0t from joining.
- `mark!*elc@*`
- Will prevent anyone with the nick mark and the userid elc from joining.
- `*!*@c-123-24-76-213.ga.isp.net`
- Will prevent anyone with the host c-123-24-76-213.ga.isp.net from joining.
- `*!*@*`
- Bans everyone. Don't do that.
## Access lists
- `/cs access #channel add [nickname] [level]`
- Adds nickname to the channel's access list at the specified level.
- `/cs access channel del [nickname]`
- Removes nickname from the channel's access list.
- `/cs access #channel list`
- Displays the channel's access list.
- `/cs access #channel count`
- Displays how many entries are in the channel's access list.
## Access levels
These may vary from network to network. For example, some networks do not go by tens and use 3, 4, 5, 10, etc.
- `Founder`
- Full access to ChanServ functions, automatic opping upon entering channel.
- `100+`
- Makes the person an SOP, automatic opping upon entering channel.
- `50`
- Makes the parson an AOP, automatic opping upon entering channel.
- `40`
- Automatic half-opping.
- `30`
- Automatic voicing.
- `0`
- No special privileges.
- `-1`
- May not be opped.
- `-100`
- May not join the channel.
Any nick not on the access list has an access level of `0`.
# AOPs and SOPs
## AOPs
- Are automatically ops and can give themselves ops.
- Can give/take op/halfop/voice to/from other channel members.
- Can unban themselves.
- Receive memos sent to the whole channel.
- Can invite themselves to the channel.
## SOPs
- Can do everything AOPs can.
- Can give and take AOP privileges.
- Receive memos sent to the channel's SOPs.
- Can add (but not remove) AKICKs.
## Viewing and setting privileges
- Viewing AOP and SOP lists
- `/cs aop #channel list`
- `/cs sop #channel list`
- adding a AOP or SOP
- `/cs [AOP|SOP] channel [ADD|DEL|LIST|CLEAR] [nick | entry-list]`
## AKICKs
People on the AKICK list are automatically kicked and banned when they enter the channel. Bans made as a result of AKICK must be removed manually.
- `/cs akick #channel add host [reason]`
- Adds host to #channel's AKICK list [for reason].
- `/cs akick #channel del host`
- Removes host from the AKICK list.
- `/cs akick #channel list`
- `/cs akick #channel view`
- Displays the AKICK list.
## Color codes
it's possible to color your text in irc. in most clients you can use control c then foreground,background (background is optional). examples: red text `^c4`. black text on a blue background `^c1,2`. here's a full list of the color codes:
Number | Name
------ | ----
00 | white
01 | black
02 | blue (navy)
03 | green
04 | red
05 | brown (maroon)
06 | purple
07 | orange (olive)
08 | yellow
09 | light green (lime)
10 | teal (a green/blue cyan)
11 | light cyan (cyan / aqua)
12 | light blue (royal)
13 | pink (light purple / fuchsia)
14 | grey
15 | light grey (silver)
## related
https://youtu.be/R8FOGlnYkgg

@ -1,17 +1,19 @@
title: info
author: julien
title : info
author: zvevqx
---
# contact
0460 96 28 21
email@domain.com
julien.dutertre@erg.be
rue du sceptre 23
1050 ixelles
===
## how to contribute
go get the git `http://git.tdtdt.net:3003/zvevqx/tdtdt.git`
checkout to branch `o2swtich`
make content and create a pull request
# CV

@ -0,0 +1,108 @@
title : IRC todo
author: zvevqx
published: 2025-11-22
cat: wip
desc: ws
...
### the selection
<key>installed</key>
ircd-hybrid [https://github.com/ircd-hybrid/ircd-hybrid](https://github.com/ircd-hybrid/ircd-hybrid)
: light and *easy to setup* , the one most of irc rpi server seems to use / No logging by default
<key>installed</key>
inspirc [https://www.inspircd.org/](https://www.inspircd.org/)
: modular , to compile from source , huge documentation , logging by default
UnrealIrc [https://www.unrealircd.org/docs/About_UnrealIRCd](https://www.unrealircd.org/docs/About_UnrealIRCd)
: currently the most widely deployed IRC Server with a market share of 38% according to IRCStats.org.
### Logging solution
- `inspirc` do *really* it by default
- using a logBot from the internet
- building one
- using `irssi` irc client on the server side with logging enable in a `screen` or `tmux` session
### Review logs
- simple raw txt files
- using a irc logging system
### stuff of interest
irc client in flask
[https://github.com/linxlunx/flask-irc](https://github.com/linxlunx/flask-irc)
### chat gpt cheat for creating a bot
<key>untested</key>
Creating an IRC bot to log a channel in Python involves several steps, including connecting to an IRC server, joining a channel, and logging messages. You'll also need to use an IRC library to simplify the process. In this example, we'll use the `irc` library, which you can install via pip:
```bash
pip install irc
```
Here's a simple Python code example for creating an IRC bot to log a channel:
```python
import irc.client
import datetime
# Define the IRC bot class
class IRCBot(irc.client.SimpleIRCClient):
def __init__(self, channel, log_file):
super().__init__()
self.channel = channel
self.log_file = log_file
def on_welcome(self, connection, event):
connection.join(self.channel)
def on_pubmsg(self, connection, event):
channel = event.target
message = event.arguments[0]
timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# Log the message to the file
with open(self.log_file, 'a') as log:
log.write(f'[{timestamp}] <{event.source.nick}> {message}\n')
# Configuration
server = 'irc.example.com' # Replace with your IRC server
channel = '#example-channel' # Replace with the channel you want to log
log_file = 'irc_log.txt' # Specify the log file name
# Create and connect the IRC bot
client = irc.client.IRC()
bot = IRCBot(channel, log_file)
connection = client.server().connect(server, 6667, 'bot_nick')
# Start the bot
client.process_forever()
```
In this code:
1. We define the `IRCBot` class that inherits from `irc.client.SimpleIRCClient`. This class handles events like connecting to the server, joining the channel, and logging messages.
2. In the `on_welcome` method, we join the specified channel once the bot successfully connects to the IRC server.
3. The `on_pubmsg` method logs messages to the specified log file, including the message content, sender's nickname, and a timestamp.
4. In the configuration section, you need to replace `server`, `channel`, and `log_file` with your IRC server details and the channel you want to log.
5. We create an IRC client, instantiate the `IRCBot` class, and establish a connection to the server.
6. Finally, we start the IRC client's event loop with `client.process_forever()` to keep the bot running and handling IRC events.
Make sure to replace the placeholders in the code with your specific IRC server, channel, and log file information. Additionally, consider adding error handling and additional features as needed for your specific use case.

@ -13,8 +13,11 @@ learn more about `ssh` -> [https://www.ssh.com/ssh/](https://www.ssh.com/ssh/)
start terminal <key>ctrl</key> + <key>alt</key> + <key>t</key>
~~~ bash
ssh -p portnumber pi@er401.duckdns.org
ssh -p portnumber pi@ipaddress
ssh user @ distant_server.address : connection_port (default to 22 )
ssh pi@192.168.1.24
~~~
@ -27,7 +30,7 @@ ssh user @ distant_server.address : connection_port (default to 22 )
start terminal ( <key> &#127822; </key> + <key> space </key> and search for `terminal`)
~~~bash
ssh pi@er401.duckdns.org:22
ssh -p 55 pi@er401.duckdns.org
~~~
- **Windows** :
@ -35,7 +38,7 @@ ssh pi@er401.duckdns.org:22
- got to [putty download page](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)
- `putty` will give ~~windows~~ `ssh` ability ...
- connect to:
- server: ```er401.duckdns.org```
- server: ```ipadresse```
- port ```22```
- user `pi`
@ -50,7 +53,7 @@ ssh pi@er401.duckdns.org:22
1. *create a User*
```
sudo useradd -m <username> -p <password>
sudo useradd <username>
```
2. *add user to groups and privilege*
@ -76,25 +79,197 @@ ssh pi@er401.duckdns.org:22
3. *reconnect with your `username` and `password`*
```bash
ssh YOUR_USER_NAME@er401.duckdns.org:22
ssh YOUR_USER_NAME@ADRESSEIP
```
4. welcome to your new `home`
1. your *home folder* is in `/home/yourUserName`
1. hint : you can check where you are with the command `pwd` (**P**rint **W**orking **D**irectory)
2. learm about linus folder structure -> [random first article on ddg search :) ](https://linuxhandbook.com/linux-directory-structure/)
2. learm about linus folder structure -> [learn more](https://linuxhandbook.com/linux-directory-structure/)
---
# DO SOME STUFF
## general `cli` commands
### navigate
- `.` the current directory ( folder)
- `..` the parent directory
- `man` : view the **man**ual of a command ( ex : ` man ls` )
- `pwd ` : Use the **pwd** command to find out the path of the current working directory (folder) you’re in
- `cd` : **c**hange **d**irectory to go inside a new directory
- `ls` : **l**i**s**t the current directory content
- `cp` : to **c**o**p**y documents / folders
- `mv`: to **m**o**v**e documents / folder
- `mkdir`: **m**a**k**e **dir**ectory create a folder
- `touch`: create an empty file
- `rm` : **r**e**m**ove folder and files ***⚠*** no return possible / read and think twice before smashing <key> enter </key>
- `find`: to find / search for files
### system stuffs
- `sudo` : **s**uper **u**ser **do** get super privileges to do system stuff ***⚠*** `sudo` can do **ANYTHING** , even destroy system
- `du` : **d**isk **u**sage ... to see .. disk usage ( use it with `-h` argument for human readable output )
- `top` and `htop` : to monitor system ( application / ram / cpu usage)
- `killall` : kill a process by name e:`killall firefox` will quit and kill all *firefix* process
- `uname ` : view system information ( kernel / linux version ....)
- `sudo reboot` : restart computer ( must be `sudo` to execute )
- `sudo halt` || `sudo shutdown now` : shutdown computer ( must be `sudo`)
### general help
- <key>ctrl</key> + <key>r</key> : search in history for already used commands
- <key>ctrl</key> + <key>c</key> : **kill** running command
--------
# getting started with python
==underconstruction==
![uc](https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.pinimg.com%2Foriginals%2F0b%2F12%2Fd9%2F0b12d9ff85bf365bc7acde04a992d938.gif&f=1&nofb=1)
just some code to try
~~~python
import time
import math
x = 0
try :
while True:
x = x+1
time.sleep(0.5)
print(" la vlaeur de x est de = {}".format(x))
if x>100:
x=0
except KeyboardInterrupt:
print('Hello user you have pressed ctrl-c button.')
~~~
## create a simple chat with python
[https://python.plainenglish.io/create-a-basic-lan-chat-room-with-python-f334776bf70c](https://python.plainenglish.io/create-a-basic-lan-chat-room-with-python-f334776bf70c)
fixed code
===client===
~~~python
import socket
import threading
my_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
PORT = 8000
ADDRESS = "localhost" # Same as "127.0.1.1"
my_socket.connect((ADDRESS, PORT))
nickname = input("Choose your nickname : ").strip()
while not nickname:
nickname = input("Your nickname should not be empty : ").strip()
def thread_sending():
while True:
message_to_send = input("your message :")
if message_to_send:
message_with_nickname = nickname + " : " + message_to_send
my_socket.send(message_with_nickname.encode())
def thread_receiving():
while True:
message = my_socket.recv(1024).decode()
print(message)
thread_send = threading.Thread(target=thread_sending)
thread_receive = threading.Thread(target=thread_receiving)
thread_send.start()
thread_receive.start()
~~~
===server===
~~~python
import socket
import threading
my_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
PORT = 8000
ADDRESS = "0.0.0.0"
broadcast_list = []
my_socket.bind((ADDRESS, PORT))
def thread_accept():
while True:
my_socket.listen()
client, client_address = my_socket.accept()
broadcast_list.append(client)
start_listenning_thread(client)
def start_listenning_thread(client):
client_thread = threading.Thread(
target = listen_thread,
args = (client,) #the list of argument for the function
)
client_thread.start()
def listen_thread(client):
while True:
message = client.recv(1024).decode()
if message:
print(f"Received message : {message}")
broadcast(message)
else:
print(f"client has been disconnected : {client}")
return
def broadcast(message):
for client in broadcast_list:
try:
client.send(message.encode())
except:
broadcast_list.remove(client)
print(f"Client removed : {client}")
thread_accept()
~~~
--------
## create folder in ```apache``` server
wft is `apache` :
> apache is a http web server [wiki page](https://en.wikipedia.org/wiki/Apache_HTTP_Server)
there other solution like [https://www.lighttpd.net/]{https://www.lighttpd.net/}
there other solution like [https://www.lighttpd.net/]{https://www.lighttpd.net/} or the popular [https://nginx.org/en/](https://nginx.org/en/)
`apache` is well documented and often the one you'll find on a web server service
@ -127,7 +302,6 @@ there other solution like [https://www.lighttpd.net/]{https://www.lighttpd.net/}
6. content example
~~~html
<html>
<head>
@ -145,43 +319,6 @@ there other solution like [https://www.lighttpd.net/]{https://www.lighttpd.net/}
</html>
~~~
# DO SOME STUFF
## general `cli` commands
### navigate
- `.` the current directory ( folder)
- `..` the parent directory
- `man` : view the **man**ual of a command ( ex : ` man ls` )
- `pwd ` : Use the **pwd** command to find out the path of the current working directory (folder) you’re in
- `cd` : **c**hange **d**irectory to go inside a new directory
- `ls` : **l**i**s**t the current directory content
- `cp` : to **c**o**p**y documents / folders
- `mv`: to **m**o**v**e documents / folder
- `mkdir`: **m**a**k**e **dir**ectory create a folder
- `touch`: create an empty file
- `rm` : **r**e**m**ove folder and files ***⚠*** no return possible / read and think twice before smashing <key> enter </key>
- `find`: to find / search for files
### system stuffs
- `sudo` : **s**uper **u**ser **do** get super privileges to do system stuff ***⚠*** `sudo` can do **ANYTHING** , even destroy system
- `du` : **d**isk **u**sage ... to see .. disk usage ( use it with `-h` argument for human readable output )
- `top` and `htop` : to monitor system ( application / ram / cpu usage)
- `killall` : kill a process by name e:`killall firefox` will quit and kill all *firefix* process
- `uname ` : view system information ( kernel / linux version ....)
- `sudo reboot` : restart computer ( must be `sudo` to execute )
- `sudo halt` || `sudo shutdown now` : shutdown computer ( must be `sudo`)
### general help
- <key>ctrl</key> + <key>r</key> : search in history for already used commands
- <key>ctrl</key> + <key>c</key> : **kill** running command
- list of softwares : [go to page](soft.html)
## mjpeg-streamer ( video server )
```https://github.com/jacksonliam/mjpg-streamer```
@ -216,29 +353,3 @@ there other solution like [https://www.lighttpd.net/]{https://www.lighttpd.net/}
http://er401.duckdns.org:666/?action=stream
~~~
# getting started with python
==underconstruction==
![uc](https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.pinimg.com%2Foriginals%2F0b%2F12%2Fd9%2F0b12d9ff85bf365bc7acde04a992d938.gif&f=1&nofb=1)
just some code to try
~~~python
import time
import math
x = 0
try :
while True:
x = x+1
time.sleep(0.5)
print(" la vlaeur de x est de = {}".format(x))
if x>100:
x=0
except KeyboardInterrupt:
print('Hello user you have pressed ctrl-c button.')
~~~

@ -0,0 +1,130 @@
title : Python 101
author: zvevqx
published: 2025-11-22
cat: python
desc: ressources for python
...
# Python for Beginners
## Introduction
Python is a high-level, interpreted programming language known for its readability and simplicity. It is a great language for beginners due to its straightforward syntax and wide range of applications.
## Getting Started
1. **Install Python**: Download and install Python from the official website. It's available for Windows, macOS, and Linux. [Python Downloads](https://www.python.org/downloads/)
2. **Install a Text Editor or IDE**: A text editor or IDE is where you'll write and run your Python code. Some popular options include IDLE (included with Python), Visual Studio Code, and PyCharm.
## Basic Python Concepts
### Variables
Variables are used to store data. They can hold different types of values, like numbers, strings, and lists.
```python
x = 10 # integer
y = "Hello, World!" # string
z = [1, 2, 3] # list
```
### Functions
Functions are reusable blocks of code that perform a specific task. They help break down complex programs into smaller, more manageable parts.
```python
def greet(name):
print(f"Hello, {name}!")
greet("Alice") # prints "Hello, Alice!"
```
### Control Flow
Control flow statements, like if/else and for/while loops, determine the order in which code is executed.
```python
for i in range(5):
print(i) # prints numbers from 0 to 4
x = 10
if x > 0:
print("x is positive") # prints "x is positive"
```
### Data Structures
Python has several built-in data structures, including lists, tuples, and dictionaries.
```python
my_list = [1, 2, 3] # list
my_tuple = (1, 2, 3) # tuple
my_dict = {"name": "Alice", "age": 30} # dictionary
```
### Modules
Modules are files containing Python definitions and statements. They allow you to organize and reuse code.
```python
import math
print(math.sqrt(16)) # prints 4.0
```
## Intermediate Python Concepts
### Object-Oriented Programming
Python supports object-oriented programming (OOP), which is a programming paradigm that uses "objects" to design applications.
```python
class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
def bark(self):
print("Woof!")
my_dog = Dog("Fido", 5)
my_dog.bark() # prints "Woof!"
```
### Exception Handling
Exception handling in Python is done using try/except blocks.
```python
try:
x = 1 / 0
except ZeroDivisionError:
print("Cannot divide by zero!")
```
### File I/O
Python can read from and write to files using the built-in `open()` function.
```python
with open("myfile.txt", "w") as file:
file.write("Hello, World!")
with open("myfile.txt", "r") as file:
print(file.read()) # prints "Hello, World!"
```
## References
- [Python Documentation](https://docs.python.org/3/)
- [Python Variables](https://docs.python.org/3/tutorial/introduction.html#first-steps-towards-programming)
- [Python Functions](https://docs.python.org/3/tutorial/controlflow.html#defining-functions)
- [Python Control Flow](https://docs.python.org/3/tutorial/controlflow.html)
- [Python Data Structures](https://docs.python.org/3/tutorial/datastructures.html)
- [Python Modules](https://docs.python.org/3/tutorial/modules.html)
- [Python Object-Oriented Programming](https://docs.python.org/3/tutorial/classes.html)
- [Python Exception Handling](https://docs.python.org/3/tutorial/errors.html)
- [Python File I/O](https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files)

@ -0,0 +1,122 @@
title : Micropython ressources
author: zvevqx
published: 2025-11-22
cat: python
desc: ressources for micropython
...
# ressource website
[https://awesome-micropython.com/](https://awesome-micropython.com/)
# ide
- thonny
[https://thonny.org/](https://thonny.org/)
linux install :
```
Official downloads for Linux
Installer (installs private Python 3.10 on x86_64, uses existing python3 elsewhere)
bash <(wget -O - https://thonny.org/installer-for-linux)
Re-using an existing Python installation (for advanced users)
pip3 install thonny
3rd party distributions (may have older version)
Flatpak
flatpak install org.thonny.Thonny
Snap
sudo snap install thonny
Debian, Raspbian, Ubuntu, Mint and others
sudo apt install thonny
Fedora
sudo dnf install thonny
```
# Introduction to MicroPython with Thonny IDE and ESP32
## What is MicroPython?
MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments. [MicroPython Documentation](https://docs.micropython.org/en/latest/index.html)
## What is Thonny IDE?
Thonny is a Python IDE for beginners. It has a simple and clean interface, and it is designed specifically for teaching and learning programming. [Thonny IDE](https://thonny.org/)
## What is ESP32?
ESP32 is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. [ESP32 Series](https://www.espressif.com/en/products/socs/esp32)
## Getting Started
1. **Install Thonny IDE**: Download and install Thonny IDE from the official website. It's available for Windows, macOS, and Linux. [Thonny IDE](https://thonny.org/)
2. **Set up ESP32 with MicroPython**: You'll need to flash the MicroPython firmware onto your ESP32 board. You can do this using a tool like esptool.py. Once you've flashed the firmware, you can connect to the ESP32 using Thonny. [Getting Started with ESP32 and MicroPython](https://randomnerdtutorials.com/micropython-programming-esp32-esp8266/)
3. **Write Your First Program**: In Thonny, you can write Python code in the editor on the left and see the output in the shell on the right. Try writing a simple program like blinking an LED or printing to the serial console.
```python
from machine import Pin, Timer
led = Pin(2, Pin.OUT) # create output pin on GPIO2
tim = Timer(-1) # create software timer
def blink(timer):
led.toggle() # toggle LED
tim.init(freq=2.5, mode=Timer.PERIODIC, callback=blink) # blink LED at 2.5Hz
```
This code will blink an LED connected to GPIO2 of the ESP32 at a frequency of 2.5Hz.
## Basic Python Concepts
- **Variables**: Variables are used to store data. They can hold different types of values, like numbers, strings, and lists.
```python
x = 10 # integer
y = "Hello, World!" # string
z = [1, 2, 3] # list
```
- **Functions**: Functions are reusable blocks of code that perform a specific task. They help break down complex programs into smaller, more manageable parts.
```python
def greet(name):
print(f"Hello, {name}!")
greet("Alice") # prints "Hello, Alice!"
```
- **Control Flow**: Control flow statements, like if/else and for/while loops, determine the order in which code is executed.
```python
for i in range(5):
print(i) # prints numbers from 0 to 4
x = 10
if x > 0:
print("x is positive") # prints "x is positive"
```
## References
- [MicroPython Documentation](https://docs.micropython.org/en/latest/index.html)
- [Thonny IDE](https://thonny.org/)
- [ESP32 Series](https://www.espressif.com/en/products/socs/esp32)
- [Getting Started withomitempty ESP32 and MicroPython](https://randomnerdtutorials.com/micropython-programming-esp32-esp8266/)
- [First Steps with ESP32 and MicroPython](https://docs.micropython.org/en/latest/esp32/quickref.html)
- [Python Variables](https://docs.python.org/3/tutorial/introduction.html#first-steps-towards-programming)
- [Python Functions](https://docs.python.org/3/tutorial/controlflow.html#defining-functions)
- [Python Control Flow](https://docs.python.org/3/tutorial/controlflow.html)

@ -17,4 +17,10 @@ desc: differents one line ( or more ) command to do differents stuff
`cdda2wav -vall cddb=-1 speed=4 -paranoia paraopts=proof -J -B -D /dev/sr0`
## disk usage analyser
`ndcu`
## local ai
https://github.com/StanGirard/quivr/#demo-highlights-

@ -161,7 +161,7 @@ ul li h2:before{
}
#content-wrapper{
width:90%;
width:60%;
margin:auto ;
font-size:1.5em!important;
}

Loading…
Cancel
Save