This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem 'rspec' | |
gem 'aruba', :require => 'aruba/api' | |
gem 'test-construct', :require => 'construct' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% line_chart value:calls_per_minute regexp:'Database/Redis/[b-z].*' title:'CPM' %} | |
{% line_chart value:average_value regexp:'Database/Redis/[b-z].*' title:'Average Time' %} | |
{% line_chart value:max_value regexp:'Database/Redis/[b-z].*' title:'Max Time' %} | |
{% line_chart value:calls_per_minute regexp:'Database/Redis/allWeb' title:'Redis Web CPM' %} | |
{% line_chart value:calls_per_minute regexp:'Database/Redis/allOther' title:'Redis Background CPM' %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server 'localhost', :test | |
server '127.0.0.1', :test2 | |
task :test_serially do | |
serially do | |
run 'date && sleep 5' | |
end | |
end | |
def serially(&block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :cowboy do | |
desc 'Deploy without SCM' | |
task :default do | |
deploy_stage = fetch(:stage, 'none') | |
set :repository, "." | |
set :deploy_via, :copy | |
set :scm, :none | |
set :stage, deploy_stage | |
set :cowboy_deploy, true | |
set :copy_exclude, [".git/*", ".svn/*", "log/*", "vendor/bundle/*"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# estimate the duration of an ALTER TABLE statement in mysql | |
# this code estimates the worst case, as most of the time, an ALTER will result in a table that is smaller than the original | |
percentage = 0 | |
interval = 10 | |
while(true) do | |
begin | |
sleep(interval) | |
new_percentage = (File.size('#sql-137f_5dee5a6.ibd')*1.0 / File.size('users.ibd')*1.0) | |
change = new_percentage - percentage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'webrick' | |
require 'webrick/httpproxy' | |
require 'fileutils' | |
require 'md5' | |
### | |
# FakeWebRecorder is an HTTP Proxy that records sessions as calls to FakeWeb. | |
# The code that FakeWebRecorder generates should be suitable for testing | |
# interaction with a particular website. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apache2 Status by Hampton Catlin | |
# | |
# Free Use Under the MIT License | |
# | |
# Please note, your server must respond to "apache2ctl status" | |
# | |
class Apache2Status < Scout::Plugin | |
OPTIONS=<<-EOS | |
sample_size: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
up = !sh -c 'git pull && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires Cramp 0.8+ | |
require 'rubygems' | |
require 'usher' | |
require 'cramp/controller' | |
Cramp::Controller::Websocket.backend = :thin | |
class WebsockAction < Cramp::Controller::Websocket | |
periodic_timer :send_hello_world, :every => 2 | |
on_data :received_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JsonHax | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if env['CONTENT_TYPE'] == 'application/json' | |
env['CONTENT_TYPE'] = 'application/xml' | |
env['REQUEST_URI'].gsub!(/\.json/, '.xml') |