Skip to content

Instantly share code, notes, and snippets.

View chrismetcalf's full-sized avatar

Chris Metcalf chrismetcalf

View GitHub Profile
Name,Age,Allowance
Chris,30,$75.00
Sam,12,$15.00
Sue,8,$10.00
// Connect to the API
String domain = "saxon.socrata.com";
String username = "<youremail>";
String password = "<yourpass>";
String appToken = "<yourapptoken>";
Connection connection = new HttpConnection(domain, username, password, appToken);
// Connect to the view
View view = View.find("ry7h-n6bk", connection);
#!/bin/sh
# Gist doesn't like the tab character for some reason, so replace it with an actual tab (ctrl-v, tab)
sed 's/<tab>//' | sed 's/ //g' | sed 's/^"//' | sed 's/","/ /g' | sed 's/"$//' | sed 's/"//g'
package com.socrata.geotoolbox;
import au.com.bytecode.opencsv.CSVReader;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import java.io.FileReader;
import java.io.InputStreamReader;
public class RecordCount {
public static void main(String[] args) throws Exception {
@chrismetcalf
chrismetcalf / gist:1144714
Created August 14, 2011 08:43
Compile a batch of JPEGs into a time-lapse movie
ffmpeg -i "%05d.JPG" -vcodec libx264 -crf 20 -threads 0 video.mp4
@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/*
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 / 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" };
#!/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 / 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]",