Skip to content

Instantly share code, notes, and snippets.

View pvh's full-sized avatar

Peter van Hardenberg pvh

View GitHub Profile

Keybase proof

I hereby claim:

  • I am pvh on github.
  • I am pvh (https://keybase.io/pvh) on keybase.
  • I have a public key whose fingerprint is 1D89 D8E0 2432 9132 67E4 0A9F 920A 0456 2DFF C83D

To claim this, I am signing this object:

pvhbook:bifrost((f8551e6...)) pvh$ bin/bifrost info ruronin
[ ruronin ]
Judo ID : 17wnkw7
Ip : 184.73.174.19
Plan : ronin
CallbackURL :
URL : postgres://w23c56tn748j47:a891myo7zoe815yohbzhjgej4@ec2-184-73-174-19.compute-1.amazonaws.com/w23c56tn748j47
Created At : Tue May 25 11:15:40 -0700 2010
Started At : Tue May 25 11:15:55 -0700 2010
pvhbook:bifrost((f8551e6...)) pvh$ bin/bifrost backup ruronin
diff --git a/lib/swirl/ec2.rb b/lib/swirl/ec2.rb
index 19b2497..ed02b3a 100644
--- a/lib/swirl/ec2.rb
+++ b/lib/swirl/ec2.rb
@@ -35,7 +35,7 @@ module Swirl
end
def escape(value)
- CGI.escape(value).gsub(/\+/, "%20")
+ CGI.escape(value.to_s).gsub(/\+/, "%20")
diff --git a/lib/swirl/ec2.rb b/lib/swirl/ec2.rb
index fd795f5..4f97bf5 100644
--- a/lib/swirl/ec2.rb
+++ b/lib/swirl/ec2.rb
@@ -21,11 +21,11 @@ module Swirl
def initialize(options)
@aws_access_key_id =
- options[:aws_access_key_id] ||
- raise ArgumentError, "no aws_access_key_id provided"
PS1='\h:\W$(__git_ps1 "(%s)") \u\$ '
#!/usr/bin/env ruby
u = URI.parse(ARGV[0])
u.scheme == "postgres" or abort("Must provide a postgres://user:pass@host/dbname form url.")
ENV["PGPASSWORD"] = u.password
cmd = "psql -U #{u.user} -h #{u.host} #{u.path[1..-1]}"
puts cmd
exec cmd
(ns states.core)
(def resource-transitions
{:create
[{:condition #(= (% :ec2-state "pending"))
:transition :booting},
{:condition #(> (* 10 60) (% :created_at050))
:transition :failed}]
require 'spec_helper'
describe Thing do
subject { Thing.new() }
describe "#rating" do
its(:amount) { should == 25 }
end
describe "winning" do
before { subject.win }
module Shogun
module Once
class OnceRecord < Sequel::Model
Sequel.extension :pg_array
DB.extend Sequel::Postgres::PGArray::DatabaseMethods
unrestrict_primary_key
end
def self.ever(*arguments, &blk)
OnceRecord.create(signature: signature(arguments), arguments: arguments.pg_array)
pvh$ bundle exec irb
irb(main):001:0> require 'sequel'
=> true
irb(main):002:0> DB = Sequel.connect("postgres:///")
=> #<Sequel::Postgres::Database: "postgres:///">
irb(main):003:0> DB.extension(:pg_array, :pg_row)
=> #<Sequel::Postgres::Database: "postgres:///">
irb(main):004:0> DB[:databases].select(Sequel::lit('(databases)')).all.first.values.first
=> "(foo,localhost:5432)"
irb(main):005:0>