Skip to content

Instantly share code, notes, and snippets.

View sasasin's full-sized avatar

Shinnosuke Suzuki sasasin

View GitHub Profile
@sasasin
sasasin / pull_all.sh
Created May 17, 2014 19:05
一括pullするワンライナー
ls $HOME/git | awk '{print "cd $HOME/git/" $1 ";git pull"}' | bash
@sasasin
sasasin / pull-all.sh
Created August 16, 2014 10:46
カレントディレクトリにあるリポジトリを全部pullする
#!/bin/sh
find ./ -type d -depth 1 \
| while read D; do
cd $D
pwd
git pull
cd ../
done
@sasasin
sasasin / brew-cask-upgrade.sh
Created August 16, 2014 10:48
HomebrewとHomebrew-caskのパッケージをアップグレードする
#!/bin/sh -v
brew update
brew upgrade
brew cleanup
for c in `brew cask list`;
do
! brew cask info $c \
| grep -qF "Not installed" || brew cask install $c;
done
@sasasin
sasasin / wget-timediff.sh
Created September 18, 2014 07:02
wgetのログから、開始終了の時刻を切り出し、UNIX時刻に変換し、時刻の差を出す
# wgetのログから、開始終了の時刻を切り出し、UNIX時刻に変換し、時刻の差を出す
grep -Eis '^--2' *.log \
| awk 'BEGIN{FS="--"}{print $2}' \
| xargs -L1 -I {} ruby -e 'require "time";t=Time.parse("'{}'"); p t.to_i' \
| xargs -L2 echo \
| awk '{print $2 - $1}'
@sasasin
sasasin / block.txt
Created September 21, 2011 08:42 — forked from taichi/block.txt
Personal BlockList用のブロックドメインリスト
http://q.hatena.ne.jp/1316511935
https://chrome.google.com/webstore/detail/nolijncfnkgaikbjbdaogikpmpbdcdef
2chfinder.com
a.hatena.ne.jp
anond.hatelabo.jp
ceron.jp
clip.livedoor.com
friendfeed.com
@sasasin
sasasin / ads2500w_rename.sh
Created October 7, 2012 07:51
JUSTIO ADS2500Wで作成したファイル名を、lsしたときページ順に並ぶよう、リネームするコマンドです。
#!/bin/sh
ls "$@" | while read f; do
BEFORE_NAME=$f
AFTER_NAME=$(ls $f | awk 'BEGIN{FS="_"}{print "$0" $1 "." $2 "." $3}' | awk 'BEGIN{FS="."}{printf("HOGE.%s.%05d.jpg\n",$2,$3)}')
mv $BEFORE_NAME $AFTER_NAME
done
@sasasin
sasasin / urauturi_hosei.sh
Created October 7, 2012 07:53
Imagemagickを使用し、ドキュメントスキャナで取り込んだ画像の裏写り補正を行うコマンドです。
#!/bin/sh
mogrify -channel Red -separate -modulate 110 +contrast "$@"
@sasasin
sasasin / dir2pdf.sh
Created October 7, 2012 07:56
ディレクトリに集めた画像ファイルを、PDFファイルに固めるスクリプトです。コミックや小説のため「右から左へ」のフラグをPDFに埋め込んでいます。
#!/bin/sh
export MAGICK_TEMPORARY_PATH=$HOME
find "$@" -type d | while read f; do
OUTDIR=$f
rm -f "$(pwd)"/"${OUTDIR}".pdf
echo "converting $f "
(jpg2pdf.pl \
@sasasin
sasasin / rename_hoge.sh
Created October 18, 2012 10:23
なんだかよくわからない、リネームコマンドです。
#!/bin/sh
ls *.pdf \
| grep -v '^zip2pdf\.' \
| sort \
| perl -wnl -aF'\.' -e 'print(pop(@F) . "|" . join(".", @F) . "|" . "19990104." . sprintf("%06d", $.) )' \
| awk 'BEGIN{FS="|"}{print "mv \"" $2 "." $1 "\" zip2pdf." $3 "." $1}' \
> hoge.txt
@sasasin
sasasin / zip2pdf.sh
Created October 18, 2012 10:32
ZIP書庫をPDFに変換するスクリプトです。dir2pdf.sh,jpg2pdf.pl,pdfdirectionを併せてセットアップする必要があります。
#!/bin/sh
ls "$@" | while read f; do
echo "converting $f "
sleep 1
OUTDIR=zip2pdf.$(date +%Y%m%d.%H%M%S)
mkdir "${OUTDIR}"
unzip -q -o -j "$f" -d "${OUTDIR}"
rm -f "${OUTDIR}".pdf
dir2pdf.sh "${OUTDIR}"