Skip to content

Instantly share code, notes, and snippets.

@rhoit
Last active July 21, 2021 14:01
Show Gist options
  • Save rhoit/8bbd3217c75436d5ec6abe4e4439fecc to your computer and use it in GitHub Desktop.
Save rhoit/8bbd3217c75436d5ec6abe4e4439fecc to your computer and use it in GitHub Desktop.

Config your Conky with simple bash script

INTRO

disclaimer

not to be taken seriously!

requirements

  • linux machine with UI hopefully X11

TIME

server different timezone

system time

NST is at +5:45 which is odd because count of the 30⁰ latitude

date
date --utc
Wed Jun 23 10:57:04 PM +0545 2021
Wed Jun 23 05:12:04 PM UTC 2021

CALENDAR

cal --color=always
      June 2021
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

:

modifying for conky display

cal --color=always | sed '1s/ *\([^0-9]*\)\(.*\)/${color 8ba9c2}${font Argos:size=20}\1${font Argos:size=15}\2${font}/; 2s/$/${color}/; s/\x1b\[7m\([0-9 ]\+\).*m/${color e84448}\1${color cc9966}/'
${color 8ba9c2}${font Argos:size=20}July ${font Argos:size=15}2021     ${font}
Su Mo Tu We Th Fr Sa${color}
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

:

LAST

last -a | sed "/:[.0-9]*$/d; s/system boot//; s/ \+/ /g; s/^/$(printf "%38s")/" | head -5
                                      rho tty1 Wed Jul 21 07:05 still logged in
                                      reboot Wed Jul 21 07:04 still running 5.12.14-arch1-1
                                      rho tty1 Tue Jul 20 06:59 - down (14:21)
                                      reboot Tue Jul 20 06:59 - 21:20 (14:21) 5.12.14-arch1-1
                                      rho tty1 Mon Jul 19 07:49 - down (13:53)

NETWORK

ss -npt 2> /dev/null #| awk -v host="$(hostname -i | tr -d ' ')" 'BEGIN { FS = "[/: ]+"} NR > 2 {gsub(host, "localhost"); gsub("127.0.0.1|::1", "localhost"); if ($5 < 10240) printf ":%-5s ← %-15s %s\n", $5, $6, $(NF - 1); }' | sort | uniq -c | sort -rn | cut -b 1-3 --complement
State Recv-Q Send-Q Local Address:Port     Peer Address:PortProcess
ESTAB 0      0      192.168.1.112:56936   91.108.56.177:443  users:(("telegram-deskto",pid=950,fd=30))
ESTAB 0      0      192.168.1.112:42828 142.250.194.202:443  users:(("firefox",pid=995,fd=94))
ESTAB 0      0      192.168.1.112:53286    76.223.31.44:443  users:(("firefox",pid=995,fd=72))
ESTAB 0      0      192.168.1.112:46194  44.241.185.165:443  users:(("firefox",pid=995,fd=88))
ESTAB 0      0      192.168.1.112:56938   91.108.56.177:443  users:(("telegram-deskto",pid=950,fd=22))
ESTAB 0      0      192.168.1.112:42826 142.250.194.202:443  users:(("firefox",pid=995,fd=89))
ESTAB 0      0      192.168.1.112:58954 142.250.192.163:443  users:(("firefox",pid=995,fd=66))
ESTAB 0      0      192.168.1.112:41116     31.13.79.18:443  users:(("firefox",pid=995,fd=87))
ESTAB 0      0      192.168.1.112:36158  142.250.194.14:443  users:(("firefox",pid=995,fd=82))
ESTAB 0      0      192.168.1.112:56942   91.108.56.177:443  users:(("telegram-deskto",pid=950,fd=31))
ESTAB 0      0      192.168.1.112:57478     31.13.79.12:443  users:(("firefox",pid=995,fd=86))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment