Skip to content

Instantly share code, notes, and snippets.

View yannlugrin's full-sized avatar

Yann Lugrin yannlugrin

View GitHub Profile
cloud-start -s config/clouds.rb
Starting cloud app (/home/yann/.ec2/testpoolparty)
0 running instances (1 - 1)
/usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:261:in `ec2_error?': The key pair 'testpoolparty' does not exist (EC2::InvalidKeyPairNotFound)
from /usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:199:in `make_request'
from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
from /usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:173:in `make_request'
from /usr/lib/ruby/gems/1.8/gems/grempe-amazon-ec2-0.3.8/lib/EC2.rb:224:in `response_generator'
from /usr/lib/rub
#!/bin/bash
#
# Set our bash prompt according to the branch/status of the current git
# repository.
#
# Forked from http://gist.github.com/31967
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
# >----------------------------[ Initial Setup ]------------------------------<
# generator initializer
initializer 'generators.rb', <<-RUBY
Rails.application.config.generators do |g|
end
RUBY
# say methods
def say_step(name); say "\033[36m" + 'step'.rjust(10) + "\033[0m" + " Running #{name} step..." end
def multi_replace(string, *rules)
scanning_pattern = Regexp.union(rules.map{|e| e.first} | [/./])
string.scan(scanning_pattern).map do |match|
rules.select{|e| match =~ e.first}.flatten.last || match
end.join
end
multi_replace("the first problem is not egal to second problem", [/first problem/, "older problem"], [/second problem/, "first problem"])