Skip to content

Instantly share code, notes, and snippets.

View mikehale's full-sized avatar

Michael Hale mikehale

  • RoleModel Software
  • Holly Springs, NC
View GitHub Profile
#!/usr/bin/env ruby
# Save this somewhere, chmod 755 it, then add
# complete -C path/to/this/script -o default rake
# to your ~/.bashrc
#
# If you update your tasks, just $ rm ~/.raketabs*
#
# Adapted from
# http://onrails.org/articles/2006/08/30/namespaces-and-rake-command-completion
This is a short collection of resources I have used in packaging Chef for Debian.
Good starting point, links to some of the other pages here:
* http://www.xs4all.nl/~carlo17/howto/debian.html
Debian New Maintainers guide:
* http://www.debian.org/doc/maint-guide/
@mikehale
mikehale / install_ruby_cocoa_with_rvm.sh
Created April 1, 2010 20:08
install ruby cocoa for rvm ruby 1.8.6 (doesn't work yet)
#!/usr/bin/sh
ARCHFLAGS='-arch i386 -arch x86_64' rvm install 1.8.6 --debug --reconfigure -C --enable-shared=yes
wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.1/RubyCocoa-1.0.1.tar.gz/download && \
tar xzf RubyCocoa-1.0.1.tar.gz && \
rm RubyCocoa-1.0.1.tar.gz && \
cd RubyCocoa-1.0.1 && \
ruby install.rb config \
ruby install.rb setup && \
@mikehale
mikehale / ical_bug.rb
Created April 6, 2010 21:08
rical bug
#!/usr/bin/env ruby
require 'rubygems'
require 'active_support'
require 'ri_cal'
def create_calendar(options={:all_events => false, :dtstamp => false})
Time.zone = "Eastern Time (US & Canada)"
calendar = RiCal.Calendar do |cal|
cal.event do |event|
@mikehale
mikehale / default.rb
Created April 8, 2010 19:06 — forked from ezmobius/default.rb
delayed_job recipe
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
if ['solo', 'app', 'app_master'].include?(node[:instance_role])
# be sure to replace "app_name" with the name of your application.
run_for_app("maloca") do |app_name, data|
@mikehale
mikehale / delayed_job_example.rb
Created April 13, 2010 15:17
Lightweight delayed job (for use by cron)
module Jobs
class HelloWorld < Struct.new(:text)
def perform
Rails.logger.debug text
Rails.logger.debug "sleeping for 7 seconds"
sleep(7)
end
end
#!/bin/sh
# Demo how your can merge opscode chef-repo & cookbooks
# and perm. keep up to date with opscode cookbooks (the last "git" cmd)
% git clone git://github.com/opscode/chef-repo.git
Initialized empty Git repository in /home/tim/src/chef-repo/.git/
remote: Counting objects: 107, done.
remote: Compressing objects: 100% (99/99), done.
remote: Total 107 (delta 45), reused 0 (delta 0)
Receiving objects: 100% (107/107), 16.14 KiB, done.
Resolving deltas: 100% (45/45), done.
@mikehale
mikehale / deploy.rb
Created May 14, 2010 19:10
Example deploy.rb for use with Engine Yard Cloud
task :production do
set :rails_env, "production"
role :app, "example.com", :master => true
role(:app) { |opts| compute_ec2_addresses(:app, opts) }
role(:db, :master => true) { |opts| compute_ec2_addresses(:db, opts) }
end
task :staging do
set :rails_env, "staging"
role :app, "staging.example.com", :master => true
on handle_string(logentry)
do shell script "~/.bin/worklog '" & logentry & "'"
end handle_string
class Chef
module Mixin
module Language
# esearch(:node, 'role\[admin\]')
# recursively search for this role/recipe in all roles
def esearch(context, search)
if context == :role
ret = []
# First solve all roles:
roles = search(:role, search)