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 'beanstalk-client.rb' | |
require 'ruby-debug' | |
DEFAULT_PORT = 11300 | |
SERVER_IP = '127.0.0.1' | |
#beanstalk will order the queues based on priority, with the same priority | |
#it acts FIFO, in a later example we will use the priority | |
#(higher numbers are higher priority) | |
DEFAULT_PRIORITY = 65536 | |
#TTR is time for the job to reappear on the queue. |
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 'sinatra' | |
EC2_HOME = '~/.ec2' | |
use Rack::Auth::Basic do |username, password| | |
[username, password] == ['some_user', 'some_pass'] | |
end | |
get "/" do | |
@links = %w{describe_ec2s restart_all_ec2s shutdown_all_ec2s}.map { |cmd| |
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 'rubygems' | |
require 'tlsmail' | |
require 'time' | |
content = <<EOF | |
From: cruise@devver.net | |
To: contact@devver.net | |
Subject: Hello! | |
Date: #{Time.now.rfc2822} | |
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
def run_spellcheck(file,interactive=false) | |
if interactive | |
cmd = "aspell -p ./config/devver_dictionary -H check #{file}" | |
puts cmd | |
system(cmd) | |
[true,""] | |
else | |
cmd = "aspell -p ./config/devver_dictionary -H list < #{file}" | |
puts cmd | |
results = `#{cmd}` |
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 'rubygems' | |
require 'dm-core' | |
require 'aws_sdb' | |
require 'digest/sha1' | |
require 'dm-aggregates' | |
module DataMapper | |
module Adapters | |
class SimpleDBAdapter < AbstractAdapter |
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
desc "Perform some benchmarking against the production site" | |
task :benchmark do | |
puts "starting benchmarking" | |
fork_and_print("ab -c 100 -t 130 -n 1000 -r http://site.com/") | |
fork_and_print("ab -c 100 -t 130 -n 1000 -r http://site.com/contact") | |
fork_and_print("ab -c 100 -t 130 -n 1000 -r http://site.com/documentation/how_it_works") | |
fork_and_print("ab -c 100 -t 130 -n 1000 -r http://site.com/documentation/installt") | |
Process.waitall | |
puts "benchmarking complete" |
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
dan-mayers-computer:dm-adapter-simpledb dmayer$ time rake spec_no_rcov | |
(in /Users/dmayer/projects/dm-adapter-simpledb) | |
I, [2009-06-12T10:40:02.098438 #21481] INFO -- : New RightAws::SdbInterface using single-threaded mode | |
I, [2009-06-12T10:40:02.120265 #21481] INFO -- : Opening new HTTPS connection to sdb.amazonaws.com:443 | |
warning: peer certificate won't be verified in this SSL session | |
..*...........*.*.......**......***** | |
Pending: | |
with nils records saved and retreived should find based on nil values (Not Yet Implemented) |
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
#new right_aws branch using AWS select | |
dan-mayers-computer:dm-adapter-simpledb dmayer$ ruby scripts/simple_benchmark.rb | |
I, [2009-06-17T16:53:27.007866 #33498] INFO -- : New RightAws::SdbInterface using single-threaded mode | |
I, [2009-06-17T16:53:27.009036 #33498] INFO -- : Opening new HTTPS connection to sdb.amazonaws.com:443 | |
warning: peer certificate won't be verified in this SSL session | |
user system total real | |
creating 200 users 1.020000 0.240000 1.260000 ( 35.715608) | |
Finding all users age 25 (all of them), 100 Times 59.280000 8.640000 67.920000 ( 99.727380) | |
#old aws_sdb using query with attributes |
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
#new right_aws branch using AWS select | |
$ ruby scripts/simple_benchmark.rb | |
user system total real | |
creating 200 users | |
1.020000 0.240000 1.260000 ( 35.715608) | |
Finding all users age 25 (all of them), 100 Times | |
59.280000 8.640000 67.920000 ( 99.727380) | |
#old aws_sdb using query with attributes | |
$ ruby scripts/simple_benchmark.rb |
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
### in response to http://drawohara.com/post/151193800/ruby-symbol-to-hash | |
#I think that isn't quite what I am talking about... | |
#I want | |
this = 5 | |
that = 6 | |
foo = "bar" | |
long_stupid_variable_name = "I love Python ;)" | |
hash_real = {:this => this, :that => that, :foo => foo, :long_stupid_variable_name => long_stupid_variable_name} |
OlderNewer