This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
const GTFS_PATH = '/tmp/gtfs/'; | |
const TARGET_DIR = './splitGtfs/'; | |
@mkdir(GTFS_PATH); | |
@mkdir(TARGET_DIR); | |
$zip = new ZipArchive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types = 1); | |
$station_names = [ | |
'AAP' => 'Alexandra Palace', | |
'AAT' => 'Achanalt', | |
'ABA' => 'Aberdare', | |
'ABC' => 'Altnabreac', | |
'ABD' => 'Aberdeen', | |
'ABE' => 'Aber', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- use with miklcct/journey_recorder | |
select rank() over (order by `first visited`) as sequence, station, `first visited`, `last visited`, `number of visits` | |
from ( | |
select station | |
, convert_tz(min(`time stamp`), @@session.time_zone, 'Europe/London') as `first visited` | |
, convert_tz(max(`time stamp`), @@session.time_zone, 'Europe/London') as `last visited` | |
, count(0) as `number of visits` | |
from ( | |
select case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select rank() over (order by `first visited`) as sequence, full_station as station, `first visited`, `last visited`, `number of visits` | |
from ( | |
select case | |
when station = 'Adlington' then (select 'Adlington (Cheshire)' union select 'Adlington (Lancashire)') | |
when station = 'Bentley' then case route | |
when 'South Western Railway' then 'Bentley (Hampshire)' | |
when 'Northern' then 'Bentley (South Yorkshire)' | |
else (select 'Bentley (Hampshire)' union select 'Bentley (South Yorkshire)') | |
end | |
when station = 'Bramley' then case route |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
{ | |
contains() { | |
for item in $1 | |
do | |
if | |
[ "$item" = "$2" ] | |
then | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// code adopted from https://stackoverflow.com/a/53147219/272733 | |
#include <iostream> | |
#include <cmath> | |
const double degToRad = std::acos(-1) / 180; | |
struct vec3 | |
{ | |
double x, y, z; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.IO | |
import Text.Printf | |
round' :: (RealFrac a, Integral b) => a -> b | |
round' x = truncate (x + 0.5) | |
roundAmount :: (RealFrac a) => a -> a | |
roundAmount x = fromIntegral ((round' (x * 100)) :: Integer) / 100 | |
inputItem :: (Read a) => String -> IO a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This .htaccess will hide your index and .php in your URL, and serve the corresponding .php file | |
# Examples: | |
# /index.php -> / (index.php served if it is the DirectoryIndex) | |
# /abc.php -> /abc (abc.php served if abc does not exist) | |
# /path/to/app.php/path/info -> /path/to/app/path/info (/path/to/app.php served) | |
# | |
# Unsupported scenarios: | |
# file.php and file coexist (file.php can't be served) | |
# index.php not set as DirectoryIndex | |
# multiple index.* exist in a directory (don't know which to serve after it is rewritten out) |