Skip to content

Instantly share code, notes, and snippets.

@bmount
bmount / sfbuildratio.md
Created November 5, 2012 21:25
San Francisco building footprint ratio

Quick look at proportion of land within SF that is covered by a structure according to city building footprint data. This excludes interior courtyards, uncovered ground-level parking, ie everything without a roof.

Area measurements in square meters, excluding the bay and lakes (census tracts may include bodies of water, this compares only land area.)

Zoom in to see the census tract outline. Also, some of the numbered links are bad, if so try the 'unbroken link'.

@bmount
bmount / trb_feedback.md
Created November 22, 2012 13:27
TRB Feedback

The Assembly and Interpretation of Transit Data

A freeway, Tilton warned, "is a device which can make or break the city. It can liberate or contribute to congestion. It can cut the city into unrelated parts, or bind it together. It can destroy values, or create new ones. The State cannot soundly develop its urban freeway plans without attention to the planning problems of the city itself." Tilton criticized the state for a narrow approach that considered merely "the assembly and interpretation of traffic data...

<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
@bmount
bmount / keep_history.shell
Created December 9, 2015 00:12
Keep all of your shell history forever
HOSTNAME_SHORT="${HOSTNAME%%.*}"
his ()
{
grep -r "$@" ~/.history
history | grep "$@"
}
export HISTFILESIZE=10000
export HISTFILE="${HOME}/.history/$(date -u +%Y/%m/%d.%H.%M.%S)_${HOSTNAME_SHORT}_$$"
@bmount
bmount / read_srtm_hgt.js
Last active December 10, 2015 23:28
Reading SRTM hgt files in JavaScript
f = require('fs')
h = f.readFileSync('sfoak_srtm_vox.buf')
// read the (1/4 over, 1/4th down) point, 2nd arg would be 3601* 500 + 100 for 50th x in 250th row (2 bytes per record):
g = new DataView(h, Math.pow(2, 3601)/2, 1000)
> g.getInt16(0, true)
97
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html {
font-family: Helvetica;
}
path {
@bmount
bmount / hgt_png_snip
Last active December 11, 2015 07:59
piece of srtm San Francisco area in grayscale png
checked in raw

The now:

curl -o tweet.stream -u $TWUSER:$TWPASS -X POST https://stream.twitter.com/1.1/statuses/filter.json\?locations\=-123.0,37.0,-122.0,38.0

The future:

?? -? tweet.stream ?????:????? -? https://stream.twitter.com/1.1/statuses/filter.json... ?? ???????

@bmount
bmount / qgis_libs.sh
Created February 7, 2013 00:05
reminder about installing QGIS build from here: http://qgis.dakotacarto.com/ with a combination of libraries from source and homebrew. Leave a comment if you notice something barbaric (or just bad.)
sudo mkdir -p /Library/Frameworks/GDAL.framework/Versions/1.9/
sudo ln -s /usr/local/lib/libgdal.dylib /Library/Frameworks/GDAL.framework/Versions/1.9/GDAL
sudo mkdir -p /Library/Frameworks/PROJ.framework/Versions/4/
sudo ln -s /usr/local/Cellar/proj/4.8.0/lib/libproj.dylib /Library/Frameworks/PROJ.framework/Versions/4/PROJ
# did not work: sudo ln -s `pwd`/libgeos.dylib /Library/Frameworks/GEOS.framework/Versions/3/GEOS
# did work:
# $PWD is /usr/local/Cellar/geos/3.3.6/lib
sudo ln -s `pwd`/libgeos_c.1.dylib /Library/Frameworks/GEOS.framework/Versions/3/GEOS
sudo mkdir -p /Library/Frameworks/SQLite3.framework/Versions/3/
sudo ln -s /usr/local/Cellar/sqlite/3.7.15/lib/libsqlite3.0.8.6.dylib /Library/Frameworks/SQLite3.framework/Versions/3/SQLite3
@bmount
bmount / naip_break-up.py
Created February 9, 2013 01:05
reminder about breaking up huge National Agricultural Imagery Program (NAIP) tif files
# coding: utf-8
import os
# naip SF collection in geotiff from gdalinfo via mrsiddecode:
xmax = 72260
ymax = 21650
x = xmax
y = 21650
tmp = """gdal_translate -of PNG -srcwin {0} {1} 2000 2000 sf2012.tif bigslice/sf_partial-{2}.png"""
while x > 0: