Skip to content

Instantly share code, notes, and snippets.

View bjesus's full-sized avatar

Yo'av Moshe bjesus

View GitHub Profile
@bjesus
bjesus / iwdqr
Created February 24, 2023 16:19
Linux wifi iwd qr code generator for sharing ssid and passphrase
#!/bin/bash
FILE=$(sudo find /var/lib/iwd -iname '*.psk' -type f -printf "%T+ %p\n" | sort | tail -1 | cut -d ' ' -f2-)
SSID=${FILE:13:-4}
PASS=$(sudo cat "$FILE" | grep Passphrase | cut -c 12-)
STRING="WIFI:S:$SSID;T:WPA;P:$PASS;;"
qrencode -t UTF8 "$STRING"
echo -e "SSID: \033[1m${SSID}\033[0m"
echo -e "Passphrase: \033[1m${PASS}\033[0m"
@bjesus
bjesus / gvb.sh
Created October 25, 2023 09:15
GVB station departures
#!/bin/sh
echo '[5,"/stops/09900"]' | websocat wss://maps-wss.gvb.nl/ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0' | tail -n +2 | while read -r line; do printf '%s\n' "$line" | jq -r '.[2]' | jq -r '.trip.lastCallMade.plannedDepartureAt + " " + .journey.publicLineNumber + " " + .journey.destination + " (" + .trip.lastCallMade.status + ", " + (.trip.lastCallMade.delay|tostring) + " delay)"'; done