Skip to content

Instantly share code, notes, and snippets.

@Gijs-Koot
Last active February 2, 2017 15:59
Show Gist options
  • Save Gijs-Koot/a140fd4b69402b9cfa346fbfb992ffc5 to your computer and use it in GitHub Desktop.
Save Gijs-Koot/a140fd4b69402b9cfa346fbfb992ffc5 to your computer and use it in GitHub Desktop.
"Oneliner" voor het bekijken van het beschikbaar aantal OV-fietsen op alle stations in Nederland.
## Dependencies:
* httpie
* csvkit
* jq
* json2csv
## Dit is de regel (filtert op utrecht en amsterdam, pas aan naar wens)
http http://fiets.openov.nl/locaties.json | jq '[.locaties[] | {loc: .description, bikes: (try .extra.rentalBikes | tonumber), date: .extra.fetchTime | todate}] | sort_by(-.bikes)' | json2csv | csvsql --query "SELECT * FROM stdin WHERE loc LIKE 'Ams%' OR loc LIKE 'Utr%' LIMIT 100" | csvlook
## Resultaat
|-----------------------------------------+-------+-----------------------------|
| loc | bikes | date |
|-----------------------------------------+-------+-----------------------------|
| Amsterdam Centraal (West) | 138 | 2017-02-02 15:54:53.000000 |
| Utrecht Jaarbeursplein | 68 | 2017-02-02 15:54:53.000000 |
| Utrecht Centraal West | 65 | 2017-02-02 15:54:53.000000 |
| Utrecht Centraal Oost, Smakkelaarsveld | 39 | 2017-02-02 15:54:53.000000 |
| Utrecht Centraal, Hoog Catharijne | 37 | 2017-02-02 15:54:53.000000 |
| Amsterdam Zuid | 27 | 2017-02-02 15:54:53.000000 |
| Amsterdam Muiderpoort | 20 | 2017-02-02 15:54:53.000000 |
| Amsterdam Sloterdijk | 19 | 2017-02-02 15:54:53.000000 |
| Utrecht Vaartsche Rijn | 15 | 2017-02-02 15:54:53.000000 |
| Utrecht Uithof | 13 | 2017-02-02 15:54:53.000000 |
| Utrecht Overvecht | 12 | 2017-02-02 15:54:53.000000 |
| Utrecht P+R Westraven | 10 | 2017-02-02 15:54:53.000000 |
| Utrecht Zuilen | 9 | 2017-02-02 15:54:53.000000 |
| Utrecht Vredenburg | 5 | 2017-02-02 15:54:53.000000 |
| Utrecht Mariaplaats | 5 | 2017-02-02 15:54:53.000000 |
| Amsterdam IJzijde-A | 4 | 2017-02-02 15:54:53.000000 |
| Utrecht Leidsche Rijn | 4 | 2017-02-02 15:54:53.000000 |
| Utrecht Terwijde | 3 | 2017-02-02 15:54:53.000000 |
| Amsterdam RAI | 3 | 2017-02-02 15:54:53.000000 |
| Utrecht P+R Muziektheater | 2 | 2017-02-02 15:54:53.000000 |
| Utrecht Moreelsepark | 2 | 2017-02-02 15:54:53.000000 |
| Utrecht Centraal, Stationsplein | 2 | 2017-02-02 15:54:53.000000 |
| Amsterdam Mahlerplein | 2 | 2017-02-02 15:54:53.000000 |
| Utrecht Lunetten | 1 | 2017-02-02 15:54:53.000000 |
| Utrecht Janskerkhof | 0 | 2017-02-02 15:54:53.000000 |
| Utrecht P+R Papendorp | 0 | 2017-02-02 15:54:53.000000 |
| Amsterdam Lelylaan | 0 | 2017-02-02 15:54:53.000000 |
|-----------------------------------------+-------+-----------------------------|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment