Skip to content

Instantly share code, notes, and snippets.

kowsik kowsik

Block or report user

Report or block kowsik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kowsik
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
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'] ||= Time.now
doc['updated_at'] = Time.now
@kowsik
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', Time.now.utc.to_string
stats.each_pair do |k, v|
redis.hincrby 'site:stats', k, v.to_i
end
end
@kowsik
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
respawn limit 10 5
View couchdb-ec2-install.sh
#!/bin/bash
#
# 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"
View nko-blitz.md

Node Knockout with blitz.io

blitz.io

What's blitz.io?

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

Why Load Test?

@kowsik
kowsik / blitz.scale.tropo.rb
Created Apr 22, 2011
Using blitz.io 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 => 'http://www.mudynamics.com',
: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
kowsik / blitz.tropo.rb
Created Apr 22, 2011
Using blitz.io and Tropo for easy Application Monitoring
View blitz.tropo.rb
require 'rubygems'
require 'restclient'
require 'blitz'
require 'pp'
TROPO_USER = ENV['TROPO_USER']
TROPO_PASS = ENV['TROPO_PASS']
TROPO_APIK = ENV['TROPO_APIK']
TROPO_CALL = ENV['TROPO_CALL']
@kowsik
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 www.example.com')
result = sprint.execute
pp :duration => result.duration
View gist:792862
loop do
76.times do |i|
print " " * i
print "o"
print "\r"
$stdout.flush
sleep 0.05
end
76.times do |i|
You can’t perform that action at this time.