Skip to content

Instantly share code, notes, and snippets.

@xaviershay
xaviershay / ocr.main
Created August 7, 2011 06:34
OCR with Clojure. See the blog post at rhnh.net.
(ns ocr.main
(:use [clojure.string :only (split trim)])
(:use [clojure.contrib.duck-streams :only (write-lines read-lines)])
(:use [clojure.contrib.shell-out :only (sh)])
(:use [clojure.contrib.math :only (sqrt)]))
; Input handling
(defn read-text-image-line [line]
(if (= "white" (last (split line #"[,:\s]+"))) "0" "1"))
@newbamboo
newbamboo / gist:1261956
Created October 4, 2011 15:36 — forked from christoomey/gist:1206762
Linode Ubuntu 10.04 (Lucid) with passenger & nginx for rails hosting
#################################################################
# #
# A guide to setting up a linode Ubuntu VPS for #
# Ruby on Rails hosting with nginx & passenger #
# #
# Compiled by Chris Toomey [ctoomey.com] on Sept. 9 2011 #
# #
#################################################################
# Start with base 10.04 image. Setup the DNS for any domains you
@joshuaclayton
joshuaclayton / .rspec
Created January 31, 2012 14:04
RSpec + Cucumber + Spork
--colour --drb
@jimweirich
jimweirich / abstract.md
Created April 17, 2012 23:53
Berlin Clock Kata

Berlin Clock

Original Reference

Create a representation of the Berlin Clock for a given time (hh::mm:ss).

The Berlin Uhr (Clock) is a rather strange way to show the time. On the top of the clock there is a yellow lamp that blinks on/off every two seconds. The time is calculated by adding rectangular lamps.

@kmiyashiro
kmiyashiro / admin.html
Created May 10, 2012 21:02
Mocha HTML spec
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../libs/mocha.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div id="mocha"></div>
<script src="../libs/mocha.js" type="text/javascript" charset="utf-8"></script>
@xdite
xdite / gist:3072362
Created July 8, 2012 19:10
deploy/asset.rb
# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \
@yanyaoer
yanyaoer / cmus-remote.sh
Created July 30, 2012 09:19
cmus-remote with alfred extensions script
#!/bin/bash
ps=/bin/ps
grep=/usr/bin/grep
tmux=/usr/local/bin/tmux
cmus=/usr/local/bin/cmus
cmus-remote=/usr/local/bin/cmus-remote
sleep=/usr/local/Cellar/coreutils/8.17/libexec/gnubin/sleep
echo {query} # use query like shift $((OPTIND-1))
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 7, 2024 13:22
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@halcyonCorsair
halcyonCorsair / Vagrantfile
Created September 5, 2012 21:10
A json file for chef-solo, and the equivalent Vagrantfile to setup koha
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"