Skip to content

Instantly share code, notes, and snippets.

@mikechernev
Last active February 23, 2024 10:00
Show Gist options
  • Save mikechernev/e774594df49c585089ed969fa0706d89 to your computer and use it in GitHub Desktop.
Save mikechernev/e774594df49c585089ed969fa0706d89 to your computer and use it in GitHub Desktop.
A welcome message when loading zsh
#!/bin/zsh
dragonColour=11
textColour=2
upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
secs=$((${upSeconds}%60))
mins=$((${upSeconds}/60%60))
hours=$((${upSeconds}/3600%24))
days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
# get the load averages
read one five fifteen rest < /proc/loadavg
echo "$(tput setaf ${dragonColour})
\||/ Waddup `print -r -- "${(C)USER}"`
| @___oo /
/\ /\ / (__,,,,| $(tput setaf ${textColour})`date +"%A, %e %B %Y, %r"`$(tput setaf ${dragonColour})
) /^\) ^\/ _) $(tput setaf ${textColour})`uname -srmo`$(tput setaf ${dragonColour})
) /^\/ _)
) _ / / _) $(tput setaf ${textColour})Uptime.............: ${UPTIME}$(tput setaf ${dragonColour})
/\ )/\/ || | )_) $(tput setaf ${textColour})Memory.............: `cat /proc/meminfo | grep MemFree | awk {'print $2'}`kB (Free) / `cat /proc/meminfo | grep MemTotal | awk {'print $2'}`kB (Total)$(tput setaf ${dragonColour})
< > |(,,) )__) $(tput setaf ${textColour})Load Averages......: ${one}, ${five}, ${fifteen} (1, 5, 15 min)$(tput setaf ${dragonColour})
|| / \)___)\ $(tput setaf ${textColour})Running Processes..: `ps ax | wc -l | tr -d " "`$(tput setaf ${dragonColour})
| \____( )___) )___ $(tput setaf ${textColour})IP Addresses.......: `ip a | grep glo | awk '{print $2}' | head -1 | cut -f1 -d/` and `wget -q -O - http://icanhazip.com/ | tail`$(tput setaf ${dragonColour})
\______(_______;;; __;;;
$(tput sgr0)
`curl -s http://wttr.in/\?0`
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment