Skip to content

Instantly share code, notes, and snippets.

Drinking tea

Matt Walker walkermatt

Drinking tea
View GitHub Profile
walkermatt / gist:1383021
Created Nov 21, 2011 — forked from eriwen/gist:187610
Pythonic site monitor
View gist:1383021
#!/usr/bin/env python
# sample usage:
import pickle, os, sys, logging
from httplib import HTTPConnection, socket
from smtplib import SMTP
def email_alert(message, status):
fromaddr = ''
walkermatt / disaggregate_postgis_complex_contents.sql
Created Nov 25, 2011
Disaggregate MultiLineStrings using ST_Dump PostGIS
View disaggregate_postgis_complex_contents.sql
SELECT *, ST_GeometryType(geom) as geom_type, ST_AsEWKT(geom) as geom_wkt from complex;
walkermatt / loader.config
Created Jun 4, 2012
Loader config for AddressBase Plus on Windows into PostgreSQL
View loader.config
ogr_cmd=ogr2ogr -append -skipfailures -f PostgreSQL PG:'dbname=test active_schema=public host=localhost port=5432 user=postgres password=******' $file_path
prep_cmd=python $file_path prep_osgml.prep_addressbase
walkermatt /
Created Jun 4, 2012
A debounce function decorator in Python similar to the one in underscore.js, tested with 2.7
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def call_it():
walkermatt / osgb_map.js
Created Jul 2, 2012
Leaflet Map using Proj4Leaflet to display a projected TMS base map from MapProxy
View osgb_map.js
// Bounding box of our TMS that define our area of interest
var bbox = [-600000, -300000, 1300000, 1600000];
// Resolutions of our TMS that the tiles will be displayed at calculated so
// that at resolution 0 the bounds fit one 256x256 tile: (maxx - minx)/256
var res = [7421.875, 3710.9375, 1855.46875, 927.734375];
// Define the Proj4Leaflet coordinate reference system base on British National Grid
var crs = L.CRS.proj4js(
walkermatt / script.js
Created Jul 5, 2012 — forked from nextstopsun/script.js
Proj4Leaflet 102012 projection test
View script.js
var res = [
walkermatt /
Created Jul 29, 2012
Simple Loader prep class to import KML neighbourhood boundaries
A class used to manipulate Police KML data, used with
import os
from lxml import etree
class prep_kml():
def __init__(self, inputfile):
# Example of downloading all data from a GeoServer WFS server
# and loading it into a PostGIS database. Use with caution
# as you could put a lot of load on someone's server if they
# host a lot of data which might make them sad.
# In response to:
for LAYERNAME in `wget -qO- $BASEURL"&request=GetCapabilities" | xpath -q -e "//FeatureType/Name/text()"` ; do
walkermatt / run_loader.bat
Last active Dec 10, 2015
DOS batch file to run Loader ( on Windows using GDAL and python provided by OSGeo4W (installation of which is documented on the wiki)
View run_loader.bat
rem DOS batch file to run Loader on Windows using GDAL and python
rem provided by OSGeo4W. As this script requires the OSGeo4W environment
rem to run it must be passed as an argument to OSGeo4W.bat like so:
rem call C:\OSGeo4W\OSGeo4W.bat C:\Temp\Loader\run_loader.bat
rem Change to the folder that this script is in (assumes this script is
rem in the same folder as the Loader readme)
cd /D %~dp0
rem change to the python directory
walkermatt / Gazetteer.vrt
Created Feb 6, 2013
Example AstunTechnology / OpenDataLoader ( config for OS 50k Gazetteer. OSOpenLoader.config and Table.csv should live in the root of the OpenDataLoader directory. Gazetteer.vrt should go in the source Gazetteer directory.
View Gazetteer.vrt
<OGRVRTLayer name="50kgaz2012_new">
<GeometryField encoding="PointFromColumns" x="EAST" y="NORTH"/>
You can’t perform that action at this time.