This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
God.watch do |w| | |
w.name = "apache2" | |
w.interval = 30.seconds # default | |
w.start = "apache2ctl start" | |
w.stop = "apache2ctl stop" | |
w.restart = "apache2ctl restart" | |
w.start_grace = 10.seconds | |
w.restart_grace = 10.seconds | |
w.pid_file = "/var/run/apache2.pid" | |
w.behavior(:clean_pid_file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://thewebfellas.com/blog/2008/2/12/a-simple-faith-monitoring-by-god | |
God.watch do |w| | |
w.name = "mysqld" | |
w.interval = 30.seconds # default | |
w.start = "service mysqld start" | |
w.stop = "service mysqld stop" | |
w.restart = "service mysqld restart" | |
w.start_grace = 20.seconds | |
w.restart_grace = 20.seconds | |
w.pid_file = "/var/run/mysqld/mysqld.pid" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
# url dsl -- the ultimate url dsl! | |
# | |
# You just can't beat this: | |
# | |
# $ irb -r url_dsl | |
# >> include URLDSL | |
# => Object | |
# >> http://github.com/defunkt.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# smoother space switching animations for snow leopard | |
$ sudo defaults write /Library/Preferences/com.apple.windowserver Compositor -dict deferredUpdates 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
require 'rubygems' | |
require 'daemon-spawn' | |
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
class DelayedJobWorker < DaemonSpawn::Base | |
def start(args) | |
ENV['RAILS_ENV'] ||= args.first || 'development' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.loc.gov/standards/iso639-2/ascii_8bits.html | |
ISO_639_2 = [ | |
["aar", "", "aa", "Afar", "afar"], | |
["abk", "", "ab", "Abkhazian", "abkhaze"], | |
["ace", "", "", "Achinese", "aceh"], | |
["ach", "", "", "Acoli", "acoli"], | |
["ada", "", "", "Adangme", "adangme"], | |
["ady", "", "", "Adyghe; Adygei", "adyghé"], | |
["afa", "", "", "Afro-Asiatic languages", "afro-asiatiques, langues"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Library of Congress Main Classes and Subclasses | |
{ | |
"A" => { | |
:name => "General Works", | |
:subclasses => { | |
"AC" => "Collections; Series; Collected works", | |
"AE" => "Encyclopedias", | |
"AG" => "Dictionaries and other general reference works", | |
"AI" => "Indexes", | |
"AM" => "Museums. Collectors and collecting", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
include Nokogiri | |
class PostCallbacks < XML::SAX::Document | |
def start_element(element, attributes) | |
puts "start element: #{element}" | |
puts "attributes: #{attributes.inspect}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
class RbST | |
@@executable_path = File.expand_path(File.join(File.dirname(__FILE__), "rst2parts")) | |
@@executables = { | |
:html => File.join(@@executable_path, "rst2html.py"), | |
:latex => File.join(@@executable_path, "rst2latex.py") | |
} | |