Skip to content

Instantly share code, notes, and snippets.

View ptrcnull's full-sized avatar
🏳️‍🌈
she/her

Patrycja ptrcnull

🏳️‍🌈
she/her
View GitHub Profile
@ptrcnull
ptrcnull / git-protocol.py
Created September 16, 2024 01:46
simple Git wire protocol parser/serializer in Python
MAGIC_DELIMITER = 69420
def serialize_git_pack(args):
git_list = args[0]
for extra in args[1:]:
git_list.append(MAGIC_DELIMITER)
git_list.extend(extra)
res = ''
for arg in git_list:
@ptrcnull
ptrcnull / patch_teams.py
Created February 22, 2024 08:05
Enable DevTools in Microsoft Teams classic desktop app
needle = b'this.appStateService.isDebugModeEnabled()'
better = b'true/*ppStateService.isDebugModeEnabled*/'
with open('/Applications/Microsoft Teams classic.app/Contents/Resources/app.asar', 'r+b') as f:
x = f.read()
off = x.find(needle)
f.seek(off)
f.write(better)
@ptrcnull
ptrcnull / EicServerProxy.md
Last active June 30, 2024 11:14
EicServerProxy notes

sklad

https://bilet.intercity.pl/EicServerProxy?service=sklad
	&kategoria=IC
	&numer=4122
	&dataWyjazduPociagu=202307160859
	&dataPrzyjazduPociagu=202307161322
	&stacjaOd=5100042
	&stacjaDo=5100136
	&typSkladu=ED161
@ptrcnull
ptrcnull / snippets.md
Last active June 14, 2023 21:26
random code/shell snippets

running a qemu vm with display and network

qemu-system-x86_64 -cpu host -accel kvm -m 16G -smp 8 -bios /usr/share/OVMF/OVMF.fd -drive format=raw,file=/dev/sda -net nic,model=e1000 -net user -usbdevice tablet -vga qxl -vnc :0

generate boarding pass aztec from scanned pdf417

wl-paste -t image/png | ZXingReader /dev/stdin -bytes | xargs -I{} ZXingWriter -size 800x800 AZTEC {} meow.png
@ptrcnull
ptrcnull / enter.sh
Last active February 19, 2023 16:17
enter chroot
#!/bin/sh
set -eu
# make sure we're root
if [ "$(id -u)" != 0 ]; then
sucmd="su -c"
if command -v doas >/dev/null; then
sucmd="doas"
elif command -v sudo >/dev/null; then
sucmd="sudo"
@ptrcnull
ptrcnull / apatch
Last active April 25, 2022 19:11
shitty util to make aports patches easier
#!/bin/sh
[ -f APKBUILD ] || ( echo "please run this in a package directory"; exit 1 )
[ ! -f "$1" ] || ( echo "patch $1 already exists"; exit 1 )
[ "$1" != "" ] || ( echo "usage: apatch <patch name>"; exit 1 )
abuild clean fetch unpack prepare
# obtain builddir
. APKBUILD
@ptrcnull
ptrcnull / startwl
Last active April 12, 2022 12:17
small sway launcher
#!/bin/sh
export XDG_RUNTIME_DIR=/tmp/run-1000
mkdir -p $XDG_RUNTIME_DIR
chown patrycja:patrycja $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
export MOZ_ENABLE_WAYLAND=1
export LANG="en_IE.UTF-8"
export QT_QPA_PLATFORM=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
@ptrcnull
ptrcnull / sway-toggle-sigstop.sh
Created January 25, 2022 02:16
Script to toggle SIGSTOP/SIGCONT on all sway GUI processes
#!/bin/sh
pids="$(swaymsg -t get_tree | grep pid | grep -oE '[0-9]+')"
first=$(echo "$pids" | head -n 1)
if grep -q stopped "/proc/$first/status"; then
sig=CONT
else
sig=STOP
fi
@ptrcnull
ptrcnull / recover.sh
Created January 20, 2022 12:43
recover android app from data backup
#!/system/bin/sh
if [[ ! -d "$1" ]]; then
echo local not found
exit 1
fi
if [[ ! -d "/data/data/$1" ]]; then
echo data not found
exit 1
fi
@ptrcnull
ptrcnull / gist:80fd4997c301ccc52cafa1e4ca86a32e
Created January 14, 2022 09:27
Motion logs for 1415:2000
25646 sendto(4, "<13>Jan 14 09:23:34 : [1:Unknown] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items\n", 104, 0, NULL, 0) = 104
25646 writev(2, [{iov_base="", iov_len=0}, {iov_base="[1:Unknown] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items\n", iov_len=82}], 2) = 82
25646 mmap(NULL, 460820, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff578ccd000
25646 mmap(NULL, 460820, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff578c5c000
25646 mmap(NULL, 460820, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff578beb000
25646 mmap(NULL, 1228820, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff578abe000
25646 mmap(NULL, 460820, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff578a4d000
25646 mmap(NULL, 460820, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff5789dc000
25646 mmap(NULL, 307220, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff578990000
25646 brk(0x559bfb324000)