Skip to content

Instantly share code, notes, and snippets.

@stevefaeembra
stevefaeembra / import-stats19.sql
Last active August 29, 2015 13:58
Import STATS19 vehicle/casualty data into SQLite
/** Copyright (C) 2014 Steven Kay
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@stevefaeembra
stevefaeembra / wolfram.py
Last active August 29, 2015 14:00
small python script to generate a wolfram cellular automaton
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Created on 29 Apr 2014
@author: Steven Kay
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@stevefaeembra
stevefaeembra / query.sql
Last active August 29, 2015 14:07
finding ley lines in postgres/postgis.sql
-- STEP 1 make all alignments at least 20km
-- get every pub-pub connection ((N^2)/2)-N, where N is number of pubs
-- use increasing order of OSM id to limit to a single line between each pair of pubs
-- as we don't care about the direction
-- we also drop connections from each pub to itself (hence the -N bit)
create table aligns as (
with
pubfrom as (select osm_id, amenity, name, way from planet_osm_point where amenity='pub'),
pubto as (select osm_id as osm_id2, amenity, name, way from planet_osm_point where amenity='pub')
@stevefaeembra
stevefaeembra / polar.py
Created August 4, 2015 22:24
Polar processing sketch (in Python)
import math
import random
def setup():
size(900,900)
background(0)
ellipseMode(CENTER)
noStroke()
fill(255,255,255,11)
SYMMETRY = 7
def setup():
size(720,720,P2D)
background(0)
def keyPressed():
global SYMMETRY
if key == 's':
saveFrame("/Users/steven/tmp/screen.png")