Skip to content

Instantly share code, notes, and snippets.

View seamusabshere's full-sized avatar

Seamus Abshere seamusabshere

View GitHub Profile
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
-- SELECT Faraday_JoyDivision('households'::text, 'year_built'::text) AS the_geom
explain analyze WITH
-- Snap the disparate points to a regular grid where theres data for the given filter
grid AS (
SELECT
-- note transform here
ST_SnapToGrid(ST_Transform(the_geom, 4326), 0.002) the_geom,
year_built
@seamusabshere
seamusabshere / gist:4154610
Created November 27, 2012 14:49 — forked from jatorre/gist:4154502
Combine multiple Census files into single shpefile using PostGIS
mkdir tmpfolder;
cd tmpfolder;
wget "http://www2.census.gov/geo/tiger/TIGER2012/TRACT/tl_2012_01_tract.zip";
unzip tl_2012_01_tract.zip;
shp2pgsql -s4326 -p tl_2012_01_tract.shp census | psql -hlocalhost -Upostgres -dcensus;
rm -rf tl_2012_01_tract.*;
for i in {1..9} :;
do
wget "http://www2.census.gov/geo/tiger/TIGER2012/TRACT/tl_2012_0${i}_tract.zip";
unzip tl_2012_0${i}_tract.zip
@seamusabshere
seamusabshere / gist:3211989
Created July 30, 2012 23:42 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@seamusabshere
seamusabshere / .gitignore
Created March 2, 2012 19:36 — forked from holman/gemspec-usage.md
brighter planet api gem (aka "carbon") - flattened
Gemfile.lock
.DS_Store
.rvmrc
.yardoc/
doc/
*.gem
require 'test_helper'
class Shop < ActiveRecord::Base
end
class ItemDetail < ActiveRecord::Base
set_primary_key :row_hash
data_miner do
import 'A csv file with no identifier', :url => 'http://imports.s3.amazonaws.com/products_no_id.csv', :errata => 'http://spreadsheets.google.com/pub?key=tF58sAgqkY214EFBMdYCIUw', :delimiter => ';' do