Skip to content

Instantly share code, notes, and snippets.

@fitnr
fitnr / systems.json
Created December 2, 2015 14:48
rapid transit systems included in http://fakeisthenewreal.org/subway
[
{
"city": "Amsterdam",
"urls": [
{
"link": "GVB",
"url": "http://www.gvb.nl/"
}
]
},
@fitnr
fitnr / index.html
Last active November 21, 2015 19:27
leaflet fullscreen and mapbox geocoder don't play nicely together
<!DOCTYPE html>
<html>
<head>
<title>geocontrol and fullscreen example</title>
<style>
#map {
width: 960px;
height: 500px;
}
</style>
@fitnr
fitnr / buildingclasscode.csv
Last active January 8, 2021 14:47
NYC Pluto building class codes and land uses. From: http://www.nyc.gov/html/dcp/pdf/bytes/pluto_datadictionary.pdf
id name
A0 ONE FAMILY DWELLINGS: Cape Cod
A1 ONE FAMILY DWELLINGS: Two Stories Detached (Small or Moderate Size, With or Without Attic)
A2 ONE FAMILY DWELLINGS: One Story (Permanent Living Quarters)
A3 ONE FAMILY DWELLINGS: Large Suburban Residence
A4 ONE FAMILY DWELLINGS: City Residence
A5 ONE FAMILY DWELLINGS: Attached or Semi-Detached
A6 ONE FAMILY DWELLINGS: Summer Cottages/Mobile Homes/Trailers
A7 ONE FAMILY DWELLINGS: Mansion Type
A8 ONE FAMILY DWELLINGS: Bungalow Colony/Land Coop Owned
@fitnr
fitnr / zip-prefix-adjacency
Created October 28, 2015 20:32
This lists the first two zip code numbers for each state and its bordering states. e.g., the NY list includes "10", found in Manhattan as well as "07", found in NJ.
WA = 99 83 97 98
DE = 15 21 17 16 19 18 08 20 07
DC = 24 20 21 22 23
WI = 48 49 55 54 56 51 50 53 52 60 61 62
WV = 24 25 23 15 21 17 16 19 18 44 45 22 43 40 41 26 20 42
HI = 96
FL = 39 33 32 31 30 36 35 34
WY = 59 57 82 83 68 69 80 81 84
NH = 02 03 01 04 05
NJ = 11 10 13 12 15 14 17 16 19 18 08 07
@fitnr
fitnr / polyencode.py
Created October 20, 2015 18:55
Quick cli tool for encoding coordinates with Google's encoded polyline algorithm. Requires polyencode (pip install polyencode).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import gpolyencode
"""
polyencode.py
Encode list of x,y coordinates with Google's encoded polyline algorithm
see: https://developers.google.com/maps/documentation/utilities/polylinealgorithm
@fitnr
fitnr / Makefile
Created August 21, 2015 03:49
Quick makefile for loading the current Pluto dataset into MySQL.
URL = http://www.nyc.gov/html/dcp/download/bytes/
FILE = nyc_pluto_15v1.zip
VERSION = 15v1
boroughs = Mn BK BX QN SI
MYSQL = mysql --user="$(USER)" -p$(PASS) $(MYSQLFLAGS)
DATABASE = pluto
@fitnr
fitnr / 1-quads-15min-no-flickr.geojson
Last active August 29, 2015 14:25
The set of USGS 15 minute quads with no geotagged Flickr pictures as of 7/2015.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fitnr
fitnr / fips2states.sh
Last active July 31, 2022 01:01
Replace US states with their FIPS code or postal code or vis/versa
#!/bin/bash
# Replace FIPS codes with US states/^territory names
# usage: sh fips2state2.sh inputfile.txt > outputfile.txt
# or just copy everything but the '$1' and run on the command line
sed -e 's/^54/West Virginia/' -e 's/^02/Alaska/' -e 's/^01/Alabama/' -e 's/^05/Arkansas/' -e 's/^60/American Samoa/' \
-e 's/^04/Arizona/' -e 's/^06/California/' -e 's/^08/Colorado/' -e 's/^09/Connecticut/' -e 's/^11/District of Columbia/' \
-e 's/^10/Delaware/' -e 's/^12/Florida/' -e 's/^13/Georgia/' -e 's/^66/Guam/' -e 's/^15/Hawaii/' \
-e 's/^19/Iowa/' -e 's/^16/Idaho/' -e 's/^17/Illinois/' -e 's/^18/Indiana/' -e 's/^20/Kansas/' \
-e 's/^21/Kentucky/' -e 's/^22/Louisiana/' -e 's/^25/Massachusetts/' -e 's/^24/Maryland/' -e 's/^23/Maine/' \
-e 's/^26/Michigan/' -e 's/^27/Minnesota/' -e 's/^29/Missouri/' -e 's/^28/Mississippi/' -e 's/^30/Montana/' \

Keybase proof

I hereby claim:

  • I am fitnr on github.
  • I am fitnr (https://keybase.io/fitnr) on keybase.
  • I have a public key whose fingerprint is 74E5 F1EE 04D6 968C DA8A 3E81 3ABA FB3A 1D61 8BDC

To claim this, I am signing this object:

@fitnr
fitnr / table2csv.js
Created January 30, 2015 17:47
convert table to csv (uses JQuery)
// encoded:
// javascript:(function()%7B$('table').each(function()%7Bvar%20$table=$(this);$('%3Ctextarea%3E').css('width',$table.width()).css('height','400px').html($.map($table.find('tr'),function(tr)%7Breturn%20$.map($(tr).find('th,%20td'),function(e)%7Breturn'%22'+$(e).text().replace('%22','%22%22').replace('%5Cn','%20')+'%22'%7D).join(',')%7D).join('&%2313;&%2310;')).insertAfter($table);%7D)%7D)()
javascript:(function() {
$('table').each(function() {
var $table = $(this);
$('<textarea>').css('width', $table.width())
.css('height', '400px')
.html(
$.map(
$table.find('tr'), function(tr) {