Skip to content

Instantly share code, notes, and snippets.

kowsik / gh-campfire.rb
Created Mar 22, 2012
Quick script to go through a bunch of GitHub repos and add campfire notification to them. Turns out campfire notifications created in the past only have the 'push' event in them.
View gh-campfire.rb
require 'rubygems'
require 'json/ext'
require 'restclient'
require 'pp'
# You'll need to define the following variables and of course change
# 'mudynamics' to your organization name
# user, password (for GitHub credentials)
# room, subdomain, token (your Campfire settings)
kowsik / gist:1628665
Created Jan 17, 2012
Monkey patch CouchRest for supporting redis caching
View gist:1628665
class CouchRest::Database
alias :old_save_doc :save_doc
alias :old_delete_doc :delete_doc
attr_writer :rcache
# Automatically add the created_at and updated_at time fields to the
# document and also save it back to redis with a ttl.
def save_doc doc, bulk = false, batch = false
doc['created_at'] ||=
doc['updated_at'] =
kowsik / gist:1628449
Created Jan 17, 2012
Using Redis Transactions with CouchDB
View gist:1628449
def incr_site_stats engine, stats
# Increment the site:stats counters (in redis). We use 'created_at'
# to checkpoint the time we created these stats
redis.multi do
redis.hsetnx 'site:stats', 'created_at',
stats.each_pair do |k, v|
redis.hincrby 'site:stats', k, v.to_i
kowsik / couchdb.conf
Created Sep 2, 2011
Upstart script for CouchDB
View couchdb.conf
start on runlevel [2345]
exec su -s /bin/sh -c 'exec "$0" "$@"' couchdb -- /mnt/couch/bin/couchdb
respawn limit 10 5
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
export BUILD_DIR="$PWD"

Node Knockout with

What's, powered by Mu Dynamics, is a self-service load and performance testing platform. Built for API, cloud, web and mobile application developers, quickly and inexpensively helps you ensure performance and scalabilty. And we make this super fun.

Why Load Test?

kowsik / blitz.scale.tropo.rb
Created Apr 22, 2011
Using and Tropo for scheduled load tests and alerting
View blitz.scale.tropo.rb
# Try running a Rush (load test) from california
opts = {
:region => 'california',
:url => '',
:pattern => [{ :start => 1, :end => 10000, :duration => 120 }]
result = Blitz::Curl::Rush.execute(opts)
last = result.timeline.last
if last.errors or last.timeouts
# Do something about this!
kowsik / blitz.tropo.rb
Created Apr 22, 2011
Using and Tropo for easy Application Monitoring
View blitz.tropo.rb
require 'rubygems'
require 'restclient'
require 'blitz'
require 'pp'
kowsik / blitz.rb
Created Apr 20, 2011
Integrate Blitz into your test frameworks
View blitz.rb
require 'rubygems'
require 'blitz'
require 'pp'
# Run a sprint
require 'blitz'
sprint = Blitz::Curl.parse('-r california')
result = sprint.execute
pp :duration => result.duration
View gist:792862
loop do
76.times do |i|
print " " * i
print "o"
print "\r"
sleep 0.05
76.times do |i|
You can’t perform that action at this time.