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
# 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
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
# converts sections to chapters, subsections to sections and subsubsections to subsections after processing with pandoc. | |
$ pandoc -t latex -C TeXHeader -s Chapter1 Chapter2 | sed -e 's/\ | |
\section{/\\chapter{/g' \ | |
-e 's/subsection{/section{/g' > book.tex | |
$ pdflatex book.tex |
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
module HTML | |
class StathamSanitizer < WhiteListSanitizer | |
protected | |
def tokenize(text, options) | |
super.map do |token| | |
if token.is_a?(HTML::Tag) && options[:parent].include?(token.name) | |
token.to_s.gsub(/</, "<") | |
else |
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.mikealrogers.com/archives/695 | |
http://gist.github.com/239890 |
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
#! /bin/sh | |
# http://kbeezie.com/view/nginx-and-django/ | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server |
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
# browsing of shared dvds/cds on leopard | |
defaults write com.apple.NetworkBrowser EnableODiskBrowsing -bool true | |
defaults write com.apple.NetworkBrowser ODSSupported -bool true |