Skip to content

Instantly share code, notes, and snippets.

View TobleMiner's full-sized avatar
🔥

Toble_Miner/tsys TobleMiner

🔥
  • Kiel
View GitHub Profile
@TobleMiner
TobleMiner / protocol.py
Last active December 4, 2019 15:24
Serial touchscreen protocol of some old shitty touchscreen terminal
#!/usr/bin/env python3
'''
standard message:
0x55 0x54 <action> <x lo> <x hi> <y lo> <y hi> 0xFF 0x00 <checksum>
actions:
- 0x01 - touch down
- 0x02 - touch hold
@TobleMiner
TobleMiner / depdendency-issues.md
Last active November 4, 2019 10:00
Pinebook Pro Mainline Linux DTS
  1. The panel driver must be loaded before the panel platform device is added
  2. Regulator vcc_lcd_en must come up in time for the dp bridge driver not to fail
  3. Deferred probing of the edp driver expects to find a panel, else it will fail
  4. pinctl-0 becomes available too late for all the above, thus we can atm not depend on it
@TobleMiner
TobleMiner / Makefile
Created October 9, 2019 20:05
Simple pdflatex makefile
PAPER := bittorrent
SOURCES := Makefile IEEEtran.cls IEEEabrv.bib references.bib
GENERATED := $(PAPER).pdf $(PAPER).aux $(PAPER).bbl $(PAPER).log
RM ?= rm -f
%.pdf : %.tex %.bbl
while true; do \
out=$$(pdflatex $< 2>&1); \
echo "$$out"; \
_G['vardumpstr'] = function(var, longform, prefix, refs, out)
prefix = prefix or ''
refs = refs or {}
out = out or ''
if type(var) == 'table' then
local cyclic = not not refs[var]
refs[var] = true
out = out .. prefix .. tostring(var) .. (cyclic and ' (cyclic)' or '') .. '\n'
if not cyclic then
@TobleMiner
TobleMiner / remove_trailing_whitespace.sh
Created August 28, 2019 13:41
Simple funtion for removing trailing whitespace from source code files
remove_trailing_whitespace() {
sed -i 's/[[:space:]]\+$//g' $@
}
@TobleMiner
TobleMiner / expand_unexpand.sh
Created August 28, 2019 13:32
Simple bash functions for expanding/unexpanding a set of files
unexpand_files() {
(
set -e -o pipefail
first_only='--first-only'
args=''
OPTIND=1
while getopts "at:" opt; do
case "$opt" in
a) args="$args -a"; first_only='';;
t) args="$args -t $OPTARG";;
@TobleMiner
TobleMiner / deprecation_notice.md
Last active August 10, 2019 17:41
bind zonefile serial validator written in bash
@TobleMiner
TobleMiner / 40-usb-add.rules
Created July 28, 2019 18:00
Simple python script to reattach host devices to libvirt guests when they are hotplugged on the host
ACTION=="bind", SUBSYSTEMS=="usb", RUN="/usr/local/sbin/libvirt-hotplug.py usb"
@TobleMiner
TobleMiner / dust_munin.py
Created April 25, 2019 02:33
Raspberry PI based PMS5003 dust monitor for munin
#!/usr/bin/env python3
import sys
import socket
import colorsys
import re
from struct import unpack, calcsize
from collections import namedtuple
#!/usr/bin/env bash
set -e -o pipefail
BUS="1"
hex_to_byte() {
echo "$((16#$1))"
}
extract_byte() {