Skip to content

Instantly share code, notes, and snippets.

View tuttinator's full-sized avatar

Caleb Tutty tuttinator

  • Jakarta, Indonesia
  • 05:40 (UTC +07:00)
View GitHub Profile
@tuttinator
tuttinator / README.md
Created December 7, 2016 20:42
Retrolens parser

Historic aerial survey data

Experiments with Retrolens.nz data.

First download the shapefile from http://files.interpret.co.nz/Retrolens/Footprints/Retrolens_shp.zip

Warning

You probably don't really want to download everything. One option is to edit the shapefile to select only the features you are interested in (i.e. the town of Wairoa).

@tuttinator
tuttinator / 2007.md
Created December 5, 2016 00:32
John Key state of the nations

Thank you for your welcome.

What a pleasure it is to be speaking to you in what I still think of as my home town. I had a good Kiwi upbringing here in Christchurch. I grew up in Hollyford Ave, just down the road from here. I attended the local schools. I played in the local streets and parks.

I was mad on sport, particularly squash, which I played next door for the Burnside Squash Club. I also played rugby for this very club, as a hooker and a halfback. I was no Justin Marshall. In fact, I think it's safe to say that no matter how big Graham Henry's rotation gets, I won't be going to the World Cup.

Six years ago I made one of the most important decisions in my life: to leave a successful career in finance to stand for Parliament. It was a decision that brought with it changes, not only for me but also for my wife, Bronagh, and our young family. I thank them today for their continuing love and support.

For me, politics is not about the pursuit of power for the sake of it. Unlike some, I won't measure the s

@tuttinator
tuttinator / auckland_gp_locations.csv
Created July 31, 2016 04:53
Locations of Auckland GP Clinics (scraped from healthpoint.co.nz)
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
name,url,address,lat,lng
109 Doctors,/doctors/gp/109-doctors/,"109 Queen Street, Auckland Central, Auckland",-36.8462319,174.7659345
168 ○ Medical Centre,/doctors/gp/168-medical-centre/,"170 Sandringham Road, Sandringham, Auckland",-36.8779918,174.7410221
Airport Doctors,/doctors/gp/airport-doctors/,Airport Doctors,-36.9962043,174.7881753
Albany Basin Accident and Medical,/doctors/gp/albany-basin-accident-and-medical/,Albany Basin Accident and Medical,-36.75440023,174.7100294
Albany Family Medical Centre,/doctors/gp/albany-family-medical-centre/,"368 Albany Highway, Albany, Auckland",-36.743011,174.692466
Alberton Medical Practice,/doctors/gp/alberton-medical-practice/,"230 Mount Albert Road, Sandringham, Auckland",-36.895866,174.7318769
All Care Family Medical Centre - Northcote,/doctors/gp/all-care-family-medical-centre-northcote/,"52 Pearn Crescent, Northcote, Auckland",-36.8007331,174.7462048
All Care Family Medical Centre - Northcote,/doctors/gp/all-care-family-medical-centre-northcote/,"52 Pearn Crescen
@tuttinator
tuttinator / packages.R
Created June 28, 2016 23:25
Install packages on demand
required_packages <- c(
"dplyr",
"readr",
"ggplot2",
"ggthemes",
"futile.logger",
"lubridate"
)
packages_to_install <- required_packages[!(required_packages %in% installed.packages()[, 1])]
@tuttinator
tuttinator / Gemfile
Created May 3, 2016 02:24
Auckland Council committee minutes scraper
source 'https://rubygems.org'
gem 'capybara'
gem 'capybara-webkit'
gem 'documentcloud', github: 'nzherald/documentcloud', branch: 'develop'
gem 'dotenv'
gem 'pry'
@tuttinator
tuttinator / polygon_from_bbox.rb
Created April 18, 2016 10:55
Turn a bbox string into an EWKT polygon
def polygon_from_bbox(str)
south_west_lat, south_west_lng, north_east_lat, north_east_lng = str.split(',')
"SRID=4326;POLYGON((" +
south_west_lat + " " + south_west_lng + "," +
north_east_lat + " " + south_west_lng + "," +
north_east_lat + " " + north_east_lng + "," +
south_west_lat + " " + north_east_lng + "," +
south_west_lat + " " + south_west_lng + "))"
end
@tuttinator
tuttinator / drug_sentences.csv
Created August 3, 2015 05:56
Convictions stacked area graph
end_date Community Detention Community work, Corrections Conviction and discharge Disqualification from driving Fine Home Detention Imprisonment Intensive Supervision Life imprisonment Other Reparation/Restitution Supervision by Community Corrections
2003-06-30 1410 131 1990 870 1 108 2 65
2004-06-30 1224 132 2 1668 862 95 2 65
2005-06-30 2 1128 159 2 1620 1 755 115 2 66
2006-06-30 4 1167 166 1544 2 750 140 2 70
2007-06-30 56 1205 157 1434 156 583 38 154 4 88
2008-06-30 142 1395 180 1516 314 560 67 3 156 8 139
2009-06-30 278 1617 165 1413 429 669 69 160 4 168
2010-06-30 285 1346 154 1 1084 442 667 67 172 3 197
2011-06-30 276 1210 138 928 390 561 66 133 3 175
@tuttinator
tuttinator / convictions.R
Created August 3, 2015 05:04
Process NZ MOJ convictions
install.packages('dplyr')
install.packages('ggplot2')
install.packages('readr')
install.packages('ggthemes')
install.packages('stringr')
install.packages('lubridate')
install.packages('reshape2')
install.packages('grid')
library(grid)
@tuttinator
tuttinator / [email protected]
Created April 26, 2015 10:55
Alaveteli SystemD unit files
[Unit]
Description=Alaveteli Sidekiq (%i)
After=docker.service
Requires=docker.service
[Service]
Restart=on-failure
RestartSec=10s
@tuttinator
tuttinator / gist:9ad0ccccc7ed9e7de377
Last active August 29, 2015 14:11
CSV dumping ground?
How's this for an idea - we build a crowd sourced community sandbox to upload
a CSV using a web form. Using a NoSQL database like MongoDB we could read the
header row of the CSV to create a collection with those fields. This means we
can get a basic JSON API for free (maybe paginated, etc) and with format
specifiers be able to download the original CSV again too. This would be
a set of URLs with a unique ID.
Maybe someone has already done something similar?