Skip to content

Instantly share code, notes, and snippets.

View brynary's full-sized avatar

Bryan Helmkamp brynary

View GitHub Profile
1)
Ar#replace adds a file FAILED
Expected ["d", Tue Feb 19 23:00:40 UTC 2008, 170329, 695410, 2693, " `\ndog\n"]
to equal ["d", Tue Feb 19 18:00:40 -0500 2008, 1703296954, 1052059314, 420, "dog\n"]
main.__script__ {} at spec/core/ar/replace_spec.rb:29
Kernel(Object)#instance_eval at kernel/common/eval.rb:158
Enumerable(Array)#all? {} at kernel/common/enumerable.rb:267
Array#each at kernel/bootstrap/array.rb:156
Enumerable(Array)#all? at kernel/common/enumerable.rb:267
require "jruby"
module GC
import "java.lang.management.ManagementFactory"
def self.time
mbeans.map(&:collection_time).inject { |sum, element| sum + element } * 1_000 # convert to usec
end
def self.collections
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, make this file executable.
# This is slightly modified from Andrew Morton's Perfect Patch.
@brynary
brynary / gist:266890
Created December 31, 2009 20:19
chef-client install on EC2
sudo apt-get update
sudo env DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential zlib1g-dev libxml2-dev wget ssl-cert git-core
echo "gem: --no-rdoc --no-ri" >> ~/.gemrc
cd /tmp && wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar zxf rubygems-1.3.5.tgz && cd rubygems-1.3.5
sudo ruby setup.rb --no-ri --no-rdoc
sudo ln -sfv /usr/bin/gem1.8 /usr/bin/gem
sudo gem install rake rspec
cd && mkdir src && cd src
# ec2-run-instances -k <key_name> ami-1515f67c
# Needed to be able to get Java packages later
sudo sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
sudo apt-get update
sudo env DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
# Accept the Sun Java license
echo 'sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true' | sudo debconf-set-selections
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential zlib1g-dev libxml2-dev wget ssl-cert git-core couchdb rabbitmq-server sun-java6-jdk sun-java6-jre
log_level :info
log_location "/var/log/chef/client.log"
ssl_verify_mode :verify_none
registration_url "http://localhost:4000"
template_url "http://localhost:4000"
remotefile_url "http://localhost:4000"
search_url "http://localhost:4000"
role_url "http://localhost:4000"
client_url "http://localhost:4000"
# Chef Client Config File
# Automatically grabs configuration from ohai ec2 metadata.
require 'ohai'
require 'json'
o = Ohai::System.new
o.all_plugins
chef_config = JSON.parse(o[:ec2][:userdata])
if chef_config.kind_of?(Array)
root@domU-12-31-39-0A-95-71:~/src/chef/chef-solr# rake install
(in /root/src/chef/chef-solr)
Generated: chef-solr.gemspec
chef-solr.gemspec is valid.
WARNING: no description specified
WARNING: no rubyforge_project specified
Successfully built RubyGem
Name: chef-solr
Version: 0.8.0
File: chef-solr-0.8.0.gem
# ec2 ami-1515f67c
sudo sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert rubygems git-core rake librspec-ruby libxml-ruby thin couchdb
sudo gem sources -a http://gems.opscode.com
sudo gem sources -a http://gemcutter.org # for nanite
sudo gem install cucumber merb-core nanite jeweler uuidtools json --no-ri --no-rdoc
mkdir ~/src
cd ~/src
git clone git://github.com/opscode/chef.git
Executing "gem1.8 install ./pkg/chef-solr-0.8.0.gem":
gem1.8 install ./pkg/chef-solr-0.8.0.gem
Building native extensions. This could take a while...
ERROR: Error installing ./pkg/chef-solr-0.8.0.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... no