Skip to content

Instantly share code, notes, and snippets.

du -hs `gem env gemdir`/doc
# 465M /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/doc
sudo rm -r `gem env gemdir`/doc
echo 'gem: --no-ri --no-rdoc' >> ~/.gemrc
@joakimk
joakimk / livereload.rake
Created November 17, 2010 20:41
A simple rakefile to run livereload and generate css from the sass (scss) files specified in asset_packages.yml.
desc "Continuously watch for changes and rebuild files"
task :livereload do
pids = `ps ax|grep ruby|grep livereload|awk '{ print $1 }'`.split
other_pids = pids.reject { |pid| Process.pid == pid.to_i }
system "kill #{other_pids.join(' ')} &> /dev/null"
system "nohup livereload &> /dev/null &"
require 'rubygems'
require 'fssm'
@joakimk
joakimk / install.sh
Created November 21, 2010 14:01
Install script for Apache+REE+Passenger 3 on Ubuntu 10.04 64bit
# Install script for Apache+REE+Passenger 3 on Ubuntu 10.04 64bit
# BEFORE:
# - Make sure you are logged as a non-root user that can sudo.
# - Add your key here:
SSH_KEY="ssh-rsa ..."
# Add key to admin user
mkdir -p .ssh && echo "$SSH_KEY" >> .ssh/authorized_keys || exit 1
@joakimk
joakimk / quick_ruby_env.sh
Created November 24, 2010 19:35
Quickly installing a ruby environment on ubuntu that supports testbot
sudo apt-get update && sudo apt-get install build-essential vim ruby ruby-dev libsqlite3-dev && wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz && tar xvfz rubygems-1.3.7.tgz && cd rubygems-1.3.7 && sudo ruby setup.rb && sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
namespace :testbot do
task :before_request do
# This is run after you start a request (ex: rake testbot:spec)
end
task :before_run do
# This is run by the runner after files are synced but before tests are run
# Example: Setting up a test database
database_yml = <<-DB_CONFIG
# Which server to use.
server_host: 192.168.1.10
# server_user: testbot
# Project prefix. Used for prefixing project files
# so that you can run multiple projects in the same testbot network.
# project: project
# RSync settings. The folder where your files are synced to
# and then fetched from before running the tests.
@joakimk
joakimk / gist:720660
Created November 29, 2010 21:30
Benchmark notes, testbot @ EC2

Most cost effective instance type?

I did a bit of benchmarking using our rspec suite and the most cost effective flavor seems to be "c1.medium". It's almost twice as fast as s1.small but still has the same per-core price. The micro instances were about 4 times slower than c1.medium.

The c1.xlarge instance did not perform better than c1.medium (actually worse) and costs as much per core.

I did not try the cluster nodes as they require you to create your own image to use it.

{
"run_list": [
"role[base]",
"role[staging]"
]
}
project user$ rake testbot:features --trace
(in /Users/user/project)
** Invoke testbot:features (first_time)
** Execute testbot:features
** Invoke testbot:before_request (first_time)
** Invoke testbot:prepare_config (first_time)
** Execute testbot:prepare_config
** Execute testbot:before_request
rake aborted!
undefined method `map' for nil:NilClass
@joakimk
joakimk / vagrant_version_checks.rb
Created March 23, 2011 15:41
Some code we use to ensure that we all use the same VirtualBox and vagrant versions.
REQUIRED_VERSION = "0.7.2"
REQUIRED_VIRTUALBOX_VERSION = "4.0.2"
#Vagrant::Config.run do |config|
# ...
#end
# Ensure a compatible Vagrant and VirtualBox versions.
INSTALL_CMD = "gem uninstall vagrant -a -x &> /dev/null &&" +
"gem install vagrant -v #{REQUIRED_VERSION} --no-ri --no-rdoc &>/dev/null"