Skip to content

Instantly share code, notes, and snippets.

View stationCodes.csv
Timetable Code Timetable Name Trackernet Code Trackernet Name ATCO Code NaPTAN Name
ACT Acton Town ACT Acton Town 9400ZZLUACT Acton Town Underground Station
ACW Acton Works
AGR Arnos Grove (& Sidings) AGR Arnos Grove 9400ZZLUASG Arnos Grove Underground Station
ALC Aldgate (to/from Tower Hill) ALD Aldgate 9400ZZLUALD Aldgate Underground Station
ALD Aldgate (to/from Liverpool Street) ALD Aldgate 9400ZZLUALD Aldgate Underground Station
ALE Aldgate East ALE Aldgate East 9400ZZLUADE Aldgate East Underground Station
ALP Alperton ALP Alperton 9400ZZLUALP Alperton Underground Station
AME Amersham AME Amersham 9400ZZLUAMS Amersham Underground Station
ANG Angel ANG Angel 9400ZZLUAGL Angel Underground Station
kurtraschke /
Created September 1, 2010 03:04
Regular expression and script for parsing and sorting Library of Congress Classification call numbers
import re
myfile = open('list', 'r')
callnos = myfile.readlines()
p = re.compile("""^(?P<aclass>[A-Z]{1,3})
(?P<nclass>\\d{1,4})(\\ ?)
(?P<date>\\ [A-Za-z0-9]{1,4}\\ )?
View gist:25991ecd55a6fe04b1622f8edd7f63a0
function visibleTilesLoaded(viewer) {
var layer = viewer.scene().layer();
var geometry = layer.geometry();
var visibleTilesForLevel = function(level) {
return geometry.visibleTiles(viewer.view(), level);
var tileHasTexture = function(tile) {
var tile = layer.textureStore().query(tile);
kurtraschke / sleep.ps1
Last active March 2, 2016 02:48
PowerShell script to summarize a Windows PC's sleep history
View sleep.ps1
$filter = @{LogName='System';
$namespaces = @{"event"=""}
Get-WinEvent -FilterHashtable $filter | % {
$obj = New-Object PSObject
[xml]$_.ToXml() | Select-Xml -Namespace $namespaces "/event:Event/event:EventData/event:Data" | % {
kurtraschke / cap.xjb
Created November 11, 2013 01:47
JAXB bindings file for CAP schema to produce enums from anonymous types.
View cap.xjb
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:jaxb=""
<jaxb:bindings schemaLocation="CAP-v1.2.xsd" node="/xsd:schema">
<jaxb:bindings node="//xsd:element[@name='status']">
<jaxb:bindings node="./xsd:simpleType">
<jaxb:typesafeEnumClass name="StatusType" />
View gist:6249229
Recently (as in, over the past few months) the WMATA BusPosition feed has been behaving anomalously.
There are three observed problems:
1. The feed doesn't include the entire fleet - during the weekday rush hour we'd expect to see close to 900 buses, but this morning the feed returned fewer than 250 vehicles.
2. Bus positions return the wrong trip, or are lagging badly. Look at this example:

This Gist contains a script and supporting files for building a OneBusAway GTFS bundle with data for all agencies in the Baltimore/Washington area that have publicly released their data.

Configuration parameters come from two sheets in a Google Docs document:

The dependency on Google Docs could easily be removed by removing that part of and using a locally-maintained CSV file instead.

kurtraschke /
Created December 17, 2012 23:18
Find bounding box and convex hull of agency coverage (as WKT) for a OneBusAway TDS.
from mustaine.client import HessianProxy
from shapely.geometry import box
from shapely.ops import cascaded_union
service = HessianProxy("")
agencies = service.getAgenciesWithCoverage()
boxes = []
View gist:2016817
"Routes": [
"Name": "10:00:00 AM - 10A HUNT TOWERS-PENT ",
"RouteID": "10A"
"Name": "10:00:00 AM - 10A HUNT TOWERS-PENT ",
"RouteID": "10Av1"
kurtraschke / gist:1390328
Created November 24, 2011 00:18
WMATA bus API says there are no buses...
View gist:1390328
Kurt-Raschke:~ kurt$ curl