Skip to content

Instantly share code, notes, and snippets.

View mikehale's full-sized avatar

Michael Hale mikehale

  • Heroku
  • Holly Springs, NC
View GitHub Profile
@mikehale
mikehale / deploy.rb
Created July 22, 2008 19:55
capistrano recipe for working with slicehost dns api
load 'config/dns'
set :ip, '127.0.0.1'
set :domains, %w(example.net. example.com. example.org.)
#This can be used as a sake task
desc "Install a database.yml if non exists"
task :add_database_yml do
database_yml = %(env: &env
adapter: sqlite3
timeout: 5000
development:
This is the top level god configuration. Basically the only thing that needs to be set here is the name of the application. Then require the various recipes.
APPLICATION="whatever"
require 'mongrel'
@mikehale
mikehale / monit.sh
Created August 7, 2008 20:12
Monit Upstart Script
# This is an event.d (upstart) script to keep monit running
# To install disable the old way of doing things:
#
# /etc/init.d/monit quit && update-rc.d -f monit remove
#
# then put this script here: /etc/event.d/monit
#
# You can manually start and stop monit like this:
#
# start monit
class ContestController < ApplicationController
session :off
no_login_required
skip_before_filter :verify_authenticity_token
def index
render :text => "helloworld!"
end
def create
require 'config/recipes/dns'
def parse_headers
request = "GET /remote/path/img.gif HTTP/1.1\r\nAccept-Language: en-us,en;q=0.5\r\nCache-Control: max-age=0\r\nIf-None-Match: \"58dc30c-216-3d878fe2\"-gzip\r\nX-Forwarded-For: 127.0.0.1\r\nAccept: image/png,image/*;q=0.8,*/*;q=0.5\r\nConnection: Keep-Alive\r\nX-Forwarded-Server: www.example.com\r\nAccept-Encoding: gzip,deflate\r\nUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4\r\nCookie: cookie1=YWJj; cookie2=ZGVm\r\nReferer: http://www.example.com/posts/\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nHost: localhost:4001\r\nX-Forwarded-Host: www.example.com\r\nIf-Modified-Since: Tue, 17 Sep 2002 20:26:10 GMT\r\n\r\n"
tmp = {}
request.split("\r\n")[1..-1].each{|e|
k,v = e.split(': ')
tmp[k]=v
}
tmp
end
def foo
puts 'You called foo!';
end
method = self.method(:foo)
#These do the same thing
method.call
foo
We couldn’t find that file to show.
Process: System Preferences [45379]
Path: /Applications/System Preferences.app/Contents/MacOS/System Preferences
Identifier: com.apple.systempreferences
Version: 5.2 (5.2)
Build Info: SystemPrefsApp-1510800~2
Code Type: X86 (Native)
Parent Process: launchd [223]
Date/Time: 2009-01-30 14:13:16.088 -0500
OS Version: Mac OS X 10.5.6 (9G55)