Skip to content

Instantly share code, notes, and snippets.

View bwbroersma's full-sized avatar
🐛
looking for bugs

Benjamin W. Broersma bwbroersma

🐛
looking for bugs
View GitHub Profile

Keybase proof

I hereby claim:

  • I am bwbroersma on github.
  • I am bwbroersma (https://keybase.io/bwbroersma) on keybase.
  • I have a public key whose fingerprint is 184C D8B1 1D4D C8E0 7274 508E 2338 B310 D762 01A9

To claim this, I am signing this object:

curl 'https://www.investeer-in-onderwijs.nl/load/mapschooldata.js' -sSfA '' --compressed \
| nodejs -e "fs=require('fs');console.log(JSON.stringify(eval(fs.readFileSync('/dev/stdin').toString()+';iioMarks;')));" \
| jq '{type:"FeatureCollection",features:map({type:"Feature",properties:{name:.[2],"marker-color":"#FF0000"},geometry:{type:"Point",coordinates:[(.[1]|tonumber),(.[0]|tonumber)]}})}'
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;
@bwbroersma
bwbroersma / tk-onkostenvergoedingen-artikel-8.js
Last active December 10, 2019 11:44
Wet schadeloosstelling leden Tweede Kamer - Paragraaf 3 Onkostenvergoedingen - Artikel 8 - in code https://twitter.com/BWBroersma/status/1204365994241789952
// 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
},
@bwbroersma
bwbroersma / schiphol-json-ld.sh
Created December 13, 2019 19:44
Scrape Schiphol for flights on a date: filter the HTML response for the JSON-LD output
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 / scrape-drinkwaterkaart.sh
Created March 3, 2020 14:29
Drinkwaterkaart scrape
#!/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 / logic.sh
Created May 3, 2020 19:08
Schiphol flight data
#!/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
@bwbroersma
bwbroersma / details-CSS-only-fallback.html
Last active June 24, 2020 23:24
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)
<!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">
#!/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; }