From 0b274c969e824b4bcf328e3272b8894143f3a683 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Sun, 24 Nov 2024 04:50:59 -0600 Subject: reinit 3. git reset --hard was not right. thanks ai --- stuff/scripts/system/backup/backup.sh | 30 +++++++++++ stuff/scripts/system/backup/copy-to-git.sh | 21 ++++++++ stuff/scripts/system/bri.sh | 1 + stuff/scripts/system/math.sh | 13 +++++ stuff/scripts/system/neoboot.sh | 28 ++++++++++ stuff/scripts/system/restart-pipe.sh | 1 + stuff/scripts/system/set-pri-java.sh | 1 + stuff/scripts/system/stbar/config.txt | 2 + stuff/scripts/system/stbar/killbar.sh | 10 ++++ stuff/scripts/system/stbar/stbar-awesome.sh | 81 ++++++++++++++++++++++++++++ stuff/scripts/system/stbar/stbar.sh | 84 +++++++++++++++++++++++++++++ stuff/scripts/system/stbar/weth_str.txt | 0 stuff/scripts/system/url-handler.sh | 18 +++++++ 13 files changed, 290 insertions(+) create mode 100755 stuff/scripts/system/backup/backup.sh create mode 100755 stuff/scripts/system/backup/copy-to-git.sh create mode 100755 stuff/scripts/system/bri.sh create mode 100755 stuff/scripts/system/math.sh create mode 100755 stuff/scripts/system/neoboot.sh create mode 100755 stuff/scripts/system/restart-pipe.sh create mode 100755 stuff/scripts/system/set-pri-java.sh create mode 100644 stuff/scripts/system/stbar/config.txt create mode 100755 stuff/scripts/system/stbar/killbar.sh create mode 100755 stuff/scripts/system/stbar/stbar-awesome.sh create mode 100755 stuff/scripts/system/stbar/stbar.sh create mode 100755 stuff/scripts/system/stbar/weth_str.txt create mode 100755 stuff/scripts/system/url-handler.sh (limited to 'stuff/scripts/system') diff --git a/stuff/scripts/system/backup/backup.sh b/stuff/scripts/system/backup/backup.sh new file mode 100755 index 0000000..16559d1 --- /dev/null +++ b/stuff/scripts/system/backup/backup.sh @@ -0,0 +1,30 @@ +cd ~/ + +fsynca () { + # t? + rsync -RUurvn --size-only --delete-after $exclude $syncfile "$target" +} + +fsyncb () { + printf "===confirm changes?\n" + read -p "y/n: " uinput + if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then + printf "\n\n\n" + rsync -PRUurv --size-only --delete-after $exclude $syncfile "$target" + printf "\n===end sync\n---------\n\n" + fi +} + +syncfile="stuff .bash_profile .bashrc .surf .wezterm.lua .tmux.conf .gtkrc-2.0 .profile .urlview .vimrc .xinitrc .Xresources .zshrc .newsboat .gnupg .ssh .local/bin/lf-gadgets .config/dwm .config/awesome .config/gtk-3.0 .config/rofi .config/lf .config/picom.conf .config/nvim .config/screenkey.json .config/vesktop/themes .keepass .config/Pinta" + +#sync game stuff +target="/home/iceyrazor/mnt-backups/LINUX FILES/home/iceyrazor" +exclude="--exclude **/cc-survival --exclude node_modules --exclude dontsync --exclude **/iceys-linux-stuffs" + + +fsynca + +printf "==CC-survival unsynced\n\n" + +fsyncb + diff --git a/stuff/scripts/system/backup/copy-to-git.sh b/stuff/scripts/system/backup/copy-to-git.sh new file mode 100755 index 0000000..ad2a42d --- /dev/null +++ b/stuff/scripts/system/backup/copy-to-git.sh @@ -0,0 +1,21 @@ +cd ~/ + +fsync () { + rsync -RUurvn --size-only --delete-after $exclude $syncfile "$target" + printf "===commit these changes?\n" + read -p "y/n: " uinput + if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then + printf "\n\n\n" + rsync -PRUurv --size-only --delete-after $exclude $syncfile "$target" + printf "\n===end sync\n---------\n\n" + fi +} + +syncfile=".bash_profile .bashrc .gtkrc-2.0 .wezterm.lua .profile .urlview .vimrc .Xresources .zshrc .config/dwm .config/awesome .config/rofi .config/lf .config/picom.conf .config/nvim .config/screenkey.json stuff/manual-programs/suckless" + +syncfile="$syncfile stuff/scripts/system/stbar stuff/scripts/system/url-handler.sh stuff/scripts/system/backup/copy-to-git.sh stuff/scripts/system/backup/backup.sh" +syncfile="$syncfile stuff/scripts/system/neoboot.sh stuff/scripts/system/math.sh stuff/scripts/system/bri.sh stuff/scripts/system/restart-pipe.sh stuff/scripts/system/set-pri-java.sh" +target=~/stuff/iceys-linux-stuffs +exclude="--exclude check_weth.sh --exclude lua-ls-cc-tweaked --exclude .config/nvim/plugin" + +fsync diff --git a/stuff/scripts/system/bri.sh b/stuff/scripts/system/bri.sh new file mode 100755 index 0000000..b943f30 --- /dev/null +++ b/stuff/scripts/system/bri.sh @@ -0,0 +1 @@ +echo "$1" > /sys/class/backlight/intel_backlight/brightness diff --git a/stuff/scripts/system/math.sh b/stuff/scripts/system/math.sh new file mode 100755 index 0000000..26d4854 --- /dev/null +++ b/stuff/scripts/system/math.sh @@ -0,0 +1,13 @@ +#!/bin/bash +expression=$1 +precision=$2 + +if [ "$precision" == "" ]; then + precision=1; +fi; + +# Perform arithmetic operation using awk +result=$(awk "BEGIN {printf \"%.${precision}f\n\", $expression}" | sed 's/\.0$//') + +# Print the result +echo "$result" diff --git a/stuff/scripts/system/neoboot.sh b/stuff/scripts/system/neoboot.sh new file mode 100755 index 0000000..2df07de --- /dev/null +++ b/stuff/scripts/system/neoboot.sh @@ -0,0 +1,28 @@ +normal() { + randnum=$(($RANDOM % 2)) + + if [ "$randnum" == "1" ]; then + # fastfetch --localip-show-ipv4 0 # | lolcat -as 10000 -S 100 + fortune | cowsay -f fox | lolcat + else + fortune | cowsay -f dragon | lolcat + fi + printf "\n--------------------------------------------------------\n" | lolcat + lsblk --filter 'NAME=~"sd[abcde]"' -o NAME,MOUNTPOINTS | lolcat +} + +laptop() { + if [ "$(($RANDOM % 2))" == "1" ]; then + fastfetch --localip-show-ipv4 0 | lolcat -as 10000 -S 100 + else + uwufetch | lolcat -as 10000 -S 100 + fi + printf "\n--------------------------------------------------------\n" | lolcat -S 100 + lsblk --filter 'NAME=~"sd[abcde]"' -o NAME,MOUNTPOINTS | lolcat -as 10000 -S 100 +} + +if [[ "$(cat /etc/hostname)" == "iceynethp1" ]]; then + laptop +else + normal +fi diff --git a/stuff/scripts/system/restart-pipe.sh b/stuff/scripts/system/restart-pipe.sh new file mode 100755 index 0000000..ec693dc --- /dev/null +++ b/stuff/scripts/system/restart-pipe.sh @@ -0,0 +1 @@ +systemctl --user restart wireplumber pipewire pipewire-pulse diff --git a/stuff/scripts/system/set-pri-java.sh b/stuff/scripts/system/set-pri-java.sh new file mode 100755 index 0000000..35a9769 --- /dev/null +++ b/stuff/scripts/system/set-pri-java.sh @@ -0,0 +1 @@ +sudo renice -20 -p $(sudo pidof java) diff --git a/stuff/scripts/system/stbar/config.txt b/stuff/scripts/system/stbar/config.txt new file mode 100644 index 0000000..3137407 --- /dev/null +++ b/stuff/scripts/system/stbar/config.txt @@ -0,0 +1,2 @@ +full_stat:false +wifi_device:wlo1 diff --git a/stuff/scripts/system/stbar/killbar.sh b/stuff/scripts/system/stbar/killbar.sh new file mode 100755 index 0000000..7e76af2 --- /dev/null +++ b/stuff/scripts/system/stbar/killbar.sh @@ -0,0 +1,10 @@ +pids=$(ps -AO pid | awk '/stbar.sh|newsboat-fetch.sh/ {print $1}') +# pids=$(pstree -pla | grep stbar | sed 's,|,,g' | sed 's/ //g' | sed 's/^ //g' | sed 's/ .*//' | sed 's/[^0-9]*//g') +# pids2=$(ps -AO pid | grep "sh ./newsboat-fetch.sh" | sed 's/S.*//g' | sed 's/^ *//g') + + +echo $pids +$(sleep 3 && xsetroot -name "") & disown + +sudo kill -KILL $pids +doas kill -KILL $pids diff --git a/stuff/scripts/system/stbar/stbar-awesome.sh b/stuff/scripts/system/stbar/stbar-awesome.sh new file mode 100755 index 0000000..84c1894 --- /dev/null +++ b/stuff/scripts/system/stbar/stbar-awesome.sh @@ -0,0 +1,81 @@ +#!/bin/bash +delim='|' + +curr_dir="$(cd "$(dirname "$0")" && pwd)" +#wifi_device=$(cat $curr_dir/config.txt | grep wifi_device | sed 's/wifi_device://') +wifi_device="wlp4s0" +# curr_dir/check_weth.sh "$cur_dir" & + + + +status(){ + +echo " " + +#wifi up or no +sed "s/down/\:\(/;s/up/\:\)/" /sys/class/net/$wifi_device/operstate + +echo "$delim" + +if [ "$(ls /sys/class/power_supply/BAT0/)" ]; then + bat_power=$(cat /sys/class/power_supply/BAT0/capacity) + + echo $bat_is_flash + if (( $bat_power < 15 )); then + bat_power=$bat_power%!!!!!!!!!!! + else + bat_power=$bat_power% + fi + + echo $bat_power + + echo "$delim" +fi + +#rss + +echo RSS:$(newsboat -x print-unread|sed "s/\s.*//; s/Error:/IA/") + +echo "$delim" + +if [ "$(cat $curr_dir/config.txt | grep full_stat)" == "full_stat:true" ]; then + #cpu + echo CPU:$(ps axch -o cmd:15,%cpu --sort=-%cpu | sed "1q")% + + echo "$delim" + + #mem + echo Mem:$(free -mlw | grep Mem: | sed "s/Mem\:\W*[0-9]*\W*//; s/ .*//") + echo $(ps axch -o cmd:15,%mem --sort=-%mem | sed "1q")% + +else + #cpu + echo CPU:$(ps axch -o cmd:15,%cpu --sort=-%cpu | sed "1q" | sed 's/.* //')% + + #mem + echo Mem:$(free -mlw | grep Mem: | sed "s/Mem\:\W*[0-9]*\W*//; s/ .*//") + +fi +echo "$delim" + +#space +#echo \/$(df -h | grep /dev/nvme0n1p3 | sed "s/\/dev\/nvme0n1p3 *[0-9]*.[0-9]*. *[0-9]*.[0-9]*. *//" | sed "s/ .*//") + +#echo \~$(df -h | grep /dev/nvme0n1p4 | sed "s/\/dev\/nvme0n1p4 *[0-9]*.[0-9]*. *[0-9]*.[0-9]*. *//" | sed "s/ .*//") +echo $(df -h -x=used /dev/mapper/system-root | sed '1d' | awk '{print $4}') + +echo "$delim" + +#weather + +if [ "$(cat $curr_dir/weth_str.txt)" != "" ]; then + printf "$(cat $curr_dir/weth_str.txt)" + echo "$delim" +fi + +} + +#while :; do + echo "$(status | tr '\n' ' '0)" +# sleep 1s +#end diff --git a/stuff/scripts/system/stbar/stbar.sh b/stuff/scripts/system/stbar/stbar.sh new file mode 100755 index 0000000..6ca704d --- /dev/null +++ b/stuff/scripts/system/stbar/stbar.sh @@ -0,0 +1,84 @@ +#!/bin/bash +delim='|' + +curr_dir="$(cd "$(dirname "$0")" && pwd)" +wifi_device=$(cat $curr_dir/config.txt | grep wifi_device | sed 's/wifi_device://') +# curr_dir/check_weth.sh "$cur_dir" & + + + +status(){ + +echo " " + +#wifi up or no +sed "s/down/\:\(/;s/up/\:\)/" /sys/class/net/$wifi_device/operstate + +echo "$delim" + +#bat +bat_power=$(cat /sys/class/power_supply/BAT0/capacity) + +echo $bat_is_flash +if (( $bat_power < 15 )); then + bat_power=$bat_power%!!!!!!!!!!! +else + bat_power=$bat_power% +fi + +echo $bat_power + +echo "$delim" + +#rss + +echo RSS:$(newsboat -x print-unread|sed "s/\s.*//; s/Error:/IA/") + +echo "$delim" + +if [ "$(cat $curr_dir/config.txt | grep full_stat)" == "full_stat:true" ]; then + #cpu + echo CPU:$(ps axch -o cmd:15,%cpu --sort=-%cpu | sed "1q")% + + echo "$delim" + + #mem + echo Mem:$(free -mlw | grep Mem: | sed "s/Mem\:\W*[0-9]*\W*//; s/ .*//") + echo $(ps axch -o cmd:15,%mem --sort=-%mem | sed "1q")% + +else + #cpu + echo CPU:$(ps axch -o cmd:15,%cpu --sort=-%cpu | sed "1q" | sed 's/.* //')% + + #mem + echo Mem:$(free -mlw | grep Mem: | sed "s/Mem\:\W*[0-9]*\W*//; s/ .*//") + +fi +echo "$delim" + +#space +echo \/$(df -h | grep /dev/nvme0n1p3 | sed "s/\/dev\/nvme0n1p3 *[0-9]*.[0-9]*. *[0-9]*.[0-9]*. *//" | sed "s/ .*//") + +echo \~$(df -h | grep /dev/nvme0n1p4 | sed "s/\/dev\/nvme0n1p4 *[0-9]*.[0-9]*. *[0-9]*.[0-9]*. *//" | sed "s/ .*//") + +echo "$delim" + +#weather + +if [ "$(cat $curr_dir/weth_str.txt)" != "" ]; then + printf "$(cat $curr_dir/weth_str.txt)" + echo "$delim" +fi + + +#date +date '+%a %m/%d/%Y %I:%M%p' + +} + + +while :; do + xsetroot -name "$(status | tr '\n' ' '0)" + sleep 1s +done + diff --git a/stuff/scripts/system/stbar/weth_str.txt b/stuff/scripts/system/stbar/weth_str.txt new file mode 100755 index 0000000..e69de29 diff --git a/stuff/scripts/system/url-handler.sh b/stuff/scripts/system/url-handler.sh new file mode 100755 index 0000000..b5a1a3a --- /dev/null +++ b/stuff/scripts/system/url-handler.sh @@ -0,0 +1,18 @@ + +url=$@ +prompt_message="Open with:" + +echo $url + +choices=" +clipboard +firefox +" + +choice=$(echo "$choices" | sed /^$/d | dmenu -i -p "$prompt_message") + +if [ "$choice" == "clipboard" ]; then + printf "$url" | xclip -selection clipboard +else + $choice "$url" +fi -- cgit v1.3