Skip to content

Instantly share code, notes, and snippets.

View jellybob's full-sized avatar

Jon Wood jellybob

View GitHub Profile
@jellybob
jellybob / kimsufi-bootstrap.sh
Created December 15, 2010 20:15
Bootsraps a Kimsufi i7-4T
#!/bin/bash
echo 'deb http://apt.opscode.com/ lucid main' | tee /etc/apt/sources.list.d/opscode.list
wget -qO - http://apt.opscode.com/[email protected] | apt-key add -
apt-get update
apt-get install chef -y
echo -e "chef\tchef/chef_server_url\tselect" > /tmp/chef.preseed
debconf-set-selections /tmp/chef.preseed
update-rc.d chef-client disable
#get the war files from the git repo
branch = "release-12"
bash "name_git_repo" do
user "username"
cwd "path/to/repo"
code "git checkout -b #{branch}-#{DateTime.now} origin/#{branch}"
action :nothing
end
puts spec.to_s.inspect
# => "development"
puts configurations.keys.inspect
# => [ "development", "test", "cucumber", "production" ]
puts configurations.keys.include?(spec.to_s)
# => false
@jellybob
jellybob / gist:1063598
Created July 4, 2011 16:42
Broken notifier
require 'rubygems'
require 'gelf'
class GELFHandler < Chef::Handler
attr_reader :notifier
def initialize(server, port, facility)
@notifier = GELF::Notifier.new(server, port, 'WAN', :facility => facility)
end
@jellybob
jellybob / gelf_handler.rb
Created July 4, 2011 17:05
GELF handler for Chef
require 'rubygems'
require 'gelf'
class GELFHandler < Chef::Handler
attr_reader :notifier
def initialize(server, port, facility)
@notifier = GELF::Notifier.new(server, port, 'WAN', :facility => facility)
end
sh -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras
fi
# Install a sane version of gems
cd /tmp
host "chef.example.org" do
ip "192.168.10.1"
aliases [ "chef", "kitchen" ]
comment "The chef server"
end
We couldn’t find that file to show.
@jellybob
jellybob / follow_alert.rb
Created October 26, 2011 13:58
Win "be the nth follower" contests
require 'capybara'
require 'capybara/dsl'
require 'capybara/webkit'
include Capybara::DSL
account = ARGV[0]
count = ARGV[1]
Capybara.current_driver = :webkit
Capybara.app_host = 'http://mobile.twitter.com'
@jellybob
jellybob / gist:1327902
Created October 31, 2011 16:30
Traceroute
traceroute to 193.219.108.20 (193.219.108.20), 64 hops max, 52 byte packets
1 router (192.168.1.1) 1.018 ms 0.612 ms 0.725 ms
2 * * *
3 * 10.1.3.178 (10.1.3.178) 8.365 ms 8.364 ms
4 20ge.bb2.lon1.uk.gbxs.net (195.66.224.231) 7.883 ms 7.640 ms 7.622 ms
5 ohtelecom.vlan899.bb2.lon1.uk.gbxs.net (77.243.178.6) 8.212 ms 7.495 ms 8.612 ms
6 * * *
7 * * *
8 * * *
# ad infinatum