Skip to content

Instantly share code, notes, and snippets.

@radixm46
Last active January 3, 2022 14:32
Show Gist options
  • Save radixm46/dcc252d8f2a9892a6dd89bb8bc355148 to your computer and use it in GitHub Desktop.
Save radixm46/dcc252d8f2a9892a6dd89bb8bc355148 to your computer and use it in GitHub Desktop.
From a scene in Patlabor the Movie
#!/usr/bin/env bash
set -euo pipefail
(
trap 'tput cnorm;tput init; exit' SIGINT SIGTERM
# preparation
clear
tput civis
sleep 1.5
# vertical pos
v() {
tput cud $(($(tput lines) / 2 - ${1:-'0'} / 2))
}
# horizontal pos
h() {
printf "% $(($(tput cols) / 2 - ${1:-22}))s" ' '
}
# display message
m() {
for c in $(fold -w1 <(printf ${1})); do
printf "${c//\&/ }"
sleep 0.02
done
}
# feed line
p() {
tput civis
local c=$(($(tput lines) / 2))
tput cud ${c}
printf '\n'
tput cup ${c}
tput cnorm
}
# prompt
n() {
tput civis
h 10
tput cnorm
m ${1:-''} 10
sleep ${2:-0.01}
if [ ${3:-''} = '' ]; then
p
fi
}
# scripture
o() {
tput civis
h
m ${1:-''}
sleep 0.4
printf '\n'
}
v '1'
tput cnorm
n 'attach&cd&01&/' 1.8
n 'enter&author&password' 0.2
n 'pass: ' 0 'nolf'
printf "\033[%dC" 1
read -r p
tput civis
sleep 0.8
# babel
if [ ${p:-'pass'} = 'E.HOBA' ]; then
clear
v '3'
o '&Go&to,&let&us&go&down,&and&there&confound'
o 'their&language,&that&they&may&not&understand'
o "one&another's&speech."
sleep 10
clear
b() {
local bl='BABEL&'
local w=$(tput cols)
local n=$((${w} % ${#bl})) # spill chars
tput cud $(tput lines)
if [ ${n} -eq 0 ]; then
local l=$(for i in $(seq -w $((${w} / ${#bl}))); do printf '%s' ${bl}; done)
else
local l=$(for i in $(seq -w $((${#bl} * ${w} / ${n}))); do printf '%s' ${bl}; done)
fi
while true; do
for m in $(fold -w${w} <(printf ${l})); do
echo -n "${m//\&/ }"
sleep 0.4
done
done
}
b
else
n 'invalid&password'
tput cnorm
exit
fi
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment