Skip to content

Instantly share code, notes, and snippets.

# $HOME/.aws_util
#
# source this file in .bashrc or .zshrc
lsec2s () {
aws ec2 describe-instances --filter "Name=instance-state-name,Values=running" --query 'Reservations[].Instances[].{ id: InstanceId, name: Tags[?Key==`Name`].[Value][0][0], role: Tags[?Key==`Role`].[Value][0][0], ip: PrivateIpAddress }'
}
lsname () {
lsec2s | jq "[.[] | select(.name == \"$1\") | .ip]" | jq -r ".[]"
#!/bin/sh
nextToken=
while [ "$nextToken" != "null" ]; do
if [ -z "$nextToken" ]; then
exArgs=
else
exArgs="--next-token $nextToken"
fi
res=`aws ssm describe-parameters --max-results 50 $exArgs`
@saidie
saidie / keymap.txt
Last active April 12, 2017 01:20
A Mozc keymap config that replaces all IME On/Off keys in the default setting with Ctrl+\
status key command
DirectInput Ctrl \ IMEOn
Composition Backspace Backspace
Composition Ctrl Backspace Backspace
Composition Ctrl h Backspace
Composition Shift Backspace Backspace
Composition Ctrl z Cancel
Composition ESC Cancel
Composition Shift ESC Cancel
Conversion Backspace Cancel
#!/bin/sh
adb push hosts /data/local/tmp
adb shell "su -c 'mount -orw,remount /system'"
adb shell "su -c 'cp /data/local/tmp/hosts /system/etc/hosts'"
adb shell "su -c 'mount -oro,remount /system'"
lsips () {
aws ec2 describe-instances $@ --query "Reservations[].Instances[].PrivateIpAddress"
}
lsfilters () {
lsips --filters $@
}
lstag () {
lsfilters "Name=tag-key,Values=$1" "Name=tag-value,Values=$2"
@saidie
saidie / ghpr.el
Last active December 24, 2015 13:56
Command to create GitHub pull-request by hub command
(defun create-github-pull-request ()
(interactive)
(let ((buffer (get-buffer-create "*hub pull-request*"))
(cwd default-directory)
(my-local-map (make-keymap)))
(define-key my-local-map (kbd "C-c C-k")
'(lambda ()
(interactive)
(kill-buffer (current-buffer))))
@saidie
saidie / Gemfile
Last active August 16, 2016 00:14
Convert Pocket export file for org-mode
source "https://rubygems.org"
gem "nokogiri"
gem "open_uri_redirections"
@saidie
saidie / fluentd.service
Created October 5, 2014 12:32
Fluentd service file for systemd
[Unit]
Description=Fluentd
Documentation=http://www.fluentd.org/
After=network.target
[Service]
Type=forking
ExecStart=/usr/bin/fluentd -d /run/fluentd.pid
PIDFile=/run/fluentd.pid
Restart=on-failure
@saidie
saidie / GtkIconList.hs
Created August 24, 2013 08:33
Haskell code which shows GTK default theme icons.
module Main
( main
) where
import Control.Monad (filterM)
import Data.Maybe (fromJust)
import Graphics.UI.Gtk
import qualified Graphics.UI.Gtk.ModelView