Skip to content

Instantly share code, notes, and snippets.

@ryotarai
ryotarai / README.md
Last active August 17, 2020 14:30
git-commit && change committer and author automatically

git-commit-auto

  1. Clone
$ git clone http://gist.github.com/5675296.git /path/to/somewhere
$ echo 'export PATH="/path/to/somewhere:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
@ryotarai
ryotarai / larger-sg-selector.user.js
Last active August 14, 2019 19:12
Larger Security Group selector (AWS RDS and Elasticache / tested with Tampermonkey)
// ==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==
#!/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
@ryotarai
ryotarai / disable_spdy_chrome.sh
Last active July 18, 2018 14:27
Disable SPDY of Google Chrome
#!/bin/sh
CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
if [ -f "${CHROME}.orig" ]; then
echo "Spdy already seems to be disable" >&2
exit 1
fi
mv "$CHROME" "${CHROME}.orig"
cat <<EOC > "$CHROME"
// ==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
@ryotarai
ryotarai / gist:7743407
Last active December 29, 2015 23:29
Monitoring Casual Talk in Kyoto の スライド
@ryotarai
ryotarai / Google Chrome.zip
Last active December 27, 2015 16:29
Google Chrome without SPDY
@ryotarai
ryotarai / mina_execute_as.rb
Created September 20, 2013 04:13
mina 'execute_as' patch
module Mina
module SshHelpers
def ssh(cmd, options={})
require 'shellwords'
cmd = cmd.join("\n") if cmd.is_a?(Array)
# monkey patch
cmd = "sudo -u #{Shellwords.escape(execute_as)} bash -c #{Shellwords.escape(cmd)}" if execute_as?
# end
script = Shellwords.escape(cmd)