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
# Generates an list of gem install commands. Useful for moving to enterprise ruby.
existing_gems = %<actionmailer (2.0.2, 1.3.6)
actionpack (2.0.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.0.2, 1.15.6)
activeresource (2.0.2)
activesupport (2.0.2, 1.4.4)
existing_gems.each do |line|
@mikehale
mikehale / gist:62184
Created February 11, 2009 19:14
How to put all apache and rails logs into syslog-ng
We couldn’t find that file to show.
# So imagine that you have an attribute mash named apache:
# apache = Mash.new unless attribute?("apache")
#
# And you'd like to prefer the values defined by the node over the defaults in your attributes file:
# apache[:version] = '2.0.6' unless apache.has_key?(:version)
#
# Now instead of having to check every key you can do something like this:
# apache Mash.new unless attribute?("apache")
# apache.prefer_defaults = false
# apache[:version] = '2.0.6'
@mikehale
mikehale / Rakefile
Created March 19, 2009 14:40
shared ip addresses between 2 routers
task :default => [:update_servers]
desc "Update servers with current config"
task :update_servers do
puts `scp lb1_keepalived.conf root@vm-ubuntu-1:/etc/keepalived/keepalived.conf`
puts `scp my.cnf root@vm-ubuntu-1:/etc/mysql/`
puts `scp ndb_mgmd.cnf root@vm-ubuntu-1:/etc/mysql/`
puts `scp lb2_keepalived.conf root@vm-ubuntu-2:/etc/keepalived/keepalived.conf`
puts `scp my.cnf root@vm-ubuntu-2:/etc/mysql/`
# Akismet
#
# Author:: David Czarnecki
# Copyright:: Copyright (c) 2005 - David Czarnecki
# License:: BSD
class Akismet
require 'net/HTTP'
require 'uri'
@mikehale
mikehale / gist:99826
Created April 22, 2009 14:35
Logrotate script for mongrels
We couldn’t find that file to show.
@mikehale
mikehale / vmware.rb
Created April 24, 2009 16:02
Rake Library for VMWare Fusion
require 'rake'
require 'rake/tasklib'
class VirtualMachineTask < ::Rake::TaskLib
def initialize(vm_path, vm_name, snapshot_name)
@vm_path = vm_path
@vm_name = vm_name
@snapshot_name = snapshot_name
define
We couldn’t find that file to show.
'Chef::Mixin::Template render_template should return a file' FAILED
expected kind of Tempfile, got #<File:/var/folders/M6/M6md4-eIH04rJcQnz8aGL++++TI/-Tmp-/chef-rendered-template.41497.2 (closed)>
(eval):3:in `__send__'
(eval):3:in `should'
./spec/unit/mixin/template_spec.rb:35:
1)
Spec::Mocks::MockExpectationError in 'Chef::Provider::Directory should load the current resource based on the new resource'
<File (class)> expected :exist? with (any args) once, but received it 11 times
./spec/unit/provider/directory_spec.rb:38:
2)
Spec::Mocks::MockExpectationError in 'Chef::Provider::Link load_current_resource when the link type is symbolic and the target exists and is a symlink should update the source of the existing link with the links target'
<File (class)> expected :exists? with ("/tmp/fofile-link") but received it with (["/tmp/fofile"])
./spec/unit/provider/link_spec.rb:80: