Skip to content

Instantly share code, notes, and snippets.

@844196
Created December 1, 2014 20:01
Show Gist options
  • Save 844196/e30983a33f1b85355241 to your computer and use it in GitHub Desktop.
Save 844196/e30983a33f1b85355241 to your computer and use it in GitHub Desktop.
くさそう
#!/bin/bash
#
# @(#) ISLANDERSって表示するだけ。(<C-c>で)流してくれ。
#
# Author:
# 844196 (@84____)
#
# License:
# WTFPL 2.0
#
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 _Sleep() {
local t="${@}"
if $(which sleepenh >/dev/null 2>&1); then
local sleep='sleepenh'
else
local sleep='sleep'
fi
${sleep} ${t} >/dev/null
}
function _MarginHeight() {
local height=$(tput lines)
local m=$(expr \( ${height} - ${1} \) / 2)
for i in $(seq 1 ${m}); do
echo " "
done
}
function _MarginWidth() {
local cols=$(tput cols)
local w=$(expr \( ${cols} - ${1} \) / 2)
MARGIN_W=$(for i in `seq 1 ${w}`; do printf " "; done)
}
function ISLANDERS() {
_MarginHeight 12; _MarginWidth 136;
local ISLANDERS="
${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$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