trap "ending" 2
[ "$1" == "-D" ] && DEBUG=1 && shift 1
PS4='$SECONDS $LINENO: '
DOW=$(date +%a)
TODAY=$(date +%m/%d)
DOM=$(date +%d)
OS=$(uname -s)
NAME=${0##*/}
TIMEOUT=3m
R=$(tput setaf 1)
BR=$(tput setaf 1; tput bold)
G=$(tput setaf 2)
BG=$(tput setaf 2; tput bold)
Y=$(tput setaf 3)
BY=$(tput setaf 3; tput bold)
B=$(tput setaf 4)
BM=$(tput setaf 5; tput bold)
BC=$(tput setaf 6; tput bold)
C=$(tput setaf 6)
BL=$(tput setaf 7; tput bold)
BLD=$(tput bold)
N=$(tput sgr0)
SIT=$(tput sitm)
RIT=$(tput ritm)
UL=$(tput smul)
NL=$(tput rmul)
RV=$(tput rev)
ROWS=$(tput lines)
COLS=$(tput cols)
bl(){
[ "$DEBUG" == "1" ] && set -x
echo ""
}
html(){
vim -f +"syn on" +"set nonu" +"set foldenable!" +"set nospell" +"run! syntax/2html.vim" +"wq" +"q" $1
}
log(){
[ "$DEBUG" == "1" ] && set -x
logger -i -t "$NAME" "$*"
}
pause(){
[ "$DEBUG" == "1" ] && set -x
[ "$1" == "-nt" ] && TMOUT="" && shift
echo "$BY";
if [ $# -gt 0 ]
then
read -t $1 -r -p "${C}Hit any key (${BY}$1${C} second timeout)${N}" -n 1 FOO;
else
read -r -p "${C}Hit any key${N}" -n 1 FOO;
fi;
bl
}
strip-tags(){
sed -e 's/<[^>]*.//g' -
}
xtitle(){
printf "\033]0;%s\007" "${*}🌀${HOSTNAME}"
}
ending(){
reset
exit
}
if [ "$1" == "-E" ]
then
vim $0
sed -i -e "7s/.*/# Updated....: $(date)/" $0
log "Updated $0"
html $0
cp $0 /var/www/unix
mv $0.html /var/www/unix
exit
fi
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
fmt -s -w $(tput cols) <<END
$NAME
No options
END
exit
fi
command -v bash >/dev/null || sudo apt install bash -qyy
command -v cmatrix >/dev/null || sudo apt install cmatrix -yyq
command -v tty-clock >/dev/null || sudo apt install tty-clock -yyq
[ "$DEBUG" == 1 ] && set -x
echo -n "${BG}Time between savers: ${BY}${TIMEOUT}${BG} Ctrl-C to end${N} ";spinit sleep 3
while :
do
NUM=$((RANDOM % 10))
case $NUM in
0) xtitle "pipesX.sh";timeout --foreground $TIMEOUT pipesX.sh -t $((RANDOM % 4)) ;;
1) xtitle "pipes";timeout --foreground $TIMEOUT pipes -t $((0 + RANDOM % 9)) ;;
2) xtitle "asciiquarium";timeout --foreground $TIMEOUT /home/mitch/bin/asciiquarium ;;
3) xtitle "maze.py";timeout --foreground $TIMEOUT maze.py ;;
4) xtitle "neo";timeout --foreground $TIMEOUT neo -c green -s -m "$(tag -p)" ;;
5) xtitle "tty-clock";timeout --foreground $TIMEOUT tty-clock -sxtrB -C $(( ( RANDOM % 6 ) + 1 )) ;;
6) xtitle "glsr";timeout --foreground $TIMEOUT glsr ;;
8) xtitle "bclock";timeout --foreground $TIMEOUT bclock ;;
9) xtitle "cbonsai";timeout --foreground $TIMEOUT cbonsai -S -m "$(quote -p)" ;;
esac
done