Skip to content

Instantly share code, notes, and snippets.

View chrismetcalf's full-sized avatar

Chris Metcalf chrismetcalf

View GitHub Profile
cd ~/Documents/OmniFocus\ Backups
du . | perl -ne 'm/^(\d+).*(\d{4}-\d{2}-\d{2})/; print "$1, $2\n";' | tee ~/tmp/omnifocus_sizes.csv
{"name":"Seattle Real Time Fire 911 Calls","query":{"orderBys":[{"expression":{"columnId":2354168,"type":"column"},"ascending":false}],"filterCondition":{"value":"AND","children":[{"children":[{"columnId":2354168,"type":"column"},{"value":1281337200,"type":"literal"}],"value":"GREATER_THAN","type":"operator"}],"type":"operator"}},"originalViewId":"kzjm-xkqj"}
@chrismetcalf
chrismetcalf / gist:652184
Created October 28, 2010 19:47
King County Tree Disposal Line - Greeting
answer
sleep(2)
say "Welcome to the King County Christmas Tree Recycling Line."
# Setting up our options for "ask". We accept 5 digits, either spoken or entered
# by DTMF, and time out after 10 seconds.
zipcode_options = { :choices => "[5 DIGITS]",
:repeat => 3,
:timeout => 10,
:onBadChoice => lambda { say 'Invalid entry, please try again.' },
@chrismetcalf
chrismetcalf / gist:652186
Created October 28, 2010 19:48
King County Tree Disposal Line - Callout to Socrata
def lookup_facilities(zip_code)
log "Looking for facilities in zip code #{zip_code}..."
# This looks complicated, but I'm just building the hash that I'll convert to
# JSON in order to run a dynamic filter against the Socrata API.
query = {
# The 4-4 view ID of the ID I want to filter against
"originalViewId" => "zqwi-c5q3",
# A temporary name for my filter
@chrismetcalf
chrismetcalf / parser.rb
Created November 2, 2010 23:24
A simple parser for King County voting result files
#!/usr/bin/env ruby
#
# A simple parser for parsing King County, WA vote results
PARTIES = {
"Dem" => "Democratic Party",
"DPC" => "Democratic Party",
"Rep" => "Republican Party",
"RPC" => "Republican Party",
"NOP" => "NOP",
@chrismetcalf
chrismetcalf / gist:671812
Created November 11, 2010 01:09
New handler for SMS and text in tropo
# Decide whether this is text or phone
if $currentCall.nil?
log "Curious. No currentCall. Am I running outside Tropo?"
elsif $currentCall.initialText.nil?
# Phone call
say "Welcome to the King County Christmas Tree Recycling Line."
# Setting up our options for "ask". We accept 5 digits, either spoken or entered
# by DTMF, and time out after 10 seconds.
zipcode_options = { :choices => "[5 DIGITS]",
#!/bin/sh
SPACE="SERVER$(spacefinder | sed 's/Current Space ID: //')"
mvim --serverlist | grep $SPACE
if [ $? -eq 1 ]
then
mvim --servername $SPACE $*
else
mvim --servername $SPACE --remote $*
fi
@chrismetcalf
chrismetcalf / dwm-5.8.2-nametag.diff
Created May 18, 2011 15:35
New version of nametag patch for DWM 5.8.2 (http://dwm.suckless.org/patches/nametag)
diff -up dwm-5.8.2/config.def.h dwm-5.8.2.patched/config.def.h
--- dwm-5.8.2/config.def.h 2010-06-04 06:39:15.000000000 -0400
+++ dwm-5.8.2.patched/config.def.h 2011-05-18 11:31:44.000000000 -0400
@@ -14,7 +14,8 @@ static const Bool showbar = Tr
static const Bool topbar = True; /* False means bottom bar */
/* tagging */
-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+#define MAX_TAGLEN 16
+static char tags[][MAX_TAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff -up dwm-5.8.2/config.def.h dwm-5.8.2-patched/config.def.h
--- dwm-5.8.2/config.def.h 2010-06-04 06:39:15.000000000 -0400
+++ dwm-5.8.2-patched/config.def.h 2011-06-07 14:12:55.000000000 -0400
@@ -14,7 +14,8 @@ static const Bool showbar = Tr
static const Bool topbar = True; /* False means bottom bar */
/* tagging */
-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+#define MAX_TAGLEN 16
+static char tags[][MAX_TAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
@chrismetcalf
chrismetcalf / gist:1144325
Created August 13, 2011 22:41
Scale and crop a bunch of time lapse photos at the sametime
parallel convert -scale 1920x -crop 1920x1080+0+210 {} Cropped_and_Resized/{/} ::: In_Sequence/*