This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Delta Encoding for bytes of the same size in a single line lambda function. No external or standard libraries required | |
deltaSameLength = lambda d1,d2: b''.join([bytes().fromhex(hex(b1^b2).replace("0x","").rjust(2,"0")) for b1,b2 in zip(d1,d2)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from loguru import logger | |
def catch_all_continue(func): | |
""" | |
This is probably the most useful function I have ever written. | |
It wraps any async function, and when there is an exception, it logs it and continues on like nothing ever happened. | |
This works amazing for web servers. Just wrap the server handler function in this and you are good to go. | |
Only requires loguru, however loguru can be switched for anything else. (Although I like it best) | |
Self imports functools just in case you do not want clutter in the project. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"arch": "arm", | |
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", | |
"disable-redzone": true, | |
"emit-debug-gdb-scripts": false, | |
"env": "newlib", | |
"executables": true, | |
"features": "+v7,+thumb2,+soft-float,-neon,+strict-align", | |
"linker": "arm-none-eabi-gcc", | |
"linker-flavor": "gcc", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run: build | |
qemu-system-x86_64 image.iso | |
build: | |
nasm -f elf64 bootstrap.asm -o bootstrap.o | |
ld -z max-page-size=0x1000 -S -o kernel.elf -Tlink.ld bootstrap.o | |
mv kernel.elf image/boot/kernel.elf | |
grub-mkrescue -o image.iso image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Super basic code to scan for and connect to v5 devices using the python bleak library. Prints out all data read over the user port. | |
""" | |
import argparse | |
import asyncio | |
from bleak import BleakScanner, BleakClient | |
SERVICE_UUID = "08590f7e-db05-467e-8757-72f6faeb13d5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
# uSock | |
A very simple socket server and client that allows sending simple one-way commands from a client to a server, and receiving a response back. | |
""" | |
try: | |
import uasyncio as asyncio | |
import ustruct as struct | |
MICROPYTHON = True | |
except ModuleNotFoundError: |