Skip to content

Instantly share code, notes, and snippets.

@mostafaasadi
Last active March 20, 2019 21:10
Show Gist options
  • Save mostafaasadi/f52b0b5eda30d1a91e488873a8d99f7c to your computer and use it in GitHub Desktop.
Save mostafaasadi/f52b0b5eda30d1a91e488873a8d99f7c to your computer and use it in GitHub Desktop.
happy new year shell
#!/bin/bash
# GPL
# A fork from https://github.com/subins2000/new-year-bash
# Config
name='Mostafa Asadi'
correction=0
trap "tput reset; tput cnorm; exit" 2
clear
tput civis
line=2
middle_column=$(($(tput cols) / 2))
middle_column=$((middle_column-1))
color=0
new_year=1397
let new_year++
while true; do
randomValue=$((RANDOM % 10 + 1))
from_middle=$((middle_column-randomValue))
column=$((RANDOM % (randomValue) * 2 + 1 + from_middle))
tput setaf $color; tput bold
tput cup 1 $column
echo '*'
color=$(((color+1)%8))
from_middle=-2 # from left column
for l in H A P P Y
do
tput cup $((line+1)) $((middle_column+from_middle))
echo $l
let from_middle++
sleep 0.01
done
from_middle=-1
for l in N E W
do
tput cup $((line+2)) $((middle_column+from_middle))
echo $l
let from_middle++
sleep 0.01
done
from_middle=0
for l in Y E A R
do
tput cup $((line+3)) $((middle_column+from_middle))
echo $l
let from_middle++
sleep 0.01
done
spaceCount=$((middle_column/10 + correction))
spaces=""
for (( c=1; c<=$spaceCount; c++ ))
do
spaces+=" "
done
tput cup $((line+4)) 1
toilet "${spaces}$new_year" --gay -t
tput setaf $color; tput bold
tput cup 14 $column
echo '*'
tput cup $((line+15)) $((middle_column-(${#name}/3)))
echo $name
done
@mostafaasadi
Copy link
Author

mostafaasadi commented Mar 20, 2018

Requirement

install toilet

sudo apt install toilet
or
yaourt -S toilet
or
brew install toilet

Usage

curl https://gist.githubusercontent.com/mostafaasadi/f52b0b5eda30d1a91e488873a8d99f7c/raw/09ada64fef0aec2a810724b08da093273a8b4410/hny97.sh | bash

@amin3mej
Copy link

or
brew install toilet

@mostafaasadi
Copy link
Author

@amin3mej 🌹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment