Added lots of things

This commit is contained in:
Allen
2023-08-02 01:11:58 -05:00
parent bb8cac305b
commit 7a6cd133be
27 changed files with 346 additions and 0 deletions

22
.gitignore vendored Normal file
View File

@ -0,0 +1,22 @@
autostart.sh.save
bootloadHID
compileTimer
delayed-suspend-slock.old
dmenu
dmenu_path
dmenu_run
dwm
ec
ethminer
gsearch
mpcInsert
powersettings.old
rofi-network-manager.sh
slock
slock-suspend
snake
st
start_dwm
steam-fix.sh
stest
vis

View File

@ -0,0 +1 @@
My Linux Scripts in /usr/local/bin

8
WindowsRenameFix.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
echo read the comments in this file see a fix
# for f in ./*'('*')'*; do mv -i "$f" "${f/ (*)/}"; done
# for f in ./*/*'('*')'*; do mv -i "$f" "${f/ (*)/}"; done
# for f in ./*/*'('*')'*; do mv -i "$f" "${f/ (*)/}"; done
# etc, for the directory you're in that you want to fix.
# I know this is a garbage implementation, but not the best at bash scripting, so don't know how to recurse through each individual directory

51
autostart.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
export DISPLAY=:0
#Added some programs here since emptty had issues
polybar-restart &
# --- Music Workspace Start ---
#Note: So alacritty specifically (I believe kitty fixed this) has a scaling issue because L/R monitor diff resolutions
#so, as a result terminal apps spawned on LMON and moved to RMON resulting in too large text font so setting to 9.5
#as this is like 97% scaled correctly in most circumstances as a botchy hack for now, just bc I like alacritty default colors
#Update: switched back to kitty using a custom theme that's better looking, alacritty with -o=font.size=9.5 was removed btw
#TERM=alacritty
TERM=kitty
THEMES=include=kitty-themes/themes
THEME=$THEMES/Hybrid.conf
SETTINGS=$THEME
$TERM --class Lyrics -o=$SETTINGS -e "lyrics" &
(sleep 1; $TERM --class Miniplayer -o=$SETTINGS -e "miniplayer") &
# --- Music Workspace End ---
easyeffects --gapplication-service &
lxsession &
/usr/bin/emacs --daemon &
xbindkeys &
xset dpms 300 &
#xss-lock -- slock &
xautolock -locker "slock" -nowlocker "slock -f" -time 5 &
picom --experimental-backends -b &
feh --bg-fill $(/public/wallpapers/mon1.cfg) --bg-fill $(/public/wallpapers/mon2.cfg) &
# /usr/local/bin/trayer-restart # Launch from polybar-restart launcher now
conky -q -c /home/allen/.config/conky-0.conf &
conky -q -c /home/allen/.config/conky-1.conf &
mpDris2 &
playerctld &
copyq &
# --- Start dolphin daemon for desktop portal so you can open files with dolphin without it being open beforehand ---
dolphin --daemon &
# Try to fix gui program issues, couldn't find a working fix outside of xmonad. WMName might be working though, not sure.
#xprop -id "$WINDOWID" -f _NET_WM_NAME 8u -set _NET_WM_NAME LG3D &
#xsetroot -name LG3D &
wmname "LG3D" &
# Start lxappearance to load settings, then close it as we don't need to keep window open
lxappearance &
sleep 1
killall lxappearance

3
clipboardprint.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
sh -c 'sleep 0.5; xdotool type "$(xclip -o -selection clipboard)"'

40
csgoAutoAccepter.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# For monitor 1 2560x1440 btw... (1287, 1055)
center1=$(echo "1300 850")
center2=$(echo "1250 800")
# move to proper spot
xdotool mousemove $center1
echo "Program will exit on mouse move..."
sleep .5
while [ 1 ]; do
xdotool click 1 &
sleep 5
mouseLoc=$(xdotool getmouselocation 2>&1 | sed -rn '${s/x:([0-9]+) y:([0-9]+) .*/\1 \2/p}')
if [ "$center1" != "$mouseLoc" ] && [ "$center2" != "$mouseLoc" ]; then
echo "Mouse moved. Exiting."
exit
fi
# This is messy as hell... but it works, can refine this in the future to make less repetitive...
xdotool mousemove $center2
xdotool click 1 &
sleep 5
mouseLoc=$(xdotool getmouselocation 2>&1 | sed -rn '${s/x:([0-9]+) y:([0-9]+) .*/\1 \2/p}')
if [ "$center1" != "$mouseLoc" ] && [ "$center2" != "$mouseLoc" ]; then
echo "Mouse moved. Exiting."
exit
fi
xdotool mousemove $center1
done

16
lockand Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
xset dpms force off
#Locker seems to die or be not responsive sometimes (not sure why...) so will just use slock -f as an alternative
locker=xautolock
#if [[ $(ps -ef | grep $locker | grep -v grep | wc -l) != 0 ]]; then
#xautolock -locknow
#else
#echo no
slock -f &
#fi
sleep 3
systemctl $1

5
mount-all-vm-sshfs Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
/usr/local/bin/mount-docker-vm-0
/usr/local/bin/mount-arch-vm-0
/usr/local/bin/mount-rpi0

3
mount-arch-vm-0 Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
sshfs -o default_permissions admin@10.1.1.181:/data /mnt/sshfs/arch-vm-0

3
mount-docker-vm-0 Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
sshfs -o default_permissions admin@10.1.1.151:/data /mnt/sshfs/docker-vm-0

16
mount-phone Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
umount /mnt/mtp
echo "Make sure all gvfs, gio, kio, kde, mtp dolphin app that may interfere are closed, automate this in the future"
killall dolphin
killall gvfsd
killall gvfsd-fuse
killall kded5
aft-mtp-mount /mnt/mtp &
#echo "once, the phone is connected, can run: rsync -r -t -v --progress -s --ignore-existing '/mnt/ntfs/samsung-1tb/Users/Allen/Music/' '/mnt/mtp/SD card/Documents/Music'"
echo "Using mtp and rsync is slow as fuck, only do this for when all songs are basically already downloaded"
/usr/local/bin/music-backup-to-phone

4
mount-rpi0 Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
sshfs -o default_permissions pi@10.1.1.150:/media/NAS0/NAS_Storage/services/rpi0 /mnt/sshfs/rpi0

5
music-backup-to-phone Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "The configured transfer is quite slow, to use the faster option, use adb push."
echo "Example working for Pixel 7 Pro: adb push '/mnt/ntfs/samsung-1tb/Users/Allen/Music' '/sdcard/Documents/'"
rsync -r -t -v --progress -s --ignore-existing '/mnt/ntfs/samsung-1tb/Users/Allen/Music/' '/mnt/mtp/Internal shared storage/Documents/Music'

11
paru-helper Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
paru
read -p "Do you want to recompile xmonad? (y/n) " yn
case $yn in
y ) xmonad --recompile;;
n ) exit;;
* ) exit 1;;
esac

31
paru-update-all Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# This program updates the system packages using paru
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
NC="\033[0m" # No Color
echo ''
echo -e $GREEN'UPDATING PACKAGES'$NC
echo -e $GREEN'======================================='$NC
paru -Syyu
echo ''
echo -e $GREEN"================================================================="
echo -e "UPDATE COMPLETED!\n"$NC
echo $(cat /etc/pacman.conf | grep "IgnorePkg =")
read -p "DO YOU WANT TO UPDATE DANGEROUS PACKAGES TOO?
RECOMMENDED EVERY 3 MONTHS (y/N): " -i "y" USER_AGREEMENT
if [ "$USER_AGREEMENT" == "y" ]; then
# Install packages bypassing IgnorePgk
sed '/^IgnorePkg/d' /etc/pacman.conf > /tmp/432143214 | paru -Syu --config /tmp/432143214; rm /tmp/432143214
fi
read -p "Do you want to recompile xmonad? (y/N): " -i "y" XMONAD_UPDATE
if [ "$XMONAD_UPDATE" == "y" ]; then
xmonad --recompile
fi
echo -e "\nUPDATE COMPLETED!"$NC

View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "run: awk '\$0=\"/music/\"\$0' ~/.config/mpd/playlists/GOAT.m3u > ~/Downloads/GOAT.patch.m3u"
echo "Documents/Music/ can change based on the location on the SD Drive, GOAT.m3u can change based on the playlist being imported"

4
patch-playlists-mpd-to-phone Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "run: awk '\$0=\"Documents/Music/\"\$0' ~/.config/mpd/playlists/GOAT.m3u > ~/Downloads/GOAT.patch.m3u"
echo "Documents/Music/ can change based on the location on the SD Drive, GOAT.m3u can change based on the playlist being imported"

8
picom-restart Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
killall picom
#Wait 0.25 seconds so the process can close
sleep 0.25
picom --experimental-backends -b

17
polybar-launcher.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
declare -A screen_map
screen_map[DP-2]=0
screen_map[DP-0]=1
if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
id=${screen_map[$m]}
MONITOR=$m MONITOR_ID="${screen_map[$m]}" polybar --config=~/.config/polybar/config-$id-top.ini & #TOP
MONITOR=$m MONITOR_ID="${screen_map[$m]}" polybar --config=~/.config/polybar/config-$id-bottom.ini & #BOTTOM
done
fi
# Spawn trayer from here as Z clipping issue can be fixed from restarting trayer after polybar
/usr/local/bin/trayer-restart

3
polybar-restart Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
killall polybar > /dev/null 2>&1
nohup /usr/local/bin/polybar-launcher.sh > /dev/null 2>&1 &

6
reinstall-grub Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
echo "Run the following commands:"
echo
echo "0. Make sure you have the proper drive and EFI partition mounted under /boot/efi (Ex: sudo mount /dev/sda1 /boot/efi)"
echo "1. sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB"
echo "2. sudo grub-mkconfig -o /boot/grub/grub.cfg"

16
reload-ethernet.sh Executable file
View File

@ -0,0 +1,16 @@
echo "Shutting Down Ethernet Connection..."
nmcli c d "Wired connection 1"
sleep 2
echo "Shutting Down Ethernet Device..."
nmcli d d "enp0s31f6"
sleep 2
echo "Starting Up Ethernet Device..."
nmcli d u "enp0s31f6"
sleep 2
echo "Starting up Ethernet Connection..."
nmcli c u "Wired connection 1"
echo Done.

25
rocksmith.sh Executable file
View File

@ -0,0 +1,25 @@
STEAMLIBRARY=/home/allen/.local/share/Steam
PROTON=/usr/share/steam/compatibilitytools.d/proton-ge-custom/files
#echo "Note: CLDC doesn't seem to be working sadly and was only able to get this working via 'previous_version' beta"
#echo "To enable the hidden beta, type in 'JustInCaseWeNeedIt'"
#echo "Previous Version Beta must be set in Steam -> Rocksmith 2014 -> Settings -> Betas"
#echo "Also check this note: https://www.reddit.com/r/rocksmith/comments/xa49mq/important_update_coming_to_rocksmith_2014/"
#echo "Also note that if outputs/inputs are incorrect, disable all but Speakers and Audio Adapter in pavucontrol"
#echo
#echo "'cd'ing into the steam game directory solves the missing CDLC issue!"
#echo "Only remaining problem really is that you cannot purchases CLDCs from this launch method, so must start game through steam"
#echo
echo "Note: look into a way to use predefined audio devices so I don't have to disable everything in pavucontrol"
echo "View all commented out notes in this shell file"
/usr/local/bin/rocksmith_updateCDLC.sh
echo
echo "Waiting 5 seconds..."
echo
sleep 5
#Important that all last 3 variables lines ran at same time (PIPEWIRE_LATENCY + WINEPREFIX + wine executable)
cd /home/allen/.local/share/Steam/steamapps/common/Rocksmith2014
PIPEWIRE_LATENCY=256/48000 WINEPREFIX=$STEAMLIBRARY/steamapps/compatdata/221680/pfx "$PROTON/bin/wine" $STEAMLIBRARY/steamapps/common/Rocksmith2014/Rocksmith2014.exe

10
rocksmith_updateCDLC.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
echo "Running this while the game is open works, but you must exit to the title screen for the songs to appear"
echo
echo "Moving all game DLCs from Downloads to DLC Folder"
# First move to "RocksmithCLDC" to chmod
cp /home/allen/Downloads/*.psarc /home/allen/Downloads/RSCDLCBackup/
mv /home/allen/Downloads/*.psarc /home/allen/Downloads/RocksmithCDLC/
chmod -R 755 /home/allen/Downloads/RocksmithCDLC/
mv /home/allen/Downloads/RocksmithCDLC/* /home/allen/.local/share/Steam/steamapps/common/Rocksmith2014/dlc

27
switchcontrol Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# A program that maps the paramaters [1 -> length - 1] to a variable P[1 -> length - 1] and then sends it in a HTTP post requset to HomeAssistant web hook automation.
WEBHOOK_ID="3Rvdb4qZDgcKD2EiZgV328xdhWLVkjn8dVgSKr13JkIb5eP0RFNPQjgYDey16R64"
WEBHOOK_URL="http://0.hassio.local/api/webhook/$WEBHOOK_ID"
CURL_REQ="curl -X POST $WEBHOOK_URL"
#CURL_REQ=("curl" "-X" "POST" "$WEBHOOK_URL")
declare -a params_array
i=0
j=0
for var in "$@"
do
params_array[$i]='-d'
((i++))
params_array[$((i))]="P$((i-1+j))=$var"
((i++))
((j-=1))
done
$CURL_REQ "${params_array[@]}"

4
trayer-restart Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
killall trayer
nohup trayer --edge bottom --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x282a2e --height 32 --distancefrom top --distance 5 &> /dev/null 2>&1 &

3
update_mirrors Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
reflector --save /etc/pacman.d/mirrorlist --country "United States,Canada" --protocol https --latest 10