Skip to content

Instantly share code, notes, and snippets.

View kyleburton's full-sized avatar

Kyle Burton kyleburton

View GitHub Profile
[Kyle Burton] kburton@phikburton-mb ~/development/loc-counts$ bash count.sh
Creating filelist for clojure
Have a non-directory at the top, so creating directory top_dir
Adding /Users/kburton/development/loc-counts/./count.sh to top_dir
Creating filelist for java
Creating filelist for javascript
Creating filelist for ruby
Creating filelist for sh
Categorizing files.
Finding a working MD5 command....
cat scripts/monitor.sh
CMD=$(cat <<END_OF_COMMAND
echo;
echo '*** LISTING QUEUES for myvhost ***';
echo 'name, consumers, messages_ready, messages_unacknowledged';
rabbitmqctl -q list_queues -p 'myvhost' name consumers messages_ready messages_unacknowledged ;
echo;
echo '*** LISTING CONNECTIONS ***' ;
/*
* Use to await multiple async ajax requests in a 'fire and forget' approach, with an even triggered
* on completion. We used this to hold back the display of a lightbox until the outstanding requests
* had fetched the data necessary for display - provided the user with a fully rendered lightbox, rather
* than a skeleton within which multiple elements then shifted around or popped in.
*
* $(document).bind('data.retrieved',showMyLightbox);
* multiGet('data.retrieved', {
* url: '/redata/us-states/',
* success: function(d) { populateSelectList('select#st',d); },
#!/usr/bin/env ruby
#
# Pipe mysql through this:
#
# mysql -uuser database_name -e 'select * from some_table' | rec-view.rb
#
# and it will produce a 'portrait' view of the records
#
# Record[1]
# [ 1] ID : 1
(defn dbf->tabfile [dbfile tabfile]
(with-open [dbf (org.xBaseJ.DBF. dbfile)]
(with-open [outp (java.io.PrintWriter. tabfile)]
(binding [*out* outp]
(println (str/str-join "\t" (field-names dbf)))
(for-each-row
(fn [recno fields]
(println (str/str-join "\t" (map #(.trim (.get %)) fields))))
dbf)))))
@kyleburton
kyleburton / gist:106079
Created May 3, 2009 17:55
clojure ftp example
(ns tiger
(:import ( org.apache.commons.net.ftp FTP FTPClient))
(:require [com.github.kyleburton.sandbox.ftp :as ftp])
(:use [ clojure.contrib.str-utils :as str]))
(def *tiger-ftp-url* "ftp://anonymous:user%[email protected]/geo/tiger/TIGER2008/")
(ftp/list-all *tiger-ftp-url*)
(ftp/list-files *tiger-ftp-url*)
(ftp/list-directories *tiger-ftp-url*)