Skip to content

Instantly share code, notes, and snippets.

View incanus's full-sized avatar

Justin R. Miller incanus

View GitHub Profile
@incanus
incanus / j
Created October 21, 2011 21:13
Bash script to kill old Jekyll processes, start a new one in the current directly, and open the browser to it.
#!/bin/sh
ps ax | grep jekyll | grep -v grep | awk '{ print $1 }' | xargs kill
jekyll &
sleep 1
open http://localhost:4000
@incanus
incanus / gist:1381351
Created November 21, 2011 01:17
AppleScript to use Display Audio as input & output devices
tell application "System Preferences" to activate
tell application "System Events"
tell process "System Preferences"
click menu item "Sound" of menu "View" of menu bar 1
-- set output
click radio button "Output" of tab group 1 of window "Sound"
set theRows to every row of table 1 of scroll area 1 of ¬
tab group 1 of window "Sound"
repeat with aRow in theRows
if (value of text field 1 of aRow as text) ¬
@incanus
incanus / gist:1435907
Created December 5, 2011 23:31
Script to scrape outage data from Connecticut Light & Power data site at http://outage.cl-p.com/outage/mobile.aspx for use in maps at http://tiles.mapbox.com/justin during November 2011 mass outages. Maps made with http://mapbox.com/tilemill/
#!/bin/sh
DATEFILE=/tmp/`date +"%s"`.html
curl -s http://outage.cl-p.com/outage/mobile.aspx > $DATEFILE
rm outages.csv 2>/dev/null
#cat $DATEFILE | grep '<table' | sed -e 's/.*<thead><tr><th>//g' -e 's/<\/th><\/tr><\/thead>.*//g' -e 's/<\/th><th>/,/g' >> outages.csv
cat $DATEFILE | grep '<table' | sed -e 's/.*<\/thead>//g' -e 's/<tfoot>.*//g' -e 's/<tr><td>//g' -e 's/<\/td><td>/|/g' -e 's/<\/td><\/tr>/@/g' -e 's/@$//g' | tr '@' "\n" >> outages.csv
@incanus
incanus / gist:1439543
Created December 6, 2011 19:24
Hubot update script
#!/bin/sh
# Script by @incanus to update Hubot from release tarballs since
# repo tags are meant for development.
if [ -z $1 ]; then
echo "Usage: $0 <version>"
exit 1
fi
@incanus
incanus / gist:1439681
Created December 6, 2011 19:56
Script to connect to a Heroku app's Redis instance
#!/bin/sh
echo "Connecting to Heroku Redis instance..."
if [ -n "$1" ]; then
echo "Executing \`$1\`..."
fi
url=`heroku config | grep REDISTOGO_URL | awk '{ print $3 }'`
@incanus
incanus / mbinfo.sh
Created December 7, 2011 19:00
Shell script to get basic info from the metadata of an MBTiles file.
#!/bin/sh
if [ -z $1 ]; then
echo "Usage: $0 <filename.mbtiles>"
exit 1
fi
sqlite3 -line $1 'select * from metadata;' | sed -e 's/^\(.\{85\}\).*/\1.../' -e 's/^ name = /+++/' -e 's/value = //' | grep -v ^$ | sed -e 's/^\([^+++]\)/ \1/' -e 's/^+++//'
echo "size"
@incanus
incanus / gist:1469786
Created December 13, 2011 00:16
my public SSH key
ssh-dss AAAAB3NzaC1kc3MAAACBAJzZ9jFXyrOCUfLzT1+sZjc63YIc69akPTWC1JpSKBC0hf+bHXFHOpTQbOY0HXzkO4yE+dvnv+6KREVX7fxYWMXBJtEWnMzuZ+qZOf1b0foWpUDy9llJUVqEak0Fi/AmFiA/je9YA6Fx2aplZ2EoxVNbJF82fFf/hdBWHQB6KcIHAAAAFQC5+/yOJkW/hFjDs3VHWUvMeP5cOQAAAIAGCCmFmx4Ak13OwzO3Bw+FbRAGW0/cdFHMQpHehhKCqXRaEonoHR1SABzUU7xf0cpGfpEjVUH1DdxpSkZ33PEFB2CI1ohj9p/ZcfS/fwuXtvMu5EWj/Llq4ontp3arvQrF+UQBYj/0b4cxkEStV+bCTZXnDEQfPgSSvFzM+1YlawAAAIBvGJcWdsUdE6I28APMOQeIGKFdQt6/x+Y4fWxzXOeomr35hJlx8QVMVe3Ynd6vSPdw68khBYIyU/71d9W9jWD8Dh1I05GMUKQ/19reKkh+C5bk5nwL6mNjpEsAiSDWQcvEtcDcZJ4DB02yyT9CdkvfMk1bD3rn0FPdIOyqgbYlHQ== Justin Miller
HTTP/1.0 502 Bad Gateway
Content-Length: 503
Server: CloudFront
Date: Fri, 06 Jan 2012 00:28:59 GMT
Content-Type: text/html
Expires: Fri, 06 Jan 2012 00:28:59 GMT
X-Cache: Error from cloudfront
X-Amz-Cf-Id: 4ccf15ce4a77319c7042073815b6e57aae9d97d3e5965c4acfbcb94e36546fdc5b168db95593e63c,11628e47ec5a2b5ca47ffed89ea9618c26956e1639d0ddac3f340d6c9d4b1c718d17a3b3479dd8a4
Via: 1.0 2ba8d32c0ef1d73da2fcae191d906606.cloudfront.net:11180 (CloudFront), 1.0 9f619df210e737c1479674b741ae9bf5.cloudfront.net:11180 (CloudFront)
Connection: close
@incanus
incanus / gist:1678136
Created January 25, 2012 19:41
Handy Bash function for indicating when a job completes in Lion with a visual bell & Terminal dock badge.
bwd()
{
$*
printf \\a
}
<a href="http://www.flickr.com/photos/mapbox/7802503562/" title="MapBox iOS SDK documentation by MapBox, on Flickr"><img src="http://farm9.staticflickr.com/8432/7802503562_c698fa7f78_c.jpg" width="800" height="566" alt="MapBox iOS SDK documentation"></a>