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
#!/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
''' 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
.../~: 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
% curl -sIL 'https://data.acgov.org/api/geospatial/8e4s-7f4v?method=export&format=Original' | |
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 |
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
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: |
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
var Map = (function () { | |
function Map(parent, template, proj, loc, zoom) { | |
this.selection = d3.select(parent); | |
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; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Untitled</title> | |
<script src="https://code.jquery.com/jquery-1.11.2.min.js" charset="utf-8"></script> | |
<script src="modestmaps.min.js" charset="utf-8"></script> | |
<script src="turf.min.js" charset="utf-8"></script> | |
</head> | |
<body> |
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 __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 |
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
> 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' |
OlderNewer