Skip to content

Instantly share code, notes, and snippets.

Michal Migurski migurski

Block or report user

Report or block migurski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
migurski /
Created Jan 30, 2014
Scripts used in the creation of the new Code for America website.
migurski /
Last active Aug 29, 2015
Engine Light status endpoint script for
#!/usr/bin/env python
from json import dumps
from time import time
lib_state = open('/var/run/library-state.txt').read().strip()
if lib_state != 'OK':
app_state = 'Library: ' + lib_state
migurski /
Last active Aug 29, 2015
Python wrapper for openaddresses-conform
''' Python wrapper for openaddresses-conform.
Looks in /var/opt/openaddresses-conform for an index.js to run. Generates
all data in a temporary working directory, and does not use cached files.
from subprocess import Popen
from tempfile import mkdtemp
from os.path import realpath, join
from shutil import move, rmtree
View 1-preinstall.txt
.../~: Sleeper% cd /tmp
...//tmp: Sleeper% mkdir vn
...//tmp: Sleeper% rmdir vn
...//tmp: Sleeper% mkdir van
...//tmp: Sleeper% virtualenv van
New python executable in van/bin/python
Installing setuptools, pip...done.
...//tmp: Sleeper% source van/bin/activate.csh
[van] ...//tmp: Sleeper% pip install
You are using pip version 6.0.3, however version 6.0.6 is available.
% curl -sIL ''
HTTP/1.1 405 Method Not Allowed
Server: nginx
Date: Tue, 13 Jan 2015 01:52:36 GMT
Connection: keep-alive
Access-Control-Allow-Origin: *
X-Error-Code: method_not_allowed
X-Error-Message: HEAD not allowed
X-Socrata-Region: production
migurski /
Created Jan 28, 2015
guess reason for OpenAddresses failure
def guess_reason(log):
if 'JobTimeoutException' in log:
return 'took too long'
elif 'DownloadError: 404 response' in log:
return 'missing source'
elif 'Source says to skip' in log:
return 'skipped'
elif 'Invalid number of points in LinearRing' in log:
migurski / squares-map.js
Created Mar 3, 2015
Compiled TypeScript sample
View squares-map.js
var Map = (function () {
function Map(parent, template, proj, loc, zoom) {
this.selection =;
this.loaded_tiles = {
this.template = template;
this.parent = parent;
var size = Mouse.element_size(this.parent), coord = proj.locationCoordinate(loc).zoomTo(zoom);
this.grid = new Grid.Grid(size.x, size.y, coord, 3);
this.projection = proj;
migurski / index.html
Last active Aug 29, 2015
Grabbing census tracts around Oakland, messing with Turf
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<script src="" charset="utf-8"></script>
<script src="modestmaps.min.js" charset="utf-8"></script>
<script src="turf.min.js" charset="utf-8"></script>
migurski /
Created Jul 23, 2015
Converting from OpenAddresses stats table to runs and sets table
from __future__ import print_function
from os import environ
from psycopg2 import connect
from psycopg2.extras import DictCursor, Json
from itertools import count, groupby
from datetime import timedelta, datetime
from operator import itemgetter
from uritemplate import expand
from dateutil.parser import parse
View gist:1854149
> make PKG_CONFIG_PATH=/home/migurski/src/simple-tiles/out/lib/pkgconfig test
cd src && make all
make[1]: Entering directory `/home/migurski/src/simple-tiles/src'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/migurski/src/simple-tiles/src'
cd test && make test
make[1]: Entering directory `/home/migurski/src/simple-tiles/test'
cd ../data && make && cd ../test
make[2]: Entering directory `/home/migurski/src/simple-tiles/data'
You can’t perform that action at this time.