Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Upgrade to rspec-rails 2.2.2
# response.headers["Status"].should == "201 Created" does not work any more
# response.status.should == "201 Created" does work now
#
# find all controllers specs which contains response.headers["Status"].should
# sort them
# and remove duplications
for c in `grep 'Status' -r spec/controllers | grep 'response.headers' | cut -d':' -f1 | sort | uniq`
#!/usr/bin/env ruby
#
# Detect the models which are associated with non existing account.
#
# Usage:
# $ cd RAILS_ROOT
# $ RAILS_ENV=test ./check-assoc
#
require 'config/environment'
@mhorbul
mhorbul / gist:115626
Created May 21, 2009 18:44
Clean up the remote branches according to the Unfuddle Reports
# Maksim Horbul
#
# clean up the remote branches according to the Unfuddle Reports
#
require 'rubygems'
require 'feed-normalizer'
require 'net/http'
require 'net/https'
#!/bin/bash
# -*- shell -*-
sudo su -
#
# Audio: fix ubuntu 9.04 broken sound
#
apt-get install build-essential xmlto libncurses5-dev
require 'mq'
class Foo
def run
setup_queue
setup_recovering(@recover_timeout)
setup_subscription
end
#!/bin/bash
# Maksim Horbul
# - Setup Ruby/Rails environment on OSX Leopard
sudo su -
# setup MySQL Server
MYSQL_VERSION=5.1.36
cd /tmp
wget -O - http://opensource.become.com/mysql/Downloads/MySQL-5.1/mysql-$MYSQL_VERSION.tar.gz \
class MySingleton
@@a = 0
self.class_eval do
def a=(v); @@a = v; end
def a; @@a; end
end
end
puts MySingleton.a # => 0
MySingleton.a = 1
bash # erl -sname foo -setcookie `cat /var/run/rabbitmq/.erlang.cookie` -remsh rabbit@<vhostname>
# Once inside the erlang shell, use:
erl> rabbit_amqqueue:stat_all().
# Find the queue name you need. If it's the first one on the list, for example, use this:
erl> {ok, Worker, _, _} = lists:nth(1,rabbit_amqqueue:stat_all()).
erl> {ok, Q} = rabbit_amqqueue:lookup(Worker).
# Purge the particular queue
require 'mq'
[
{:host => "localhost", :port => "5671"},
{:host => "localhost", :port => "5672"}
].each do |options|
begin
puts options.inspect
@conn = AMQP.start(options) do
puts "connected"
#!/bin/bash
#
# Usage: deploy-gem.sh remote-host-name gem-name [branch]
#
# NOTE: you can provide more than one remote hosts like
# deploy-gem.sh rhost1,rhost2,rhost3 gem-name [branch]
#
# if the branch is provided in the the following format 'master'
# the sonian repository git@github.com:sonain/<gem-name>.git will be used
#