Skip to content

Instantly share code, notes, and snippets.

@anekos
Last active December 25, 2015 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anekos/6901059 to your computer and use it in GitHub Desktop.
Save anekos/6901059 to your computer and use it in GitHub Desktop.
CPU をモグモグするスクリプト for tmux
#!/bin/sh
num="$1"
if [ -n "$num" ]
then
tmux new-window -n "mogu"
function split () {
local lv="$1"
[ "$lv" -gt 0 ] || return
tmux split-window -h
tmux split-window -h
tmux split-window -h
tmux select-layout tiled
local next=$((lv - 1))
split "$next"
split "$next"
split "$next"
split "$next"
}
split "$num"
panes=`tmux display-message -p "#{window_panes}"`
for n in `seq 0 $((panes - 1))`
do
tmux send-keys -t "mogu.$n" "$0" C-m
done
fi
ticktock=1
cols=`tput cols`
lines=`tput lines`
x=$((cols / 2 - 3))
y=$((lines / 2))
echo -ne "\033[H\033[2J\033[?25l"
trap 'echo -e "\033[?25h\033[0m\033[H\033[2J"' EXIT
while true
do
echo -ne "\033[K\033[${y};${x}H"
if [ $ticktock = 1 ]
then
echo -n '(^ー^)'
ticktock=0
else
echo -n '(^一^)'
ticktock=1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment