Skip to content

Instantly share code, notes, and snippets.

View derhuerst's full-sized avatar

Jannis R derhuerst

View GitHub Profile
@derhuerst
derhuerst / _.md
Last active April 9, 2024 11:06
List of HAFAS API Endpoints
@derhuerst
derhuerst / _.md
Last active March 31, 2024 17:01
curl-based HTTP mirroring script

curl-based HTTP mirroring script

This is a script that creatively uses the curl CLI to download an HTTP resource (colloquially "file"); It saves time & bandwidth whenever possible, but not at the expense of correctness.

  • Compares ETags to make sure that an unchanged resource is not transfered again, but a changed resource always is.
  • Requests a CE-coded (a.k.a. compressed, e.g. gzipped) representation of the resource, falling back to the "regular" one.
  • Supports continuation, using conditional requests, but in contrast to the -C - curl flag works with CE-coded responses, and falls back to a "full body" request.

People asked me: Why not use wget for this?

@derhuerst
derhuerst / intro.md
Last active February 22, 2024 17:30
Installing Git on Linux, Mac OS X and Windows
@derhuerst
derhuerst / _.md
Created February 16, 2024 10:46
ICE 645 from Essen Hbf to Berlin Spandau

For a long time, there were <6 minutes of delay. In Berlin-Spandau, a delay happened because of a medical emergency.

@derhuerst
derhuerst / uic-barcodes.md
Last active February 13, 2024 19:37
how UIC barcodes work

from the Digital Security Elements for Rail Passenger Ticketing technical document:

The whole security system is based on asymmetrical key pairs: Private and Public keys. To ensure the autenthicy of the public keys the keys shall be certified by a certification authority and the certificates exchanged for the ticket control precedures.

These keys are generated on a regular base (e.g. every 6 months) by the party that wants to encrypt data using such a key ("the security provider"). To enable decryption of the encoded data, the corresponding certificate should be made available to every TCO (Ticket Controlling Organisation)

AZTEC is the better one of both because of error-correction, readability in difficult conditions and the fact that it is more variable in size. The reason that the PDF417 barcode (a so called “Stacked linear barcode”) is still in t

@derhuerst
derhuerst / output.js
Created May 10, 2016 10:22
how fetch a GitHub user's stars
[
{
owner: 'bcoe',
repo: 'top-npm-users',
description: ':star: Generate a list of top npm users by based on monthly downloads.',
language: 'JavaScript',
isFork: false,
stargazers: 27,
watchers: 27
}
@derhuerst
derhuerst / guide.md
Last active January 17, 2024 21:43
guide how to release new vbb-* modules
  • download GTFS file from the Berlin open data portal
  • push to vbb-gtfs.jannisr.de
    • create dir & datapackage.json in the repo
    • put data, rename .txt -> .csv
    • chmod -x *.csv
    • ./deploy.sh
    • chown -R root:www-data .
    • chmod -R 755 *
    • gzip -k --best {date}/*.csv
    • change latest symlink
@derhuerst
derhuerst / ice-572-2023-11-02T19:41:02+01:00-hafas.json
Last active November 4, 2023 01:18
ICE 572 from Mannheim Hbf to Berlin Hbf
{"public":true,"mode":"train","line":{"type":"line","id":"ice-572","name":"ICE 572"},"traveledDistance":166334,"distanceToPreviousStop":4124,"totalDistance":597863,"next":{"type":"station","id":"8010101","name":"Erfurt Hbf","location":{"type":"location","latitude":50.972551,"longitude":11.038499}},"scheduledNext":{"type":"station","id":"8010101","name":"Erfurt Hbf","location":{"type":"location","latitude":50.972551,"longitude":11.038499}},"previous":{"type":"station","id":"8000105","name":"Frankfurt(Main)Hbf","location":{"type":"location","latitude":50.107145,"longitude":8.663789}},"last":{"type":"station","id":"8098160","name":"Berlin Hbf (tief)","location":{"type":"location","latitude":52.525592,"longitude":13.369545}},"passed":[{"station":{"type":"station","id":"8000096","name":"Stuttgart Hbf","location":{"type":"location","latitude":48.784084,"longitude":9.181635}},"arrival":null,"arrivalDelay":null,"arrivalPlatform":"9","departure":"2023-11-02T17:24:39+01:00","departureDelay":99,"departurePlatform":"9","