Skip to content

Instantly share code, notes, and snippets.

@sasairc
Forked from 844196/ISLANDERS.sh
Last active August 29, 2015 14:10
Show Gist options
  • Save sasairc/df779c2ba0f2c8b97dd9 to your computer and use it in GitHub Desktop.
Save sasairc/df779c2ba0f2c8b97dd9 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# @(#) ISLANDERSって表示するだけ。(<C-c>で)流してくれ。
#
# Author:
# Original: 844196 (@84____)
# Revised : sasairc(@sasairc)
#
# License:
# WTFPL 2.0
#
SLEEP="sleepenh"
WAIT="0.1"
Y="$(tput smso)$(tput setaf 7) $(tput sgr 0)$(tput rmso)"
function _CursorInvisible() {
trap "tput cnorm;" EXIT
trap "tput cnorm; exit 1" SIGINT
tput civis
}
function ISLANDERS() {
local ISLANDERS="
${MARGIN_H}
${MARGIN_W}$Y$Y$Y$Y$Y$Y $Y$Y$Y$Y$Y $Y$Y $Y$Y$Y $Y$Y $Y$Y $Y$Y$Y$Y$Y $Y$Y$Y$Y$Y$Y$Y $Y$Y$Y$Y$Y $Y$Y$Y$Y$Y
${MARGIN_W}$Y$Y$Y$Y$Y$Y $Y$Y$Y$Y$Y$Y $Y$Y $Y$Y$Y$Y$Y $Y$Y $Y$Y $Y$Y$Y$Y$Y$Y $Y$Y$Y$Y$Y$Y$Y $Y$Y$Y$Y$Y$Y $Y$Y$Y$Y$Y$Y
${MARGIN_W} $Y$Y $Y$Y $Y$Y $Y$Y $Y$Y $Y$Y$Y $Y$Y $Y$Y $Y$Y$Y$Y $Y$Y $Y$Y $Y$Y $Y$Y
${MARGIN_W} $Y$Y $Y$Y $Y$Y $Y$Y $Y$Y $Y$Y$Y $Y$Y $Y$Y $Y$Y$Y $Y$Y $Y$Y $Y$Y $Y$Y
${MARGIN_W} $Y$Y $Y$Y$Y $Y$Y $Y$Y $Y$Y $Y$Y$Y $Y$Y $Y$Y $Y$Y $Y$Y$Y$Y$Y$Y $Y$Y $Y$Y $Y$Y$Y
${MARGIN_W} $Y$Y $Y$Y$Y $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seq 1 $i`; do
echo -n " "
done
)
ISLANDERS
${SLEEP} ${WAIT} > /dev/null
clear
done
for ((i = max_h; i >= 0; i--)); do
MARGIN_H=$(
for j in `seq 1 $i`; do
echo " "
done
)
ISLANDERS
${SLEEP} ${WAIT} > /dev/null
clear
done
for ((i = max_w; i >= 0; i--)); do
MARGIN_W=$(
for j in `seq 1 $i`; do
echo -n " "
done
)
ISLANDERS
${SLEEP} ${WAIT} > /dev/null
clear
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment