Skip to content

Instantly share code, notes, and snippets.

Avatar

Jannis R derhuerst

View GitHub Profile
@derhuerst
derhuerst / foo.sh
Created Nov 29, 2022
OTP flaky routing
View foo.sh
#!/bin/sh
set -e
set -o pipefail
curl 'https://staging.api.bbnavi.de/otp/routers/default/index/graphql' \
-H 'authority: staging.api.bbnavi.de' \
-H 'accept: */*' \
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8,de;q=0.7' \
-H 'content-type: application/json' \
-H 'origin: http://localhost:8080' \
@derhuerst
derhuerst / 1-visitor.http
Created Sep 19, 2022
GoMedia on-board Wi-Fi entertainment system requests
View 1-visitor.http
GET /services/cna/visitor HTTP/1.1
Host: media.flixbus.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: application/json, text/plain, */*
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br
DNT: 1
Connection: keep-alive
Referer: https://media.flixbus.com/
Cookie: visitor_id=3add6454-63e6-b4bd-12e9-894533aeeceb
@derhuerst
derhuerst / update-map-1.http
Created Sep 13, 2022
NV-ProVi live map requests
View update-map-1.http
POST http://livemap.nv-provi.de/__updateMap.php HTTP/1.1
Host: livemap.nv-provi.de
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: */*
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
X-Requested-With: XMLHttpRequest
Origin: http://livemap.nv-provi.de
DNT: 1
Connection: keep-alive
@derhuerst
derhuerst / _.md
Last active Aug 15, 2022
curl-based HTTP mirroring script
View _.md

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.

server side

@derhuerst
derhuerst / ugly.js
Last active Jul 27, 2022
JavaScript: calling the grandparent's constructor
View ugly.js
// Note: You wouldn't ever want to do this!
function A () {
this.a = true
return this
}
A.prototype.fromA = 'from A'
function B () {
this.constructor.prototype.__proto__.constructor.call(this)
@derhuerst
derhuerst / 0-serverinfo.http
Last active Jul 7, 2022
some requests of the 4.5.1 HAFAS VBB iOS app
View 0-serverinfo.http
POST /bin/mgate.exe?mic=14d0017e50dda50bd3abf7b5fb41a7b7&mac=2cb2019aaf1c9e4162278891d713776b HTTP/1.1
Host: fahrinfo.vbb.de
Content-Type: application/json
Connection: keep-alive
Accept: */*
User-Agent: App/4.5.1 (iPhone; iOS 15.4.1; Scale/2.00)
Accept-Language: en-DE;q=1, de-DE;q=0.9
Content-Length: 218
Accept-Encoding: gzip, deflate, br
@derhuerst
derhuerst / 0-online-status.http
Last active Jun 29, 2022
VIAS RE 19 to Düsseldorf, unwired.at captive portal requests
View 0-online-status.http
POST /api/graphql HTTP/1.1
Host: wasabi-splashpage.wifi.unwired.at
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0
Accept: */*
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: https://wasabi-splashpage.wifi.unwired.at/internet
content-type: application/json
Origin: https://wasabi-splashpage.wifi.unwired.at
Content-Length: 484
@derhuerst
derhuerst / _.sh
Created Jan 19, 2022
build CoreDNS with a plugin
View _.sh
#!/bin/bash
set -e
set -o pipefail
cd "$(dirname $(realpath $0))"
set -x
# update Go
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu
# todo: determine latest version automatically
@derhuerst
derhuerst / _.sh
Created Jan 19, 2022
make Certbot/Let's Encrypt certificates available to other tools
View _.sh
#!/bin/bash
set -e
set -o pipefail
# install & configure Certbot…
# make /etc/letsencrypt accessible to ssl-cert group
chgrp -R ssl-cert /etc/letsencrypt
find /etc/letsencrypt -exec chmod g+r "{}" \;