Skip to content

Instantly share code, notes, and snippets.

POST http://www.capmetro.org/planner/s_nextbus2.asp with querystring
```
stopid:5868
route:801
dir:N
output:json
opt:2
min:1
```

Keybase proof

I hereby claim:

  • I am luqmaan on github.
  • I am luqmaan (https://keybase.io/luqmaan) on keybase.
  • I have a public key whose fingerprint is DBF8 58BC 56FB CC2F 59D1 91A6 17DF AA03 72AC 4382

To claim this, I am signing this object:

@luqmaan
luqmaan / sass_to_scss.py
Last active August 29, 2015 13:59
Convert Sass to SCSS
import argparse
from pprint import pprint
import re
def count_leading_spaces(line):
return len(line) - len(line.lstrip(' '))
def sass_to_scss(sass_lines):
function add(a, b) {
console.log(a + b);
}
function diff(a, b) {
console.log(a - b);
}
function l(x, y) {
x();
y();
<!-- https://rawgit.com/luqmaan/8e74871571ea56c6dfb7/raw/a1c23d40fcbed88cd095c7fba61177c989c5d00f/reddit_down.html -->
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<head>
<title>reddit is down</title>
<style>
@font-face {
font-family: 'SilkscreenNormal';
src: url('http://www.reddit.com/static/down/slkscr-webfont.eot');
@luqmaan
luqmaan / active_trips_for_route.csv
Last active August 29, 2015 14:02
Find the active trips for a route using CapMetro's Austin GTFS data. Unfortunately the GTFS doesn't seem to have hour precision, so many shapes are returned for a route that changes shapes throughout the day, e.g. the MetroRail.
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 31 columns, instead of 21. in line 4.
shape_id,shapes_count,trip_id,route_id,trip_headsign,shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence,shape_dist_traveled,route_id,service_id,trip_id,trip_headsign,trip_short_name,direction_id,block_id,shape_id,trip_type,bikes_allowed,wheelchair_accessible,service_id:1,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
31794,1223,1303263,550,SOUTHBOUND,31794,30.264702,-97.737972,1223,<null>,550,1133,1303263,SOUTHBOUND,<null>,0,550-30,31794,<null>,0,1,1133,1,1,1,1,0,0,0,2014-01-26,2014-06-07
31795,1223,1303278,550,SOUTHBOUND,31795,30.264702,-97.737972,1223,<null>,550,1133,1303278,SOUTHBOUND,<null>,0,550-03,31795,<null>,0,1,1133,1,1,1,1,0,0,0,2014-01-26,2014-06-07
31807,1223,1303388,550,NORTHBOUND,31807,30.586524,-97.85580299999999,1223,<null>,550,1133,1303388,NORTHBOUND,<null>,1,550-03,31807,<null>,0,1,1133,1,1,1,1,0,0,0,2014-01-26,2014-06-07
31808,1223,1303389,550,NORTHBOUND,31808,30.586524,-97.85580299999999,1223,<null>,550,1133,1303389,NORTHBOUND,<null>,1,550-70,31808,<null>,0,
@luqmaan
luqmaan / shitty_nearby_routes.sql
Created June 23, 2014 20:51
Get the routes nearby whole foods, note the location comparison part is total garbage
SELECT * FROM trips,
(
SELECT * FROM stop_times,
(
SELECT * FROM stops
WHERE stop_lat > 30.260650 AND stop_lat < 30.280650
AND stop_lon < -97.743562 AND stop_lon > -97.763562
) as nearby_stops
WHERE stop_times.stop_id = nearby_stops.stop_id
GROUP BY trip_id
var nextInterval = 5000;
setInterval(function() {
var _ = '=',
s = '~',
_i = Math.random() * 30 + 10,
_s = Math.random() * 30;
while (_.length < _i) _ += _;
while (s.length < _s) s += s;
@luqmaan
luqmaan / capmetro-alert.md
Last active August 29, 2015 14:08
CapMetro Alert feed and Trimet Alert feed

CapMetro Alert

cat capmetro-alert.pb | protoc --decode=transit_realtime.Alert gtfs-realtime.proto
active_period {
  1: "1.0"
@luqmaan
luqmaan / capmetro-vehicleposition.md
Last active August 29, 2015 14:08
CapMetro vehicle position and Trimet vehicle position

CapMetro Vehicle Position

cat capmetro-VehLoc.pb | protoc --decode=transit_realtime.VehiclePosition gtfs-realtime.proto | pbcopy
warning:  Input message is missing required fields:  position.latitude, position.longitude
trip {
  trip_id: "1.0"