Skip to content

Instantly share code, notes, and snippets.

View nobu666's full-sized avatar

Nobutoshi Ogata nobu666

View GitHub Profile
@nobu666
nobu666 / aws-iam-sync.sh
Last active July 22, 2016 06:45
Sync AWS IAM Users and server users
#!/bin/bash
function create_authorized_keys()
{
if [ $dry_run -eq 1 ]; then
echo "mkdir -p /home/$1/.ssh"
echo "chown $1:$3 /home/$1/.ssh"
echo "chmod 700 /home/$1/.ssh"
echo "echo \"$2\" >> /home/$1/.ssh/authorized_keys"
echo "chown $1:$3 /home/$1/.ssh/authorized_keys"
$ echo '{"time": "2016-04-04T15:51:00Z"}' | jq '.time|fromdate'
1459785060
$ echo '{"time": 1459785060}' | jq '.time|todate'
"2016-04-04T15:51:00Z"
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.
$ declare -A test_
$ test_["hoge"]="moge"
$ echo ${test_["hoge"]}
moge
@nobu666
nobu666 / gist:b3e87b11c25af7056b68
Created January 18, 2016 16:15
Safari9でt.co開けない問題を解決する。bypass入れても夜フクロウからリンク踏むと回避できないのでこうするしかない
curl -I $(pbpaste) | grep location | cut -d' ' -f2 | tr -d '\r' | xargs -I{} open {}
@nobu666
nobu666 / gist:ed917292ef575e155372
Last active August 29, 2015 14:25
branch名と--edit-descriptionでつけた説明を並べて表示する
for branch in $(git for-each-ref --format='%(refname)' refs/heads/ | sed 's|refs/heads/||'); do desc=$(git config branch.$branch.description); if [[ "$branch" == "$(git rev-parse --abbrev-ref HEAD)" ]]; then branch="* \033[0;32m$branch\033[0m"; else branch=" $branch"; fi; echo -e "$branch \033[0;36m$desc\033[0m"; done
2014-04-13 00:31:56:498 1132 17e4 AU <<## SUBMITTED ## AU: Search for updates [CallId = {D58E6635-C702-4748-939A-A2EF7D783F12}]
2014-04-13 00:31:56:498 1132 145c Agent *************
2014-04-13 00:31:56:498 1132 145c Agent ** START ** Agent: Finding updates [CallerId = AutomaticUpdates]
2014-04-13 00:31:56:498 1132 145c Agent *********
2014-04-13 00:31:56:498 1132 145c Agent * Online = No; Ignore download priority = No
2014-04-13 00:31:56:498 1132 145c Agent * Criteria = "IsInstalled=0 and DeploymentAction='Installation' or IsPresent=1 and DeploymentAction='Uninstallation' or IsInstalled=1 and DeploymentAction='Installation' and RebootRequired=1 or IsInstalled=0 and DeploymentAction='Uninstallation' and RebootRequired=1"
2014-04-13 00:31:56:498 1132 145c Agent * ServiceID = {9482F4B4-E343-43B6-B170-9A65BC822C77} Windows Update
2014-04-13 00:31:56:498 1132 145c Agent * Search Scope = {Machine}
2014-04-13 00:31:56:857 1132 1374 AU WARNING: Returning due to error from GetDownloadProgressUx, error = 0x802
@nobu666
nobu666 / gist:5553441
Created May 10, 2013 09:32
IdeaのVM Option
$ cat /Applications/IntelliJ\ IDEA\ 12.app/bin/idea.vmoptions
-Xms1024m
-Xmx2048m
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
@nobu666
nobu666 / gist:5410566
Last active December 16, 2015 09:08
アップデートするたびにLimeChatがやかましくなるのでメモ
$ cat <<EOF >> /Applications/LimeChat.app/Contents/Themes/Limelight.css
.line[type=join] { display:none; }
.line[type=quit] { display:none; }
.line[type=mode] { display:none; }
.line[type=part] { display:none; }
.line[type=nick] { display:none; }
EOF
@nobu666
nobu666 / gist:5114578
Created March 8, 2013 06:21
PostgreSQL replication monitoring
diff -u <(psql DB_NAME -c "select * from pg_current_xlog_location()" -t) <(psql DB_NAME -c "select flush_location from pg_stat_replication" -t)
ls -F | grep / | tr -d '/' | xargs knife cookbook test -o .