add SOPS, etc.

This commit is contained in:
iofq 2024-04-07 17:54:27 -05:00
parent e1f0194350
commit 10c6af76f2
No known key found for this signature in database
GPG key ID: ECF3B2DA38BF7183
25 changed files with 435 additions and 413 deletions

View file

@ -1,91 +0,0 @@
#!/bin/bash
trap \
"{ pkill -P $$ ; exit 255; }" \
SIGINT SIGTERM ERR EXIT
bat() {
battery=$(cat /sys/class/power_supply/BAT0/capacity)
time=$(cat /tmp/.battime)
drain=$(cat /sys/class/power_supply/BAT0/power_now)
if [[ $(cat /sys/class/power_supply/BAT0/status) == "Charging" ]]; then
echo "$battery%+"
else
echo "$time, $battery%$charge, $(echo "scale=1; $drain / 1000000" | bc)mW"
fi
}
time_date() {
FORMAT="%a %m.%d.%y %T"
DATE=`date "+${FORMAT}"`
echo "${DATE}"
}
mem() {
echo "scale=2; $(free -m | sed -n 2p | awk '{print $3 + $5}') / 1000" | bc
}
vol() {
MUTED=$(amixer get Master | grep off)
amixer get Master | grep -m1 -Po "\d{1,3}%"
[[ $MUTED != '' ]] && echo " M";
}
temp_update() {
TEMP=$(cat /sys/class/thermal/thermal_zone0/temp)
echo $((TEMP / 1000))
}
cpu_update() {
read prevtotal previdle < /tmp/.cpulast
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
[[ $prevtotal == 0 ]] && prevtotal=1
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
echo $total $idle > /tmp/.cpulast
echo "$cpu%"
}
calc(){ awk "BEGIN { print "$*" }"; }
mhz_update() {
mhz=$(cat /proc/cpuinfo | grep 'cpu MHz' | awk '{print $4}' | head -n1 | cut -d "." -f 1)
echo "$(calc $mhz/1000 | awk '{ printf "%1.2f\n", $0 }') GHz"
}
update_3() {
while true; do
cpu_update > /tmp/.cpu
temp_update > /tmp/.temp
mhz_update > /tmp/.mhz
sleep 3
done
}
update_30() {
while :; do
awk 'NR==3 {printf("%.0ddB",$4) > "/tmp/.wifi"}' /proc/net/wireless
acpi | awk '{print $5}' > /tmp/.battime
if ping -W 1 -c 1 8.8.8.8 > /dev/null; then
echo "@" > /tmp/.online
else
echo "?" > /tmp/.online
fi
sleep 30
done
}
update_300() {
while :; do
curl -s wttr.in/madison?format=%t | head -c 7 > /tmp/.wttr
sleep 300
done
}
SLEEP_SEC=1
PAD=" | "
update_300 &
update_30 &
update_3 &
while true; do
xsetroot -name "$(mem)G$PAD$(cat /tmp/.cpu)$PAD$(cat /tmp/.mhz)$PAD$(cat /tmp/.temp)°C$PAD$(cat /tmp/.wifi), $(cat /tmp/.online)$PAD$(vol)$PAD$(bat)$PAD$(cat /tmp/.wttr), $(time_date)"
sleep $SLEEP_SEC
done

View file

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# This file echoes a bunch of color codes to the
#terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
T='gYw' # The test text
echo -e "\n 40m 41m 42m 43m\
44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
' 36m' '1;36m' ' 37m' '1;37m';
do FG=${FGs// /}
echo -en " $FGs \033[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
done
echo;
done
echo

View file

@ -1,71 +0,0 @@
#!/bin/sh
## INFO
host="$(cat /etc/hostname)"
os='Debian 11'
kernel="$(uname -sr)"
uptime="69 days, 4 hours, 20 minutes"
packages="$(apt list --installed 2>/dev/null | wc -l)"
shell="$(basename "$SHELL")"
## UI DETECTION
if [ -n "${DE}" ]; then
ui="${DE}"
uitype='DE'
elif [ -n "${WM}" ]; then
ui="${WM}"
uitype='WM'
elif [ -n "${XDG_CURRENT_DESKTOP}" ]; then
ui="${XDG_CURRENT_DESKTOP}"
uitype='DE'
elif [ -n "${DESKTOP_SESSION}" ]; then
ui="${DESKTOP_SESSION}"
uitype='DE'
elif [ -f "${HOME}/.xinitrc" ]; then
ui="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
uitype='WM'
elif [ -f "${HOME}/.xsession" ]; then
ui="$(tail -n 1 "${HOME}/.xsession" | cut -d ' ' -f 2)"
uitype='WM'
else
ui='unknown'
uitype='UI'
fi
##hardcode because our .xinitrc doesn't end like exec wm
ui="dwm"
## DEFINE COLORS
# probably don't change these
if [ -x "$(command -v tput)" ]; then
bold="$(tput bold)"
black="$(tput setaf 0)"
red="$(tput setaf 1)"
green="$(tput setaf 2)"
yellow="$(tput setaf 3)"
blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
cyan="$(tput setaf 6)"
white="$(tput setaf 7)"
reset="$(tput sgr0)"
fi
# you can change these
lc="${reset}${bold}${white}" # labels
nc="${reset}${bold}${white}" # user and hostname
ic="${reset}" # info
c0="${reset}${white}" # first color
## OUTPUT
clear
cat <<EOF
${c0}${nc}${USER}${ic}@${nc}${host}${reset}
------
${c0}${lc}OS: ${ic}${os}${reset}
${c0}${lc}KERNEL: ${ic}${kernel}${reset}
${c0}${lc}UPTIME: ${ic}${uptime}${reset}
${c0}${lc}PACKAGES: ${ic}${packages}${reset}
${c0}${lc}SHELL: ${ic}${shell}${reset}
${c0}${lc}${uitype}: ${ic}${ui}${reset}
EOF