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(ggplot2) | |
library(plyr) | |
# need to run this in your project directory: | |
# git log --pretty=format:"%cd" | sed -e 's/\:/\ /' | \ | |
# cut -f 1,4 -d\ | sort | uniq -c | \ | |
# sed -e 's/^\ \ *//' > /tmp/timecard.out | |
base.df <- expand.grid(dow=c("Sun","Mon","Tue","Wed","Thu", "Fri","Sat"), hour=0:23) | |
base.df$dow <- factor(base.df$dow, levels=c("Sun","Mon","Tue","Wed","Thu", "Fri","Sat")) |
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(xml2) | |
library(stringr) | |
library(tidyr) | |
library(dplyr) | |
library(ggplot2) | |
library(ggthemes) | |
library(maptools) | |
library(sp) | |
# inspired by this SCADACS post: http://www.scadacs.org/iram.html |
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
// booktracker.js | |
// by @hrbrmstr (2013) | |
// MIT license | |
// | |
// run this mongo query on the command line and redirect to a CSV file: | |
// $MONGO_BIN/mongo --quiet $DBNAME booktracker.js > $OUTPUT_LOCATION/book.csv | |
// | |
// stick it in the same cron job you have booktracker.py running | |
db.amzn.find({ }, { 'ItemLookupResponse.Items.Item.SalesRank' : 1, |
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(shiny) | |
library(maps) | |
library(maptools) | |
library(ggplot2) | |
library(plyr) | |
library(XML) | |
# Define server logic required to plot various variables against mpg | |
shinyServer(function(input, output, session) { | |
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> | |
<!-- | |
-- by @hrbrmstr (2013) | |
-- MIT License | |
--> | |
<html> | |
<head> | |
<title>Central Maine Power Live Outage Map</title> | |
<meta charset="utf-8"/> | |
<meta http-equiv="refresh" content="300"/> |
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
# install.packages("data.table") # if you don't have it installed | |
library(data.table) | |
# download the file first since it's *huge* and we don't want to have to | |
# re-download it every time we work with it. comment this out after you | |
# read it in once or put an "if exists" wrapper around it to avoid | |
# re-downloading it from an errant script run. This assumes you have | |
# a "data"directory under your home directory; change destination | |
# as appropriate |
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> | |
<head> | |
<title>D3 Dots</title> | |
<script src="d3.v3.min.js" type="text/javascript" charset="utf8"></script> | |
<script src="jquery-1.10.2.min.js" type="text/javascript" charset="utf8"></script> | |
<script src="jquery-migrate-1.2.1.min.js" type="text/javascript" charset="utf8"></script> |
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(XML) | |
library(maptools) | |
library(sp) | |
library(plyr) | |
# Small script to get county-level outage info from Bangor Hydro | |
# Electric's town(-ish) level info | |
# | |
# BHE's outage google push-pin map is at | |
# http://apps.bhe.com/about/outages/outage_map.cfm |
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/python | |
import tldextract | |
f = open("/tmp/indomains.txt") | |
hosts = f.readlines() | |
f.close() | |
tlds = ['.'.join(tldextract.extract(host.rstrip())[-2 : ]) for host in hosts] |
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 urllib2 | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(urllib2.urlopen("http://www.amsmeteors.org/observations/").read()) | |
rows = soup.findChildren('table')[0].findChildren | |
for row in t[0].findAll('tr')[1:]: | |
col = row.findAll('td') |