Skip to content

Instantly share code, notes, and snippets.

#!/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'
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()
#!/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
#
#!/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
#!/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
tidy -i -xml -asxml input.xml