- 指定されたEBSボリュームのスナップショットを作成する。
- 指定があった場合は指定された世代数を残して過去のスナップショットを削除する
- 以下のようにしてスクリプトを取得する。もしくは、downloadして解凍。
$ git clone https://gist.github.com/4248981.git
require 'aws-sdk' | |
cw = AWS::CloudWatch.new(:proxy_uri => ENV['HTTP_PROXY'] || ENV['http_proxy']) | |
cw.metrics.filter('metric_name', 'EstimatedCharges').each do |m| | |
service_name = m.dimensions.find { |x| x[:name] == 'ServiceName' } | |
service_name = service_name ? service_name[:value] : "Total" | |
stats = m.statistics( | |
:start_time => Time.now - 24 * 3600, | |
:end_time => Time.now, | |
:statistics => ['Maximum'] |
require 'net/http' | |
require 'uri' | |
require 'optparse' | |
server = nil | |
port = 443 | |
ca_file = nil | |
opt = OptionParser.new | |
opt.on('-s', '--server=VAL') { |v| server = v } |
require 'rubygems' | |
require 'zipruby' | |
outdir = "test" | |
Zip::Archive.open('hoge.zip', Zip::CREATE) do |arc| | |
arc.add_file('test.txt') | |
arc.encrypt('password') | |
end |
# A sample Gemfile | |
source "http://rubygems.org" | |
# gem "rails" | |
gem "activesupport" | |
gem "tzinfo" |
javascript:(function(){t%20=%20prompt("JIRA%E8%AA%B2%E9%A1%8C%20number","");if(t!==""&&t!==null){location.href%20=%20"http://example.com/jira/browse/"%20+%20t.replace(/^#/,"")}else%20if(t==""){location.href%20=%20"http://example.com/jira/"}})(); |
require 'openssl' | |
require 'base64' | |
# openssl genrsa -out ./id_rsa で作成 | |
private_key = nil | |
File.open("id_rsa") do |f| | |
private_key = OpenSSL::PKey::RSA.new(f) | |
end | |
# openssl rsa -in id_rsa -pubout -out id_rsa_pub で作成 |
# A sample Gemfile | |
source "https://rubygems.org" | |
gem 'rubix' | |
gem 'zabbixapi' | |
gem 'zabby' | |
gem 'zbxapi' |
$ ruby get_value_from_cloudwatch.rb --help
Usage: get_value_from_cloudwatch [options]
--endpoint=VAL default:us-east-1, us-east-1/us-west-2/us-west-1/eu-west-1/ap-southeast-1/ap-southeast-2/ap-northeast-1/sa-east-1
--namespace=VAL
--metric-name=VAL
--no-exist-dimensions
--dimension=VAL format:: or ~