Skip to content

Instantly share code, notes, and snippets.

Avatar
🥑
Vegan snob

Benjamin W. Broersma bwbroersma

🥑
Vegan snob
View GitHub Profile
View bike_lr.json
{"v":"5.7.1","fr":30,"ip":0,"op":151,"w":335,"h":256,"nm":"Fietser_App3","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Hoofd","parent":5,"hd":true,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":-5,"ix":10},"p":{"a":0,"k":[1.251,35.186,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.67,"y":1},"o":{"x":0.167,"y":0},"t":-31,"s":[{"i":[[23.327,2.845],[4.995,23.158],[0,0],[-3.519,-23.328]],"o":[[-0.593,-0.072],[-2.703,-12.531],[0,0],[2.99,19.82]],"v":[[384.851,-50.454],[393.534,-81.892],[381.104,-98.296],[410.562,-82.062]],"c":true}]},{"i":{"x":0.67,"y":1},"o":{"x":0.167,"y":0},"t":-23,"s":[{"i":[[23.327,2.845],[4.995,23.158],[0,0],[-3.519,-23.328]],"o":[[-0.593,-0.072],[-2.703,-12.531],[0,0],[2.99,19.82]],"v":[[384.851,-50.454],[393.534,-81.892],[381.104,-98.296],[410.562,-82.062]],"c":true}]},{"i":{"x":0.67,"y":1},"o":{"x":0.33,"y":0},"t":-11,"s":[{"i":[[23.
View ICAOMasterList.sh
#!/bin/sh
# check https://www.icao.int/Security/FAL/PKD/Pages/ICAO-Master-List.aspx for the URL
curl -OL 'https://www.icao.int/Security/FAL/PKD/MasterListAD3172FF-9D1E-4589-91D5-34C3793053F0/ICAO_ml_2021.04.06.ml'
binwalk ICAO_ml_2021.04.06.ml | awk '{system("dd bs=1 skip="$1" count="($14+4)" if=ICAO_ml_2021.04.06.ml of="$1".cer")}'
# for f in *.cer; do >&2 echo -n "$f:"; openssl x509 -inform DER -subject -noout -in $f 2>/dev/null; done | grep 'C = NL'
View can-i-register-to-vaccinate.sh
#!/bin/sh
if [ "$#" -ne 2 ]; then
>&2 echo "Usage: $0 YEAR audio.mp3"
exit 1
fi
if [ ! -f "$2" ]; then
>&2 echo "$2 does not exist."
exit 1
fi
command -v curl >/dev/null 2>&1 || { echo >&2 "Please install 'curl' first: $ sudo apt install curl."; exit 1; }
View StefBos-Ongrijpbaar.md
@bwbroersma
bwbroersma / details-CSS-only-fallback.html
Last active Jun 24, 2020
details fallback with 3 extra (hidden) HTML nodes + copy of all summary inner nodes per detail and 19 lines of CSS (for IE11 and Edge 12-18)
View details-CSS-only-fallback.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>test</title>
</head>
<body>
<details class="details">
<summary class="summary">click me to open1</summary>
<input type="checkbox" id="toggle1" aria-hidden="true">
@bwbroersma
bwbroersma / logic.sh
Created May 3, 2020
Schiphol flight data
View logic.sh
#!/bin/bash
#Get a key at https://developer.schiphol.nl/
APP_ID="********"
APP_KEY="********************************"
#Check page count with:
# curl 'https://api.schiphol.nl/public-flights/flights?includedelays=false&scheduleDate=2019-11-10&page=0&sort=%2BscheduleTime' -sSfA '' --compressed -H 'Accept: application/json' -H "app_id: $APP_ID" -H "app_key: $APP_KEY" -H 'ResourceVersion: v4' -i | grep -i '^link' | grep -Po '=([0-9]+)>; rel="last' | grep -Po '[0-9]+'
#Fetch data:
curl 'https://api.schiphol.nl/public-flights/flights?includedelays=false&scheduleDate=2019-11-04&page=[0-248]&sort=%2BscheduleTime' -sSfA '' --compressed -H 'Accept: application/json' -H "app_id: $APP_ID" -H "app_key: $APP_KEY" -H 'ResourceVersion: v4' > flights-2019-11-04.jsonl
View scrape-drinkwaterkaart.sh
#!/bin/bash
curl -sSfA '' --compressed 'https://drinkwaterkaart.nl/waar-kan-ik-gratis-water-tappen/' | grep wpgmaps_localize_marker_data | sed -r 's/^[^=]+=\s*(.*);$/\1/' | jq '.["8"]|to_entries|map(.value)'
# | jq 'map(select(.desc|contains("NS")))|length'
# If you just want the GPX:
# curl -sSfLA '' --compressed 'https://drive.google.com/uc?export=download&id=1a7XmXrY3nXfF20AEb-iuXJke9GvZLIaR'
@bwbroersma
bwbroersma / schiphol-json-ld.sh
Created Dec 13, 2019
Scrape Schiphol for flights on a date: filter the HTML response for the JSON-LD output
View schiphol-json-ld.sh
curl 'https://www.schiphol.nl/en/departures/?datetime=2019-12-14&offset=[0-500:50]' -sSfA '' --compressed -H 'X-Requested-With: XMLHttpRequest' | pup 'script text{}' | jq -s .
@bwbroersma
bwbroersma / tk-onkostenvergoedingen-artikel-8.js
Last active Dec 10, 2019
Wet schadeloosstelling leden Tweede Kamer - Paragraaf 3 Onkostenvergoedingen - Artikel 8 - in code https://twitter.com/BWBroersma/status/1204365994241789952
View tk-onkostenvergoedingen-artikel-8.js
// https://www.rijksoverheid.nl/documenten/circulaires/2018/12/20/circulaire-wijzigingen-in-de-financiele-arbeidsvoorwaarden-per-1-januari-2019-voor-de-ambtenaren-werkzaam-in-de-sector-rijk
// https://wetten.overheid.nl/BWBR0004939/2019-07-01#Paragraaf3_Artikel8
const rijkDienstreizen2019 = {
lunch: 15.67,
avondmaaltijd: 23.71,
logies: 103.72,
ontbijt: 10.13,
kleineUitgavenOverdag: 5.07,
kleineUitgavensAvonds: 15.12
},
View totp.pg.sql
CREATE EXTENSION pgcrypto;
CREATE OR REPLACE FUNCTION totp(key BYTEA, clock_offset INT DEFAULT 0) RETURNS INT AS $$
DECLARE
c BYTEA := '\x000000000' || TO_HEX(FLOOR(EXTRACT(EPOCH FROM NOW()) / 30)::INT + clock_offset);
mac BYTEA := HMAC(c, key, 'sha1');
trunc_offset INT := GET_BYTE(mac, 19) % 16;
result INT := SUBSTRING(SET_BIT(SUBSTRING(mac FROM 1 + trunc_offset FOR 4), 7, 0)::TEXT, 2)::BIT(32)::INT % 1000000;
BEGIN
RETURN result;
END;