Skip to content

Instantly share code, notes, and snippets.

View Jan-Zeiseweis's full-sized avatar

Jan Zeiseweis Jan-Zeiseweis

View GitHub Profile
@Jan-Zeiseweis
Jan-Zeiseweis / codestyle.xml
Created April 26, 2023 17:23
PyCharm code style.xml
<code_scheme name="Default" version="173">
<JSCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_GENERATOR_MULT" value="true" />
<option name="REFORMAT_C_STYLE_COMMENTS" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
@Jan-Zeiseweis
Jan-Zeiseweis / kill_wrapper.sh
Created November 3, 2023 18:48
kill_wrapper
#!/bin/bash
# run some program, and KILL it with deadly force upon ^C :) --sq5bpf
# this is a hack to make
CPID=0
intr() {
echo "killing $CPID"
kill -9 $CPID
}
@Jan-Zeiseweis
Jan-Zeiseweis / mouse.py
Created December 30, 2024 20:38
usb-device-mouse interface
# MicroPython USB Mouse module with Scroll Wheel
# MIT license; Copyright (c) 2023-2024 Angus Gratton
from micropython import const
import struct
import machine
from usb.device.hid import HIDInterface
_INTERFACE_PROTOCOL_MOUSE = const(0x02)
#!/bin/zsh
# Check if the correct number of arguments is provided
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <directory> <password>"
exit 1
fi
# Read arguments
ARCHIVE_DIR="$1"
@Jan-Zeiseweis
Jan-Zeiseweis / data_unit_converter.py
Created March 7, 2025 11:51
Data Unit Converter
import re
# Umrechnungsfaktoren
BIN_PREFIX = {"ki": 1024, "mi": 1024**2, "gi": 1024**3, "ti": 1024**4,
"pi": 1024**5, "ei": 1024**6, "zi": 1024**7, "yi": 1024**8}
DEC_PREFIX = {"k": 1000, "m": 1000**2, "g": 1000**3, "t": 1000**4,
"p": 1000**5, "e": 1000**6, "z": 1000**7, "y": 1000**8}
# Regex zum Parsen der Eingabe
pattern = re.compile(r"^(\d+)([kmgtpezy]?i?)(bit|byte)$", re.IGNORECASE)