Skip to content

Instantly share code, notes, and snippets.

@sdeluce
Last active June 17, 2017 23:21
Show Gist options
  • Save sdeluce/051e54762bacbd2f9b1c8982aa30d65f to your computer and use it in GitHub Desktop.
Save sdeluce/051e54762bacbd2f9b1c8982aa30d65f to your computer and use it in GitHub Desktop.
## In ~/.zshrc
# Custom Prompt
alias shutdown='sudo shutdown -h now'
# PROMPT='${ret_status}$(tput setaf 1) $HOST %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
# PROMPT='$(tput setaf 1)$fg[red]┌─[$fg[cyan] $HOST $fg[red]]─[$(git_prompt_info)] %{$fg[cyan]%}%c%{$reset_color%}
# $fg[red]└──╼ $reset_color%$'
## ┌─[hostname]─[~] git
## └──╼ $ or # if root
# Show informations
welcome=$(./welcome.sh)
echo "\n$welcome"
## In a new script welcome.sh
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"`
cpuTempC=$(($(cat /sys/class/thermal/thermal_zone0/temp)/1000))
gpuTempC=$(/opt/vc/bin/vcgencmd measure_temp | cut -c6-9)
rst="$(tput sgr0)"
fgblk="${rst}$(tput setaf 0)" # Black
fgred="${rst}$(tput setaf 1)" # Red
fggrn="${rst}$(tput setaf 2)" # Green
fgylw="${rst}$(tput setaf 3)" # Yellow
fgblu="${rst}$(tput setaf 4)" # Blue
fgpur="${rst}$(tput setaf 5)" # Purple
fgcyn="${rst}$(tput setaf 6)" # Cyan
fgwht="${rst}$(tput setaf 7)" # White
echo "
${fggrn} .~~. .~~.
${fggrn} '. \ ' ' / .' ${fgylw}$(date +"%A, %e %B %Y, %R")
${fgred} .~ .~~~..~. ${fgylw}$(uname -srmo)
${fgred} : .~.'~'.~. :
${fgred} ~ ( ) ( ) ~ ${fgblu} Uptime :${fgwht} ${UPTIME}
${fgred} ( : '~'.~.'~' : ) ${fgblu} Memory :${fgwht} $(grep MemFree /proc/meminfo | awk {'print $2/1000'})MB (Free) / $(grep MemTotal /proc/meminfo | awk {'print $2/1000'})MB
${fgred} ~ .~ ( ) ~. ~ ${fgblu}Running Processes :${fgwht} $(ps ax | wc -l | tr -d " ")
${fgred} ( : '~' : )
${fgred} '~ .~~~. ~' ${fgblu} IP Address :${fgwht} $(ip route get 8.8.8.8 2>/dev/null | head -1 | cut -d' ' -f8)
${fgred} '~' ${fgblu} Temperature :${fgwht} CPU : $cpuTempC°C / GPU : $gpuTempC°C
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment