Skip to content

Instantly share code, notes, and snippets.

View z3ntu's full-sized avatar

Luca Weiss z3ntu

View GitHub Profile
@z3ntu
z3ntu / README.md
Last active April 4, 2024 23:32
KDE 1 Arch Linux install guide
@z3ntu
z3ntu / rotation_matrix.py
Last active November 7, 2023 20:12
generate the iio rotation matrix
#!/usr/bin/python3
import glob
import os
import sys
import time
"""
(according to Android emulator, seems to be inverse for iio)
upright/normal: 0 9.81 0
@z3ntu
z3ntu / gist:c5ca8f6040d8934fafc5e686b234890e
Last active October 28, 2023 20:39
openrazer fake driver commands
# one tab
mkdir -p /tmp/daemon_stuff/{,data,logs}; mkdir -p /tmp/daemon_test
./scripts/create_fake_device.py --dest /tmp/daemon_test --all
./scripts/create_fake_device.py --dest /tmp/daemon_test razerdeathadderchroma
# other tab
systemctl --user stop openrazer-daemon.service
openrazer-daemon -F --verbose --run-dir /tmp/daemon_stuff/data --log-dir /tmp/daemon_stuff/logs --test-dir /tmp/daemon_test
# run from source from testdata
PYTHONPATH="pylib:daemon" python3 ./daemon/run_openrazer_daemon.py -Fv --run-dir /tmp/daemon_stuff/data --log-dir /tmp/daemon_stuff/logs --test-dir /tmp/daemon_test --config=$PWD/daemon/resources/razer.conf
@z3ntu
z3ntu / asn-csv-process.py
Last active July 1, 2023 14:54
Process csv file exported from ASN Bank to set account name
#!/usr/bin/env python3
"""
ASN Bank CSV export doesn't contain any opposing account name for contactless
payments but contains the merchant name in the description field along with a
lot of other information.
We can split this description on the '>' chracter and extract the merchant
that way.
Idea adapted from: https://github.com/DanielsWrath/YNABGoingDutch/blob/3dcde360906bc87dc43efb62b0698f3f20d34519/js/bankMapper.js#L101-L111
@z3ntu
z3ntu / start_diag.sh
Created November 2, 2022 19:20
diag router
#!/bin/bash
set -e
G1="/sys/kernel/config/usb_gadget/g1"
mkdir -p $G1
mkdir -p $G1/strings/0x409
mkdir -p $G1/functions/ffs.diag
mkdir -p $G1/configs/c.1
@z3ntu
z3ntu / convert.py
Created July 22, 2022 21:48
Convert BlaBlaCar Bus stops CSV into usable JS array
import csv
def truncate(n):
# Truncate number to 5 digits
return int(float(n) * 100000) / 100000
# curl -O https://bus-api.blablacar.com/gtfs.zip && unzip gtfs.zip stops.txt
with open('stops.txt', 'r') as csvfile:
reader = csv.DictReader(csvfile)
print("var stops = {")
@z3ntu
z3ntu / get_unlock_secret.py
Created October 6, 2021 16:53
Calculate unlock code for Medion Lifetab S831X (bootloader is buggy so unlock actually doesn't work)
#!/usr/bin/python3
import sys
def get_secret(serial: str) -> str:
secret = ""
for i in range(16):
value = ord(serial[i]) + ord("AB2D3F3B37890C1A"[i]) + 9
secret += format(value, 'X')
return secret
@z3ntu
z3ntu / repack.sh
Created July 30, 2021 19:31
repack boot.img unpacked with unpackbootimg -- https://github.com/osm0sis/mkbootimg
#!/bin/bash
prefix="$1"
shift
if [ -z "$prefix" ]; then
echo "ERROR: provide prefix!"
exit 1
fi
@z3ntu
z3ntu / sysbench.md
Last active May 25, 2020 15:44
Sysbench values for my different computers/servers

Sysbench benchmarks

Tested with sysbench 0.4.12 (Command: sysbench --test=cpu --num-threads=$numThreads run)

HP ProBook

CPU: Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz

  • 1 thread: 10.3467s
  • 4 threads: 2.9861s
  • 8 threads: 3.0074s

My computer at home

@z3ntu
z3ntu / shell-commands.sh
Last active April 17, 2020 19:57
cmake git bisect
git bisect start
git bisect good v3.15.0
git bisect bad origin/master
git bisect run ~/dev/postmarketOS/unity8-stuff/system-settings-bisect-script.sh