This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.../~: 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 https://github.com/openvenues/address_normalizer | |
You are using pip version 6.0.3, however version 6.0.6 is available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
''' Guess at ISO-3166-2 admin 1 codes for Natural Earth data. | |
Uses subdivision names from Ola Holmström’s iso-3166-2: | |
https://github.com/olahol/iso-3166-2.js/blob/master/data.csv | |
ne_10m_admin_1_states_provinces.csv is a direct CSV | |
export of Natural Earth admin-1 data as of Nov 8, 2012: | |
https://github.com/nvkelso/natural-earth-vector/tree/c97860331/10m_cultural |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from json import dumps | |
from time import time | |
try: | |
lib_state = open('/var/run/library-state.txt').read().strip() | |
if lib_state != 'OK': | |
app_state = 'Library: ' + lib_state | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
from requests import get | |
from csv import writer | |
from urlparse import urljoin, urlsplit, urlunsplit | |
from re import compile | |
ignore = compile(r'/blog/') | |
base_url = 'http://localhost/~migurski/Codeforamerica.org' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 32, | |
"lat": 61.2180556, | |
"lon": -149.9002778, | |
"meetup_url": "", | |
"name": "Alaska Brigade" | |
}, | |
{ | |
"id": 75, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary Level Geographic Component State FIPS Place FIPS County FIPS Tract Zip Block Name Latitude Longitude | |
050 00 01 001 Autauga County 32.523283 -86.577176 | |
050 00 01 003 Baldwin County 30.592781 -87.748260 | |
050 00 01 005 Barbour County 31.856515 -85.331312 | |
050 00 01 007 Bibb County 33.040054 -87.123243 | |
050 00 01 009 Blount County 33.978461 -86.554768 | |
050 00 01 011 Bullock County 32.098285 -85.704915 | |
050 00 01 013 Butler County 31.735884 -86.662232 | |
050 00 01 015 Calhoun County 33.741989 -85.817544 | |
050 00 01 017 Chambers County 32.891233 -85.288745 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS tiger_2012_edges_102008; | |
DROP TABLE IF EXISTS tiger_2012_ends_102008; | |
CREATE TABLE tiger_2012_edges_102008 | |
AS | |
( | |
SELECT statefp, countyfp, mtfcc, fullname, | |
fromadd, toadd, zip, "offset", | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file describes the network interfaces available on your system | |
# and how to activate them. For more information, see interfaces(5). | |
# The loopback network interface | |
auto lo | |
iface lo inet loopback | |
auto eth0 | |
iface eth0 inet dhcp | |
dns-nameservers 8.8.8.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
>>> arc = Projection() | |
Geographic to Albers: | |
>>> p = arc.locationProj(Location(23, -96)); '%.2f %.2f' % (abs(p.x), abs(p.y)) | |
'0.00 0.00' |