I hereby claim:
- I am mndoci on github.
- I am mndoci (https://keybase.io/mndoci) on keybase.
- I have a public key whose fingerprint is 3AD7 E277 F8AB 9D56 A881 59FD E7CA 6BFD 380B 2456
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
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(" ") |
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}' |
access_key_id: xxx | |
secret_access_key: yyy |
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| |
#!/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' |
#!/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 |
# 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' |
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', |
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!" |