Skip to content

Instantly share code, notes, and snippets.

View saitara's full-sized avatar

Yasuyuki SAITARA Saito saitara

View GitHub Profile
@saitara
saitara / file0.txt
Created August 24, 2015 15:06
kickstartで作業用アカウントを設定する ref: http://qiita.com/saitara/items/6a52592cd257e6403459
user --name=cloudpack --uid=500 --groups=cloudpack,wheel --password=cloudpack
@saitara
saitara / file0.txt
Created August 24, 2015 04:25
Piculetで出力された情報より、SecurityGroup別のファイルへ分割するワンライナー ref: http://qiita.com/saitara/items/7f0c4d582fbae21e9b9d
for vpc_rb in $(ls -1 vpc-*.rb);do for sg in `grep security_group ${vpc_rb}| gsed -e 's/[[:space:]]security_group[[:space:]]"\(.*\)" do/\1/g'`;do gsed -n -e '/^ec2[[:space:]]"\(.*\)"[[:space:]]do/p;/^end/p;/^\(. \)security_group[[:space:]]"'${sg}'"/,/^\(. \)end/p;' ${vpc_rb} > ${sg}.rb ;done;done
@saitara
saitara / file1.txt
Last active August 29, 2015 14:24
SAN対応 x.509 証明書を取得するためのCSRを作成する ref: http://qiita.com/saitara/items/eda74ac6a950122b5f31
$ export HOSTNAME=test.local
@saitara
saitara / file0.txt
Last active August 29, 2015 14:23
AWSの特定OS最新AMIを追いかけるためのワンライナー ref: http://qiita.com/saitara/items/b129d96949a17bd23033
aws ec2 describe-images --owner amazon --region ap-northeast-1 --filter "Name=name,Values=amzn-ami-hvm-*-gp2" "Name=virtualization-type,Values=hvm" --query 'sort_by(Images[].{YMD:CreationDate,Name:Name,ImageId:ImageId},&YMD)|reverse(@)|[0]'
@saitara
saitara / file0.txt
Created June 16, 2015 14:29
AWS EC2で複数ENIをLinux系OSでもっと手軽に扱うための何か ref: http://qiita.com/saitara/items/e11be6ddc376be4356ef
rpm -ivh ec2-utils-0.4-1.22.amzn1.src.rpm
@saitara
saitara / file0.txt
Last active August 29, 2015 14:19
Amazon Linux(に限りませんがRPM系)のbashをSYSLOG_HISTORYに対応させる ref: http://qiita.com/saitara/items/03f13eee10bc06219289
sudo yum -y install rpm-build texinfo bison ncurses-devel autoconf gettext gcc make
@saitara
saitara / file0.txt
Created April 21, 2015 03:34
AWS CLIで時刻を扱うときの定型文 ref: http://qiita.com/saitara/items/3e84471a79237f9e5ec7
--start-time (timestamp)
The time stamp to use for determining the first datapoint to return.
The value specified is inclusive; results include datapoints with
the time stamp specified.
--end-time (timestamp)
The time stamp to use for determining the last datapoint to return.
The value specified is exclusive; results will include datapoints up
to the time stamp specified.
@saitara
saitara / benchmark.sh
Last active August 29, 2015 14:19
AWS インスタンス別ネットワーク帯域・InstanceStore IOPS測定 ref: http://qiita.com/saitara/items/882a3e70639637e24a4f
#!/bin/sh
INSTANCE_TYPE=$(curl -s http://169.254.169.254/2014-11-05/meta-data/instance-type)
yum install fio -y
umount /media/ephemeral0
time dd if=/dev/zero of=/dev/xvdb bs=1M
sudo mkfs.ext4 /dev/xvdb
mount /media/ephemeral0
for i in `seq 0 3`;do
time fio -name=random-write \
--output=/home/ec2-user/${INSTANCE_TYPE}-${i}.txt \
@saitara
saitara / file0.txt
Last active August 29, 2015 14:19
Linuxでのネットワーク処理負荷を適正化する(RPS/RFS/XPS) ref: http://qiita.com/saitara/items/42a39ec18255aa342cc3
top - 19:29:57 up 9:08, 1 user, load average: 0.92, 0.70, 0.69
Tasks: 427 total, 3 running, 424 sleeping, 0 stopped, 0 zombie
Cpu0 : 54.6%us, 5.7%sy, 0.0%ni, 25.7%id, 0.0%wa, 10.8%hi, 3.2%si, 0.0%st
Cpu1 : 21.4%us, 2.4%sy, 0.0%ni, 76.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : 18.9%us, 1.7%sy, 0.0%ni, 79.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 : 16.8%us, 1.3%sy, 0.0%ni, 81.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu4 : 48.5%us, 5.1%sy, 0.0%ni, 46.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu5 : 3.0%us, 0.7%sy, 0.0%ni, 96.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu6 : 0.3%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu7 : 0.3%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
@saitara
saitara / file0.txt
Created April 18, 2015 12:56
homebrew CASKを一気に更新するワンライナー ref: http://qiita.com/saitara/items/e112158cee7f8103b5b9
for a in `brew cask list`;do brew cask install ${a};done