Skip to content

Instantly share code, notes, and snippets.

View kawaz's full-sized avatar
🏠
Working from home

Yoshiaki Kawazu kawaz

🏠
Working from home
View GitHub Profile
#!/bin/bash
set -e
sudo yum -y install git gcc openssl-devel automake
cd $(mktemp -d)
git clone https://github.com/JoeDog/siege.git .
./utils/bootstrap
./configure
make
sudo make install
@kawaz
kawaz / put-alarms-for-ELB-HealthyHost-Disapeared.sh
Created November 11, 2016 14:35
ELBのインスタンス数チェックアラームの作成
#!/bin/bash
region="ap-northeast-1"
actions="arn:aws:sns:ap-northeast-1:123456789012:AlertMe"
for elb in $(aws elb describe-load-balancers | jq -r '.LoadBalancerDescriptions[].LoadBalancerName'); do
aws cloudwatch put-metric-alarm \
--region "$region" \
--alarm-name "$name-ELB-HealthyHost-Disapeared-Alarm" \
--alarm-description "CreateFromCLI" \
#!/bin/bash
set -e
brew install sanemat/font/ricty --with-powerline
/bin/cp /usr/local/opt/ricty/share/fonts/Ricty*.ttf ~/Library/Fonts
fc-cache -vf # 何か入力待ちみたいな表示が出るが待ってればよいだけなので気にしちゃだめ
brew uninstall ricty # フォントさえ手に入ってしまえば不要なので削除
@kawaz
kawaz / create-ses-password.sh
Last active June 13, 2017 04:50
AWSの通常のIAMユーザのシークレットをSESのSMTPパスワードに変換するスクリプト
#!/bin/bash
if [[ -z $1 ]]; then
echo "Usage: $0 AWS_SECRET_ACCESS_KEY"
echo "Convert AWS_SECRET_ACCESS_KEY to the ses password."
exit 1
fi
HMAC_BIN=$(echo -n SendRawEmail | openssl dgst -binary -sha256 -hmac "$1")
printf '\02%s' "$HMAC_BIN" | openssl base64
@kawaz
kawaz / unti-unti-console-log.user.js
Last active July 25, 2017 06:03
Twitterでconsole.logが潰されてて腹立ったので直した。
// ==UserScript==
// @name unti-unti-console-log
// @namespace https://twitter.com/kawaz/status/889484844702457856
// @version 0.1
// @description Revive the sealed console
// @author Yoshiaki Kawazu ( https://twitter.com/kawaz )
// @match https://twitter.com/*
// @grant unsafeWindow
// ==/UserScript==
{
@kawaz
kawaz / setusergroups
Last active August 26, 2017 22:12 — forked from kazuho/setusergroups
setuidgid w. support for supplementary groups
#! /usr/bin/perl
# https://gist.github.com/kawaz/3e423b0fc6eda643f1f5e11c8f5e0eca
use POSIX qw(setuid setgid);
use Unix::Groups qw(setgroups);
die "usage: setusergroups username child\n"
unless @ARGV >= 2;
my $username = shift @ARGV;
@kawaz
kawaz / install.sh
Last active October 15, 2017 14:52
Install the driver of USB WiFi WN-AC433UMW on Ubuntu
#!/bin/bash
sudo apt-get install git linux-headers-generic build-essential dkms
git co https://github.com/Mange/rtl8192eu-linux-driver.git
cd rtl8192eu-linux-driver
sudo dkms add .
git apply <(curl -sL https://gist.github.com/kawaz/6f2dcb707430b13e4db66a69b1fb91f0/raw/aeee0a55ea44bb7751931f181bc5ca8c62290891/rtl8192eu-linux-driver.5a62f24..7138a26.diff)
sudo dkms install rtl8192eu/1.0
# If already installed, use
# sudo dkms remove rtl8192eu/1.0 --all
@kawaz
kawaz / z.sh
Created November 17, 2017 22:38
bash utils
z.now() { date +%s; }
z.uptime() { echo $(($(z.now) - $(date -d "$(uptime -s)" +%s))); }
@kawaz
kawaz / plaubook-install-docker.yml
Created September 21, 2018 02:23
Dockerを入れるプレイブック。docker-compose とか最新バージョンを取れるようにした。
- hosts: all
become: yes
tags: docker
tasks:
- name: docker install
block:
- name: install docker
yum: name=docker
- name: enable service (upstart)
service: name=docker state=started enabled=yes
#!/bin/bash
brew tap mscharley/homebrew
brew install --HEAD alacritty
ln -s /usr/local/opt/alacritty/Applications/Alacritty.app /Applications/