http://www.zusaar.com/event/1377006
http://blog.stanaka.org/entry/2013/12/01/092642
https://speakerdeck.com/smly/influxdb-and-leveldb-inside-out
| #!/usr/bin/env ruby | |
| require 'json' | |
| require 'terminal-table' | |
| def cpu_to_milli(cpu) | |
| if cpu =~ /\A(\d+)m\z/ | |
| return $1.to_i | |
| end | |
| return cpu.to_i * 1000 | |
| end |
| // ==UserScript== | |
| // @name AWS Console Header Color | |
| // @namespace http://ryotarai.info/ | |
| // @version 0.1 | |
| // @description Change color of header | |
| // @author Ryota Arai | |
| // @match https://*.console.aws.amazon.com/* | |
| // @grant none | |
| // ==/UserScript== |
| #!/usr/bin/env ruby | |
| require 'json' | |
| require 'shellwords' | |
| cid = ARGV[0] | |
| JSON.parse(`docker inspect #{cid}`).each do |c| | |
| config = c['Config'] | |
| args = %w!docker run -it! | |
| config['Env'].each do |e| |
| require 'ffi' | |
| vendor_id = 3141 | |
| product_id = 29697 | |
| module HidApi | |
| extend FFI::Library | |
| ffi_lib 'hidapi' | |
| attach_function :hid_open, [:int, :int, :int], :pointer |
| // ==UserScript== | |
| // @name Larger SG Selector | |
| // @namespace http://ryotarai.info/ | |
| // @version 0.1 | |
| // @description Why is it too small? | |
| // @author Ryota Arai | |
| // @match https://*.console.aws.amazon.com/* | |
| // @grant none | |
| // ==/UserScript== |
| data = [] | |
| columns = [] | |
| ARGF.each_line do |line| | |
| data << Hash[line.split("\t").map do |kv| | |
| k, v = kv.split(':', 2) | |
| columns << k unless columns.include?(k) | |
| [k, v] | |
| end] |
| # Gemfile | |
| gem 'better_errors' | |
| gem 'binding_of_caller' | |
| # config/application.rb | |
| module BetterErrors | |
| class Railtie < Rails::Railtie | |
| def use_better_errors? | |
| return true if ENV['BETTER_ERRORS'] | |
| !Rails.env.production? and app.config.consider_all_requests_local |
| require 'open-uri' | |
| region = ARGV.first | |
| unless region | |
| puts "usage: ruby get-aws-status-rss.rb ap-northeast-1" | |
| end | |
| source = open("http://status.aws.amazon.com/") {|f| f.read } | |
| source.scan(/'(\w+-#{region})'/) do |match| |