Skip to content

Instantly share code, notes, and snippets.

View kmile's full-sized avatar

Kamiel Wanrooij kmile

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kmile on github.
  • I am kmile (https://keybase.io/kmile) on keybase.
  • I have a public key whose fingerprint is F915 AA04 90C6 F557 F952 C033 F1C9 E695 C0A0 A4D9

To claim this, I am signing this object:

@kmile
kmile / delayed-job.pill
Created August 4, 2011 14:45
A sample pill file for delayed job, won't log to stdout however.
app_root = File.join(File.dirname(__FILE__), '../')
Bluepill.application('app_name', :log_file => File.join(app_root, 'log', 'bluepill.log')) do |app|
app.working_dir = app_root
app.process("delayed-job.#{app.app.name}") do |process|
process.start_command = '/opt/ruby-enterprise/bin/rake RAILS_ENV=production jobs:work --trace'
process.stdout = process.stderr = File.join(app.working_dir, 'log', "#{process.name}.log")
process.daemonize = true
@kmile
kmile / xml_parser.rb
Created February 15, 2011 12:53
A small nokogiri xml reader DSL.
# A small DSL for helping parsing documents using Nokogiri::XML::Reader. The
# XML Reader is a good way to move a cursor through a (large) XML document fast,
# but is not as cumbersome as writing a full SAX document handler. Read about
# it here: http://nokogiri.org/Nokogiri/XML/Reader.html
#
# Just pass the reader in this parser and specificy the nodes that you are interested
# in in a block. You can just parse every node or only look inside certain nodes.
#
# A small example:
#
@kmile
kmile / passenger_status.rb
Created November 4, 2010 10:05 — forked from dan-manges/passenger_status.rb
Munin passenger plugin with added queue support
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category App
graph_title passenger status
graph_vlabel count
sessions.label sessions
max.label max processes