Skip to content

Instantly share code, notes, and snippets.

@itiut
itiut / sumarize-execution-time.sh
Created June 21, 2014 11:57
sqlの出力結果から実行時間を抜き出す
#!/bin/sh
set -eux
cd $(dirname $0)
# for i in {1..22}; do LINE=`wc -l $i.out | cut -d ' ' -f 1`; grep -e "^select$" -A $LINE $i.out | grep -o -e "[[:digit:]]\+\.[[:digit:]]\+ sec)" -m 1 | cut -d ' ' -f 1 | sed "s/^/$i /g"; done > execution_time.dat
parse_execution_time() {
local qout=$1
local status_line=$(grep -n '| Status *| Duration *|' $qout | cut -d ':' -f 1)
tail -n +$((status_line + 2)) $qout | grep '^|' | sed 's/^| \| |$//g' | sed 's/ *| */,/g' > time$qout
#!/bin/sh
set -eux
cd $(dirname $0)
join_sar() {
local cpu_out=sar_cpu$1.out
local io_out=sar_io$1.out
local sar_out=sar$1.out
local cpu_out_temp=$cpu_out.temp
local io_out_temp=$io_out.temp
@itiut
itiut / background_sar.sh
Created June 9, 2014 11:42
バックグラウンドでsarを動かしてリソースを監視する
#!/bin/sh
LC_TIME=POSIX sar -u 1 > sar.out &
PID=$!
dd if=/dev/zero of=/tmp/dd.out bs=1M count=1000 oflag=direct
sleep 5
kill $PID
#!/bin/sh
set -eux
BIN_DIR=$KUGENUMA51_HOME/bin
SRC_DIR=$KUGENUMA51_HOME/src
REPOSITORY=tpch-mysql
REPO_DIR=$SRC_DIR/$REPOSITORY
if [ ! -d $REPO_DIR ]; then
cd $SRC_DIR
#!/bin/sh
set -eux
cd $(dirname $0)
BASE_DIR=$KUGENUMA51_HOME/opt/mysql
DATA_DIR=$KUGENUMA51_HOME/mnt
rm -rf $DATA_DIR/*
cd $BASE_DIR

Vim勉強会

  • 2014/05/30 (金)
  • @itiut

アジェンダ

  • vimtutorやりつつVimの操作方法に慣れる
  • .vimrcのおすすめ設定
  • ターミナルのtipsいくつか紹介
@itiut
itiut / mount-kugenuma51.sh
Created May 27, 2014 05:58
sshfsとautosshを使ってマウントする
#!/bin/sh
set -eux
if [ ! -d /mnt/kugenuma51 ]; then
sudo mkdir --parents /mnt/kugenuma51
sudo chown $USER:$USER /mnt/kugenuma51
fi
sshfs kugenuma51:/export/home1/tanikawa /mnt/kugenuma51 -o follow_symlinks,idmap=user,intr,ssh_command=autossh
set xrange [0:23];
set xtics 1, 1, 22;
set mytics 2.5;
unset key;
set xlabel 'Queries';
set ylabel 'Execution Time [sec]';
set boxwidth 0.5;
set style fill solid 0.5;
@itiut
itiut / file0.txt
Created May 25, 2014 23:43
Ubuntu 14.04でdockerをsudoなしで動かす ref: http://qiita.com/itiut@github/items/85a473059fceab7f7159
$ sudo service docker restart
docker: unrecognized service
@itiut
itiut / file0.txt
Created May 25, 2014 10:40
linuxbrewでopenssl-1.0.1gのmanページのインストールに失敗するときの回避策 ref: http://qiita.com/itiut@github/items/12c277b5d459989dbf5d
$ brew install openssl
==> Downloading https://www.openssl.org/source/openssl-1.0.1g.tar.gz
######################################################################## 100.0%
==> perl ./Configure --prefix=/home/itiut/.linuxbrew/Cellar/openssl/1.0.1g --openssldir=/home/itiut/.linuxbrew/etc/openssl zlib-dynamic shared enable-cms linux-x86_64
==> make depend
==> make
==> make test
==> make install MANDIR=/home/itiut/.linuxbrew/Cellar/openssl/1.0.1g/share/man MANSUFFIX=ssl
cms.pod around line 465: Expected text after =item, not a number
cms.pod around line 470: Expected text after =item, not a number