diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2017-10-17 18:12:57 -0600 |
---|---|---|
committer | mediocregopher <mediocregopher@gmail.com> | 2021-10-03 17:22:56 -0600 |
commit | 07ab3a77b44944a1ac234fbd717391f36370416e (patch) | |
tree | edd959740bf9256bf38e9c2e3cacda8c555f8c56 /awesome/bin |
initial public commit
Diffstat (limited to 'awesome/bin')
-rwxr-xr-x | awesome/bin/cricket | bin | 0 -> 2744274 bytes | |||
-rwxr-xr-x | awesome/bin/imgavg | bin | 0 -> 2160037 bytes | |||
-rwxr-xr-x | awesome/bin/random_i3lock.sh | 4 | ||||
-rwxr-xr-x | awesome/bin/scrot-gobin.sh | 4 | ||||
-rwxr-xr-x | awesome/bin/sysstats.sh | 50 |
5 files changed, 58 insertions, 0 deletions
diff --git a/awesome/bin/cricket b/awesome/bin/cricket Binary files differnew file mode 100755 index 0000000..b8d5699 --- /dev/null +++ b/awesome/bin/cricket diff --git a/awesome/bin/imgavg b/awesome/bin/imgavg Binary files differnew file mode 100755 index 0000000..f839d31 --- /dev/null +++ b/awesome/bin/imgavg diff --git a/awesome/bin/random_i3lock.sh b/awesome/bin/random_i3lock.sh new file mode 100755 index 0000000..e5f4e16 --- /dev/null +++ b/awesome/bin/random_i3lock.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +R=`find "$1" | grep -P 'png$' | sort -R | head -n1` +exec i3lock -i $R -t diff --git a/awesome/bin/scrot-gobin.sh b/awesome/bin/scrot-gobin.sh new file mode 100755 index 0000000..33bfc9f --- /dev/null +++ b/awesome/bin/scrot-gobin.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +scrot -o -s "/tmp/shot.png" +eog /tmp/shot.png diff --git a/awesome/bin/sysstats.sh b/awesome/bin/sysstats.sh new file mode 100755 index 0000000..f42588e --- /dev/null +++ b/awesome/bin/sysstats.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +cd $(dirname "$0") + +sep=" | " + +out=$(/home/mediocregopher/.config/awesome/bin/cricket \ + --limit 1 \ + --ping-hosts 8.8.8.8 \ + --net-interval "" \ + --disk-interval "" \ + --disk-io-interval "") + +function outNum { + echo "$out" | grep "$1" | grep -oP "$2=\"[0-9]+\"" | grep -oP '[0-9]+' +} + +echo -n "ping:$(outNum "ping result" "tookMSAvg")ms" + +echo -n "$sep" + +memBarSize=10 +memPer=$(outNum "mem stats" "memUsedPer") +memUsed=$(expr $memPer / $memBarSize) +memUnused=$(expr $memBarSize - $memUsed) +echo -n "mem:" +for i in $(seq $memUsed); do echo -n "█"; done +for i in $(seq $memUnused); do echo -n "░"; done +for i in $(seq $(expr $memBarSize - $memUsed - $memUnused)); do echo -n "░"; done + +echo -n "$sep" + +cpuBarSize=20 +cpuIdle=$(outNum "cpu stats" "cpuIdle") +cpuSys=$(outNum "cpu stats" "cpuSystem") +cpuUser=$(outNum "cpu stats" "cpuUser") +cpuTot=$(expr $cpuIdle + $cpuSys + $cpuUser) +function cpuL { + python -c "print(int($1 / $cpuTot * $cpuBarSize))" +} +cpuLIdle=$(cpuL $cpuIdle) +cpuLSys=$(cpuL $cpuSys) +cpuLUser=$(cpuL $cpuUser) +echo -n "cpu:" +for i in $(seq $cpuLUser); do echo -n "█"; done +for i in $(seq $cpuLSys); do echo -n "▓"; done +for i in $(seq $cpuLIdle); do echo -n "░"; done +for i in $(seq $(expr $cpuBarSize - $cpuLIdle - $cpuLSys - $cpuLUser)); do echo -n "░"; done + +echo "" |