This file contains hidden or 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
| # Check this out, rvm use rbx | |
| ruby_block "rvm use rbx" do | |
| block do | |
| Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e| | |
| o.each_line do |line| | |
| env_bits = line.split("=") | |
| ENV[env_bits[0]] = env_bits[1] | |
| end | |
| end |
This file contains hidden or 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 tip(msg); puts; puts msg; puts "-"*100; end | |
| # | |
| # 30 Ruby 1.9 Tips, Tricks & Features: | |
| # http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
| # | |
| tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
| tip "Ruby 1.9 supports named captures in regular expressions!" |
This file contains hidden or 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
| compute.import_key_pair( | |
| 'id_rsa.pub', | |
| File.read('~/.ssh/id_rsa.pub') | |
| ) | |
| compute.authorize_security_group_ingress( | |
| 'CidrIp' => '0.0.0.0/0', | |
| 'FromPort' => 22, | |
| 'IpProtocol' => 'tcp', | |
| 'GroupName' => 'default', |
This file contains hidden or 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
| # via http://blog.zerosum.org/2011/03/02/better-aws-access-control-with-iam-and-fog.html | |
| require 'fog' | |
| username = 'testuser' | |
| bucket = 'uniquebucketname1234' | |
| aws_credentials = { | |
| :aws_access_key_id => 'YOUR-ACCESS-KEY-ID', | |
| :aws_secret_access_key => 'YOUR-SECRET-ACCESS-KEY' |
This file contains hidden or 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
| #!/bin/bash | |
| # from http://www.hilarymason.com/blog/bash-get-http-response-codes-for-a-list-of-urls/ | |
| while read line | |
| do | |
| echo $(curl --write-out %{http_code} --silent --output /dev/null $line) | |
| done <$1 |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # Require gems with versions | |
| begin | |
| require 'logger' | |
| require 'rubygems' | |
| gem 'fog', '~> 0.6.0' | |
| gem 'trollop', '~> 1.16.2' | |
| require 'fog'; require 'trollop' |
This file contains hidden or 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
| gem 'aws-sdk' | |
| require 'rubygems' | |
| require 'aws-sdk' | |
| ec2 = AWS::EC2.new(:access_key_id => nil, | |
| :secret_access_key => nil, | |
| :proxy_uri => ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']) | |
| ec2.regions.each do |region| | |
| reg = ec2.regions[region.name] | |
| reg.instances.each do |instance| |
This file contains hidden or 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
| access_key_id: xxx | |
| secret_access_key: yyy |
This file contains hidden or 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
| aws ec2 describe-images | jq '.Images[] | {name, description}' | |
| aws ec2 describe-instances | jq -c '.Reservations[] | .Instances[] | {InstanceId, InstanceType}' | |
| aws ec2 describe-instances | jq -c '.Reservations[] | .Instances[] | {InstanceId, InstanceType, PublicIpAddress}' |
This file contains hidden or 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 'aws-sdk' | |
| require 'yaml' | |
| tag_name = ARGV.shift | |
| tag_values = ARGV | |
| AWS.config(YAML.load_file('config.yml')) | |
| p AWS::EC2.new.instances.tagged(tag_name).tagged_values(tag_values).map {|instance| | |
| instance.public_dns_name | |
| }.join(" ") |