#!/bin/bash
#
# motd-snips - system info

# set delimiter to just newlines, instead of any white space
# IFS=$'\n'

# motd snippets
# convert the uptime from seconds into days, hours and minutes.
# d=$((s / 60 / 60 / 24))
# h=$((s / 60 / 60 % 24))
# m=$((s / 60 % 60))

#UPTIME_DAYS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 / 86400)
#UPTIME_HOURS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 / 3600)
#UPTIME_MINUTES=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 % 3600 / 60)
#IPADDR=$(ip addr | sed -En "s/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p")
##IPIFC=$(ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print $2}')
#NETDEV=$(ip route show 0/0 | cut -f5 -d' ')

#ln=$(--------------------------------------------------------------)
#hr=$(printf $(printf "\e[$(shuf -i 91-97 -n 1);1m%%%ds\e[0m\n" $(tput cols)) | tr " " =)
#printf "\033[91mHello\033[0m world.\n"
#echo "$(printf $(printf "\e[$(shuf -i 91-97 -n 1);1m%%%ds\e[0m\n" $(tput cols)) | tr " " =)"
##echo "--------------------------------------------------------------"
#date "+%e-%m-%y %T"
#echo ""
#echo `(cat /proc/cpuinfo | grep 'Model' | head -1 | cut -d':' -f2)`
##echo "Distro: `(awk -F= '$1=="PRETTY_NAME" { print $2 ;}' /etc/os-release | tr -d '"')`"
#echo "Distro: `(cat /etc/*-release | grep PRETTY_NAME | cut -d '=' -f2 | tr -d '"')`"
#echo "Kernel: `uname -v | awk '{print $4 " "  $5 " " $6}'` with `uname -mr`"
#echo ""
#echo "Uptime: $UPTIME_DAYS days $UPTIME_HOURS h $UPTIME_MINUTES m"
#echo "CPU Load: `cat /proc/loadavg | awk '{print $1 ", " $2 ", " $3}'`"
#echo "Disk Usage: `findmnt -no USED / # + /boot + /boot/efi`"
#echo "Memory: `free -m | awk '/Mem:/{printf "%3.1f%% %dM / %dM", ($3/$2*100), $3, $2}'`"
#echo "RAM Usage: `free -th | mawk '/^Total:/{print $3}'`"
#echo "$(($(cat /sys/class/thermal/thermal_zone0/temp) / 1000))°C"
#echo "Boot Duration: `systemd-analyze | mawk '{print $(NF-1)" "$NF;exit}'`"
#echo "Pre-installed Packages: `dpkg --get-selections| wc -l`"
#echo "Running Processes: `echo $(( $(pstree -Ta | wc -l) - 3 ))`"
#echo "$NETDEV $IPADDR"
#echo "SSH:"
#echo "`ss -tulpn | grep ':*22'`"
#echo "$(printf $(printf "\e[$(shuf -i 91-97 -n 1);1m%%%ds\e[0m\n" $(tput cols)) | tr " " =)"

# model=$(cat /sys/firmware/devicetree/base/model)
# temp="$(($(cat /sys/class/thermal/thermal_zone0/temp) / 1000))°C"
