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 state_abbr = [ 'AA','AE','AK','AL','AP','AR','AZ','CA','CO','CT','DC','DE','FL','GA','GU','HI', | |
'IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC', | |
'ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','PR','RI','SC','SD','TN', | |
'TX','UT','VA','VT','WA','WI','WV','WY' ]; | |
var prefix_matrix = { 100:38, 101:38, 102:38, 103:38, 104:38, 105:38, 106:38, 107:38, 108:38, | |
109:38, 110:38, 111:38, 112:38, 113:38, 114:38, 115:38, 116:38, 117:38, | |
118:38, 119:38, 120:38, 121:38, 122:38, 123:38, 124:38, 125:38, 126:38, | |
127:38, 128:38, 129:38, 130:38, 131:38, 132:38, 133:38, 134:38, 135:38, | |
136:38, 137:38, 138:38, 139:38, 140:38, 141:38, 142:38, 143:38, 144:38, |
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
function strToAbbr(str) { | |
str = str.toUpperCase(); | |
str = str.replace(/\b(AND|OR|NOR|BUT|A|AN|THE|AS|AT|BY|FOR|IN|OF|ON|PER|TO)\b/g, ''); | |
var words = str.split(/\s+/), abbr = ''; | |
for(var x = 0; x < words.length; x++) abbr += words[x].substr(0,1); | |
return abbr; | |
} |
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
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install (64 bit) | |
# updated to PostGIS 2.0.1 | |
# add the ubuntu gis ppa | |
sudo apt-get -y install python-software-properties | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update |
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
{ | |
"brand": "joyent", | |
"image_uuid,": "7abad50e-b865-11e0-8462-730bcfdde020d", | |
"alias": "pgbench", | |
"hostname": "pgbench", | |
"max_physical_memory": 16384, | |
"nics": [ | |
{ | |
"nic_tag": "admin", | |
"ip": "76.8.51.210", |
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
{ | |
"type": "LineString", | |
"coordinates": [ | |
[ | |
-75.43241, | |
40.122597 | |
], | |
[ | |
-75.432447, | |
40.122651 |
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
city_limits_0 | |
1 | |
-7.501497E+01 4.013793E+01 | |
-7.501456E+01 4.013768E+01 | |
-7.501401E+01 4.013735E+01 | |
-7.501387E+01 4.013726E+01 | |
-7.501223E+01 4.013626E+01 | |
-7.501146E+01 4.013578E+01 | |
-7.501062E+01 4.013527E+01 | |
-7.501043E+01 4.013515E+01 |
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
sw=# EXPLAIN ANALYZE SELECT ST_Distance(ST_Transform(ST_GeomFromText('POINT(-75.211457 39.956314)', 4326), 900913), planet_osm_line.way) AS planar_degrees, name FROM planet_osm_line ORDER BY planar_degrees ASC LIMIT 2; | |
QUERY PLAN | |
----------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=4719.15..4719.15 rows=2 width=600) (actual time=39.156..39.157 rows=2 loops=1) | |
-> Sort (cost=4719.15..4758.76 rows=15845 width=600) (actual time=39.154..39.154 rows=2 loops=1) | |
Sort Key: (st_distance('010100002031BF0D005777154645F05FC15B189DFEB2895241'::geometry, way)) | |
Sort Method: top-N heapsort Memory: 25kB | |
-> Seq Scan on planet_osm_line (cost=0.00..4560.70 rows=15845 width=600) (actual time=0.028..33.340 rows=15845 loops=1) | |
Total runtime: 39.186 ms | |
(6 rows) |
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
crime_enum = { | |
'Aggravated Assault Firearm': 0, | |
'Aggravated Assault No Firearm': 1, | |
'Burglary Non-Residential': 2, | |
'Burglary Residential': 3, | |
'Homicide - Criminal ': 4, | |
'Homicide - Criminal': 4, | |
'Homicide - Gross Negligence': 5, | |
'Homicide - Justifiable ': 6, | |
'Motor Vehicle Theft': 7, |
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
#!/bin/bash | |
# To run: | |
# source <(curl -s https://gist.github.com/jmealo/6231713/raw) | |
# note: running it this way renders the network configuration tests superfluous | |
if [[ "$(uname)" = "SunOS" ]] ; then | |
OS="SMARTOS" | |
elif [[ -f /etc/debian_version ]]; then | |
OS="DEBIAN" |
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
import os, re, commands, subprocess | |
def streamCommand(cmd): | |
# runs a shell command and returns stdout as a stream you can loop over | |
stdout = subprocess.Popen(cmd, shell=True, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.STDOUT).stdout | |
return stdout | |
def getFileExtension(filename): |
OlderNewer