Skip to content

Instantly share code, notes, and snippets.

View edouard's full-sized avatar

Edouard Brière edouard

View GitHub Profile
# change postgresql template1 db encoding to utf8 (unicode) by dropping it and recreating from template0
UPDATE pg_database SET datistemplate=false WHERE datname='template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
UPDATE pg_database SET datistemplate=true WHERE datname='template1';
@edouard
edouard / god.rb
Created September 22, 2009 23:49 — forked from defunkt/god.rb
rails_root = "/data/github/current"
20.times do |num|
God.watch do |w|
w.name = "dj-#{num}"
w.group = 'dj'
w.interval = 30.seconds
w.start = "rake -f #{rails_root}/Rakefile production jobs:work"
w.uid = 'git'
@edouard
edouard / stats.rb
Created September 15, 2009 21:11 — forked from mojombo/stats.rb
# Run the given block +num+ times and then print out the mean, median, min,
# max, and stddev of the run. For example:
#
# irb> stats(10) { sleep(rand / 100) }
# mean: 5.99ms
# median: 6.76ms
# min: 1.49ms
# max: 9.28ms
# stddev: 2.54ms
def stats(num)