Skip to content

Instantly share code, notes, and snippets.

@luqmaan
luqmaan / es_setup.py
Created April 14, 2015 11:31
Setup Elasticsearch with the data from https://raw.githubusercontent.com/scascketta/CapMetrics. Checkout the data branch and run this.
#!/usr/bin/env python
import glob
import json
import sys
import arrow
import requests
import elasticsearch
import elasticsearch.helpers
@luqmaan
luqmaan / compare_ebay_wsdl.sh
Created February 3, 2015 00:17
Compare eBay 767 WSDL with latest WSDl
#!/usr/bin/env bash
curl https://web.archive.org/web/20120315095344/http://developer.ebay.com/webservices/latest/eBaySvc.wsdl > 767.wsdl
curl http://developer.ebay.com/webservices/latest/ebaySvc.wsdl > latest.wsdl
export LESS="-RCQaix4"
patterns=(Ack AdjustmentAmount ApiAccessRule Buyer BuyerCheckoutMessage BuyerUserID CategoryName CheckoutStatus CityName ConvertedStartPrice Country CountryName CreatedTime DailyHardLimit DailyUsage Email ErrorCode ErrorParameters Errors ExternalAddressID HardExpirationTime HasMoreOrders HourlyHardLimit HourlyUsage Item ItemArray ItemID ItemSpecifics ListingDetails ListingStatus ListingType LongMessage Name NameValueList Order OrderArray OrderID OrderLineItemID PaginationResult PaymentMethod Phone PostalCode PrimaryCategory Quantity QuantityPurchased QuantitySold RegistrationDate SKU SalesTax SalesTaxAmount SellingManagerSalesRecordNumber SellingStatus SessionID SeverityCode ShippedTime ShippingAddress ShippingDetails ShippingPackageDetails ShippingService ShippingServiceCo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luqmaan
luqmaan / all.md
Last active August 29, 2015 14:10
busta names
  1. Busta rides
  2. Busty
  3. Busty bottoms
  4. Bustulent
  5. Busted
  6. OneBustAway
  7. DowntownOrBust
  8. Bust line
  9. LocoPresto
  10. Wef
@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"
@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"
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_API_Wishlist.md
Last active February 13, 2018 04:22
CapMetro API Wishlist

Support CORS. Allow the API to be accessed through webapps without having to setup a proxy server in between.

Add documentation! Sneaking around the API and looking at the the trip planner code is not optimal.

Build an API the right way. Provide API keys so you can throttle requests and make sure things aren't getting slow.

More frequent polling of the bus locations. Right now it takes 30-90 seconds for bus locations to update. This sucks for users.

When will the 803 info be added to the GTFS database?

@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
@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,