Skip to content

Instantly share code, notes, and snippets.

View aaronlidman's full-sized avatar

Aaron Lidman aaronlidman

View GitHub Profile
@aaronlidman
aaronlidman / gist:3717548
Created September 13, 2012 20:49
get a list of links
# remove the -v on the last grep to change from blacklist to whitelist
wget --spider --force-html -r -l2 http://example.com 2>&1 | grep '^--' | awk '{ print $3 }' | grep -v '\.\(css\|js\|png\|gif\|jpg\)$' > wget.out
#!/bin/bash
mkdir merged;
for f in *.shp;
do
if [ -f merged/merged.shp ]
then
ogr2ogr -f "ESRI Shapefile" -update -append -skipfailures merged/merged.shp "$f" -nln Merged
else
ogr2ogr -f "ESRI Shapefile" merged/merged.shp "$f"
fi;
@aaronlidman
aaronlidman / results
Created September 18, 2012 20:45
create a list of tiger2012 landmark zips for wget
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_01_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_02_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_04_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_05_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_06_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_08_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_09_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_10_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_11_arealm.zip
http://www2.census.gov/geo/tiger/TIGER2012/AREALM/tl_2012_12_arealm.zip
@aaronlidman
aaronlidman / index.html
Created November 16, 2012 04:55
default osm style playground
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.4/leaflet.js"></script>
<style type="text/css">
@aaronlidman
aaronlidman / gist:4173747
Created November 30, 2012 04:21
rawr output
<osmChange version="0.6">
<create>
<node id="-1" lat="43.5885936986" lon="-93.8280111551" timestamp="2012-11-29T23:31:27Z" />
<node id="-2" lat="43.5879681303" lon="-93.8280540705" timestamp="2012-11-29T23:31:27Z" />
<node id="-3" lat="43.587618431" lon="-93.831063509" timestamp="2012-11-29T23:31:27Z" />
<node id="-4" lat="43.5883527973" lon="-93.8312137127" timestamp="2012-11-29T23:31:27Z" />
<way id="-5" timestamp="2012-11-29T23:31:27Z">
<nd ref="-1" />
<nd ref="-2" />
<nd ref="-3" />
@aaronlidman
aaronlidman / index.html
Created December 19, 2012 02:05
Possibly useful AREALM features.
<table>
<tr>
<th>MTFCC</th>
<th>description</th>
<th>count</th>
<th>total area (sq mi)</th>
</tr>
<tr>
<td>C3023</td>
<td>Island</td>
@aaronlidman
aaronlidman / index.html
Last active December 10, 2015 01:28 — forked from reneras/spin.js
<html>
<body>
<canvas id="demo" height="640" width="640" style="background-color: white;"></div>
</body>
<script type="text/javascript">
var canvas = document.getElementById('demo');
var context = canvas.getContext('2d');
var start = new Date();
var lines = 12,
cW = context.canvas.width,
ogr2ogr -f "SQLite" -t_srs EPSG:4326 merged.sqlite Parks/parks.shp
# the resulting main sqlite table is named after the original shapefile, in this case 'parks'
import csv
count = 0
places = {}
with open('infobox_properties_en.nt', 'rU') as file:
r = csv.reader(file, delimiter=' ')
for line in r:
# line 1 is just a timestamp
if count > 0 and count < 200: