Skip to content

Instantly share code, notes, and snippets.

View phibo23's full-sized avatar

Philipp Bohnenstengel phibo23

View GitHub Profile
@phibo23
phibo23 / iceportal.js
Created January 3, 2024 15:10
ICE Portal iOS Widget with Scriptable App
const widget = new ListWidget()
const request = new Request('https://iceportal.de/api1/rs/status')
// {"connection":true,"serviceLevel":"AVAILABLE_SERVICE","gpsStatus":"LAST_KNOWN_POSITION","internet":"MIDDLE","latitude":50.9862425,"longitude":9.572488166666666,"tileY":109,"tileX":-2,"series":"412","serverTime":1704210660163,"speed":189.0,"trainType":"ICE","tzn":"ICE9474","wagonClass":"FIRST","connectivity":{"currentState":"HIGH","nextState":"UNSTABLE","remainingTimeSeconds":4800},"bapInstalled":true}
const json = await request.loadJSON()
const { speed } = json
widget.addText(speed?.toLocaleString('de', {
style: 'unit',
unit: 'kilometer-per-hour'
}))
@phibo23
phibo23 / rc3.world-map-bookmarklet
Created December 29, 2020 22:03
rc3.world map bookmarklet
javascript:(function(){ var patharray=location.pathname.split('/');var mapurl='https://raw.githubusercontent.com/MichaelKreil/rc3-map-scraper/master/image/https___' + patharray.slice(-1*(patharray.length-patharray.indexOf('global')-1)).join('_').replaceAll('.','_') + '.png';if(!patharray.includes('lobby')){mapurl=mapurl.replace('rc3_world_','rc3_world__')}window.open(mapurl)})();
@phibo23
phibo23 / spn19.cpp
Last active June 3, 2019 13:45
Schlangenprogrammiernacht GPN19
// You can use the entire C/C++ standard library, just add the relevant
// #includes. We recommend math.h ;-)
#include <algorithm>
#include <string>
#include "usercode.h"
/*
* This is your bot's startup function. Here you can set your snake's colors,
* set up persistent variables, etc.
*/
@phibo23
phibo23 / fb2ical.php
Last active October 5, 2015 12:47 — forked from cognitom/fb2ical.php
Export ical format for Facebook page's events by cognitom. Modifications: pageId as parameter, restriction to public events, improved timezone adjustment, ignore exceptions
<?php
/*
original code by cogitom: https://gist.github.com/997980/
This script reads future events (plus several days into the past) from Facebook pages
and creates a subscribable iCalendar
Improvements upon the original version:
- fixed start and endtime reading
- timezone adjustment done on facebook's side (more reliable)