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
@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 / 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 / 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 / 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
},
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)]}})}'

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: