Compare commits
No commits in common. 'o2switch' and 'main' have entirely different histories.
9 changed files with 100 additions and 829 deletions
@ -1,269 +0,0 @@ |
||||
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,19 +1,17 @@ |
||||
title : info |
||||
author: zvevqx |
||||
title: info |
||||
author: julien |
||||
|
||||
--- |
||||
|
||||
# contact |
||||
|
||||
julien.dutertre@erg.be |
||||
0460 96 28 21 |
||||
email@domain.com |
||||
|
||||
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 |
||||
|
||||
|
||||
@ -1,108 +0,0 @@ |
||||
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. |
||||
|
||||
|
||||
|
||||
|
||||
@ -1,130 +0,0 @@ |
||||
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) |
||||
@ -1,122 +0,0 @@ |
||||
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) |
||||
Loading…
Reference in new issue