Skip to content

Instantly share code, notes, and snippets.

View derhuerst's full-sized avatar

Jannis derhuerst

View GitHub Profile
@derhuerst
derhuerst / vdv_454_aus_isthalts.duckdb.sql
Last active July 6, 2026 13:18
analysing VDV-454 AUS IstFahrts/IstHalts using DuckDB
CREATE TABLE aus_isthalts AS
SELECT
*
-- parse IstHalt attributes
REPLACE (
Einsteigeverbot::BOOLEAN AS Einsteigeverbot,
Aussteigeverbot::BOOLEAN AS Aussteigeverbot,
Durchfahrt::BOOLEAN AS Durchfahrt,
Zusatzhalt::BOOLEAN AS Zusatzhalt,
@derhuerst
derhuerst / docker-compose.yml
Last active April 29, 2026 21:54
DELFI GTFS Validator metrics
name: delfi_gtfs_validator_metrics
services:
gtfs_validator_metrics_service:
image: ghcr.io/mobidata-bw/gtfs-validator-metrics-service
ports:
- '3000'
mem_limit: 4GB
mem_swappiness: 0 # don't swap
prometheus:
@derhuerst
derhuerst / 01-trip.http
Last active April 27, 2026 12:36
bls.ch journey planner OJP requests
POST /mmzd/rest/ojp/v2.0/servicerequest HTTP/2
Host: api.bls.ch
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:149.0) Gecko/20100101 Firefox/149.0
Accept: application/xml
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate, br, zstd
Content-Type: application/xml
Authorization: Bearer eyJ4NXQiOiJRSEhwM0dpQUs0clVaUHBTMW9QSS1IOWVRanciLCJraWQiOiJORGRsWkRBek1XWmxOek5pTmpWa05tRXdOalUxWkdRME9UZzBaVEkxTldVMk5qTmxZak5sTVdabE1EUmpOMll5WVRBeFpXTTFOV1EzTlRobE5tVTVPUV9SUzI1NiIsInR5cCI6ImF0K2p3dCIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJldGllbm5lLmdvYmVsaUBibHMuY2giLCJhdXQiOiJBUFBMSUNBVElPTiIsImlzcyI6Imh0dHBzOi8vYXBpLmFzZ2FyZGVvLmlvL3QvYmxzYWdwcm9kL29hdXRoMi90b2tlbiIsImNsaWVudF9pZCI6Im5RM2ZTQU8zWXl5VUM4TWZBYXVWekhEa2JVNGEiLCJhdWQiOlsiblEzZlNBTzNZeXlVQzhNZkFhdVZ6SERrYlU0YSIsImNob3JlbzpkZXBsb3ltZW50OnByb2R1Y3Rpb24iXSwibmJmIjoxNzc3MjkyODY0LCJhenAiOiJuUTNmU0FPM1l5eVVDOE1mQWF1VnpIRGtiVTRhIiwib3JnX2lkIjoiMWRlNjE5ZGYtMjY5My00YTBmLWE1MjItYzU0MWIxZTQ1MmNmIiwiZXhwIjoxNzc3MjkzNzY0LCJvcmdfbmFtZSI6ImJsc2FncHJvZCIsImlhdC
@derhuerst
derhuerst / _.md
Last active January 29, 2026 23:59
mapping between GTFS feed/agency_id and Wikidata entity

As proposed in Traewelling/line-colors#91.

To be deprecated in favor of a more scalable and sustainable approach (e.g. a shared repo).

@derhuerst
derhuerst / how-to.md
Last active January 12, 2026 23:18
match GTFS-RT TripDescriptors using DuckDB

This uses gtfs-via-duckdb.

curl -fsSL \
  'https://mobility-api.mobility-database.fintraffic.fi/gtfs-realtime/v2/' \
  -H 'accept: application/protobuf' \
  -H "x-api-key: $api_key" \
  | ~/web/print-gtfs-rt-cli/cli.js -j \
  | duckdb -readonly -csv -f match.sql gtfs/fintraffic.gtfs.duckdb \
  | qsv select '!item' | head -n 10
@derhuerst
derhuerst / _.md
Last active September 10, 2026 15:20
GTFS Realtime: Multiple Feed Variants (draft)

GTFS Realtime: Multiple Feed Variants

This is an extension proposal to the GTFS Realtime (GTFS-RT) specification.

It proposes rules on how to publish the Realtime data so that it can be consumed unambiguously in conjunction with the corresponding GTFS Schedule (formerly "GTFS Static") data, without giving wrong information to travellers.

If don't care about "why?": Jump straight to the "what?" and "how?" sections.

Software supporting this

@derhuerst
derhuerst / train-routes-3943.http
Created September 4, 2025 21:29
SJ (Swedish Railways) live journey/trip information API
GET /public/trafficinfo-api/v2/rest/train-routes?transportId=3943&lang=en-GB&date=2025-09-03 HTTP/3
Host: prod-api.adp.sj.se
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:141.0) Gecko/20100101 Firefox/141.0
Accept: */*
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
Referer: https://www.sj.se/
ocp-apim-subscription-key: 39296c1a13304493b44236e1bcb7f544
request-id: |cebb240828a34cf59a9bb7df6302e49b.14c2fddb78834d96
traceparent: 00-cebb240828a34cf59a9bb7df6302e49b-14c2fddb78834d96-01
@derhuerst
derhuerst / 01-lines.http
Created August 26, 2025 20:05
Vy Bus4You live tracking API
GET /api/buslocation/FetchBusLines HTTP/2
Host: www.vybuss.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:141.0) Gecko/20100101 Firefox/141.0
Accept: application/json, text/plain, */*
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
Connection: keep-alive
Referer: https://www.vybuss.com/traffic-information/
Cookie: ASP.NET_SessionId=pduk1iwtt3wabugauungkoob; __RequestVerificationToken=YAQMK7HMvCbpzZTsSaSyhqynJeydctGMyyf8nG2ZCaDN2rtAS1L7F3Yl8wCFGDhzE4HT8AG-nucy7_kHFqQMp8zYoBk1
Sec-Fetch-Dest: empty
@derhuerst
derhuerst / notes.md
Created May 28, 2025 19:27
Vortrag VBB-GTFS-RT 2025-05-28

intro

  • Jannis: selbstständiger Software-Engineer
  • VBB: Verkehrsverbund Berlin/Brandenburg, recht groß, einige wenige und viele kleine VUs
  • GTFS-RT-Feed

Problem

@derhuerst
derhuerst / komoot-gpx.js
Created April 19, 2025 23:11
Komoot route to GPX conversion
const t0 = Date.parse('2025-04-20T13:00+02:00')
const waypoints = kmtBoot.getProps().page.store.moc['//api.komoot.de/v007/discover_tours/11959690']._coordsGenerate()[0]
process.stdout.write(`\
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1">
<metadata>
<name>tour</name>
</metadata>
<trk>