Skip to content

Instantly share code, notes, and snippets.

View xwmx's full-sized avatar

William Melody xwmx

View GitHub Profile
@xwmx
xwmx / url_dsl.rb
Created December 14, 2009 20:01 — forked from defunkt/url_dsl.rb
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
# 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"
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)
# 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
We couldn’t find that file to show.
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(/</, "&lt;")
else
@xwmx
xwmx / info
Created November 22, 2009 19:23 — forked from mikeal/large_doc.json
http://www.mikealrogers.com/archives/695
http://gist.github.com/239890
#! /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
# browsing of shared dvds/cds on leopard
defaults write com.apple.NetworkBrowser EnableODiskBrowsing -bool true
defaults write com.apple.NetworkBrowser ODSSupported -bool true