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
tidy -i -xml -asxml input.xml |
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 | |
## Jonah Duckles - [email protected] | |
## BASH & R Code to download census participation rates and make a map of census progress. | |
## Can be run daily to see how the census is progressing | |
## Requires library(maptools) library(RColorBrewer) and library(classInt) to be installed in R | |
## Requires gdal/ogr (www.gdal.org) and spatialite (http://www.gaia-gis.it/spatialite/) tools in your path | |
## | |
## Example output: http://jduck.net/files/participation2010.png | |
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 | |
# Streamlined workflow for capturing screen shots and uploading them to my website. | |
# Assumption: you have keypairs set up for ssh with the target HOST | |
read -p"Enter filename (no extension): " NAME | |
HOST=jduck.net | |
DIRECTORY=www/files | |
REMOTE=${HOST}:${DIRECTORY}/${NAME} | |
TMPFILE=/tmp/${RANDOM}.scap |
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 | |
# Requires, gdal, wget, spatialite, R with (maptools, RColorBrewer, classInt) | |
# You should be able to put any state/county combination in here and get a map made | |
# Replace spaces with an underscore ie: | |
#state=New_York | |
#county=New_York | |
# | |
#state=ILLINOIS | |
#county=Cook | |
# |
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
library(lattice) # ?xyplot for more info on the myriad of ways to use lattice | |
library(reshape) # need melt() and rename() to reshape data frame for easy plotting | |
# Lets plot "WorldPhones" from package datasets | |
wp <- rename(melt(WorldPhones), c(X1 = 'year', X2 = 'country', value = 'numphone')) | |
xyplot( numphone ~ year | country, data=wp, type="b", scales="free") | |
# To print multiple pages set layout=c(1,1) to plot 1 plot per page (or more if it makes sense) | |
pdf('~/path/to/mydoc.pdf', width=11, height=8.5) | |
xyplot( numphone ~ year | country, data=wp, type="b", scales="free", layout=c(1,1) ) | |
dev.off() |
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/env python | |
import csv | |
import re | |
from urllib2 import urlopen | |
from BeautifulSoup import BeautifulStoneSoup | |
WEATHERBUG_API_KEY = 'A6464697672' | |
WEATHERBUG_SEARCH_URL = 'http://api.wxbug.net/getStationsXML.aspx?ACode=' + WEATHERBUG_API_KEY + '&zipCode=60601&unittype=0' |
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
# TODO support Binary and Code | |
import calendar | |
import datetime | |
import re | |
try: | |
import uuid | |
_use_uuid = True | |
except ImportError: | |
_use_uuid = False |
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/sh | |
DBHOST=mydbhost | |
DBNAME=mydbname | |
files=$1 | |
target=$2 | |
for file in ${files}; do | |
psql -h ${DBHOST} ${DBNAME} -c "\copy ${target} FROM '${file}' delimiters ','" |
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
Driver: NITF/National Imagery Transmission Format | |
Files: 002AA013.TF3 | |
Size is 1536, 1536 | |
Coordinate System is: | |
GEOGCS["WGS 84", | |
DATUM["WGS_1984", | |
SPHEROID["WGS 84",6378137,298.257223563, | |
AUTHORITY["EPSG","7030"]], | |
TOWGS84[0,0,0,0,0,0,0], | |
AUTHORITY["EPSG","6326"]], |
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
# See http://www.oscon.com/oscon2011/public/schedule/detail/18836 for getting Mahout setup | |
# Get Reuters Data | |
wget http://goo.gl/qv6Ad | |
mkdir reuters-out | |
mv reuters21578.tar.gz reuters-out | |
cd reuters-out | |
tar -xzvf reuters21578.tar.gz | |
cd .. | |
# Mahout steps | |
# slip out text from SGM files |
OlderNewer