Skip to content

Instantly share code, notes, and snippets.

View z3ntu's full-sized avatar

Luca Weiss z3ntu

View GitHub Profile
@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 / 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
@z3ntu
z3ntu / 1.patch
Last active February 27, 2020 16:00
downstreamkernel_package & downstreamkernel_prepare patches
diff --git a/device/linux-xiaomi-santoni/APKBUILD b/device/linux-xiaomi-santoni/APKBUILD
index 69dc4556..c9426910 100644
--- a/device/linux-xiaomi-santoni/APKBUILD
+++ b/device/linux-xiaomi-santoni/APKBUILD
@@ -52,23 +52,7 @@ build() {
}
package() {
- # kernel.release
- install -D "$builddir/include/config/kernel.release" \
@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 / appveyor.patch
Last active April 27, 2019 16:15
CI bringup for razer_test in patches
From 74c524a0ea3b29e17464cd7062eb0c6a28ac4a7d Mon Sep 17 00:00:00 2001
From: Luca Weiss <luca@z3ntu.xyz>
Date: Mon, 20 Aug 2018 16:49:10 +0200
Subject: [PATCH 01/46] Appveyor try 1
---
.appveyor.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 .appveyor.yml
@z3ntu
z3ntu / FP2.conf
Last active October 7, 2018 19:25
Alsa UCM pmOS FP2
# UCM configuration for FP2
Comment "Fairphone 2"
SectionUseCase."HiFi" {
File "hifi"
Comment "Play HiFi quality music."
}