Update scripts.

This commit is contained in:
CronyAkatsuki 2024-12-25 21:14:35 +01:00
parent 9eb0fa22a9
commit 614e626902
12 changed files with 201 additions and 101 deletions

View File

@ -1,17 +1,17 @@
#!/bin/env bash
copy () {
copy() {
while read -r Line; do
echo "Syncing $(basename "$Line")"
rsync -ahAX -v --delete "$Line" "$HOME"/.local/backup
done <<< "$(cat "$HOME"/.config/rsync/sync-list)"
done <<<"$(cat "$HOME"/.config/rsync/sync-list)"
}
encrypt () {
encrypt() {
x=$(date +%d.%m.%y)
cd "$HOME/.local" || exit 1
[ ! -d "$HOME/.local/cloud" ] || mkdir -p "$HOME/.local/cloud"
tar cv -I"zstd -19 -T0" "backup" | age -r "age1chj26ez7ucr2smkr8sfc9ddaa0fcyfljh5f5uk5kuyd8ctahs9wslfs708" > "$HOME/.local/cloud/backup-$x.tar.zst.age"
tar cv -I"zstd -19 -T0" "backup" | age -r "age1chj26ez7ucr2smkr8sfc9ddaa0fcyfljh5f5uk5kuyd8ctahs9wslfs708" >"$HOME/.local/cloud/backup-$x.tar.zst.age"
}
[ -z "$*" ] && exit 1

8
cue2chd Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
for File in *.cue
do
[ -f "$File" ] || continue
chdman createcd -i "$File" -o "${File%.cue}.chd"
rm -v "$File" "${File%.cue}"*.bin
done

44
day Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# Based on day script from mischavandenburg
# url: https://github.com/mischavandenburg/dotfiles/blob/main/scripts/day
today=$(date +"%Y-%m-%d")
tomorrow=$(date -d "tomorrow" '+%Y-%m-%d')
yesterday=$(date -d "yesterday" '+%Y-%m-%d')
file="$SECOND_BRAIN"'/periodic/daily/'"$today.md"
cd "$SECOND_BRAIN" || exit 1
new_note() {
touch "$file"
# Give me a nice format
cat <<EOF >"$file"
# $today
[[$yesterday]] - [[$tomorrow]]
## Intention
What do I want to achieve today and tomorrow?
## Tracking
- [ ] Cycle
- [ ] Strength training
- [ ] Watch a movie or tv show episode
- [ ] Play/finish a game
- [ ] Post a blog post
- [ ] Check servers
- [ ] Check backups
## Log
EOF
}
if [ ! -f "$file" ]; then
new_note
fi
nvim '+ normal Gzzo' "$file"

View File

@ -1,13 +1,13 @@
#!/bin/sh
if xrandr | grep 'HDMI-A-0' | grep connected >/dev/null; then
if xrandr | grep 'HDMI-A-0' | grep disconnected >/dev/null; then
# Just enable tearfree
xrandr --output eDP --set TearFree on
else
# Turn off laptop monitor
xrandr --output eDP --off
# Make sure it's running at 144hz
xrandr --output HDMI-A-0 --mode 1920x1080 --rate 144
# Enable tear free
xrandr --output HDMI-A-0 --set TearFree on
else
# Just enable tearfree
xrandr --output eDP --set TearFree on
fi

View File

@ -1,51 +1,51 @@
#!/bin/sh
disableCronJobs () {
disableCronJobs() {
crontab -l | sed '2 s/./#&/' | crontab
}
enableCronJobs () {
enableCronJobs() {
crontab -l | sed '2s/^.//' | crontab
}
wayland_off () {
wayland_off() {
start-program wbg ~/pics/wallpapers/spooky_spill.jpg
start-program waybar
}
wayland_on () {
wayland_on() {
kill-nicely wbg
kill-nicely waybar
}
x11_off () {
x11_off() {
start-program picom
# start-program polybar top -r
start-program xmobar ~/.config/xmobar/xmobarrc
start-program unclutter --timeout 5
# start-program unclutter --timeout 5
toggle-xrandr on
sleep 2
start-program trayer-srg --edge top --align right --widthtype request --padding 6 --iconspacing 7 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x303446 --height 24 -l
start-program trayer --edge top --align right --widthtype request --padding 6 --iconspacing 7 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x303446 --height 24 -l
}
x11_on () {
x11_on() {
kill-nicely picom
# kill-nicely polybar
kill-nicely xmobar
kill-nicely trayer-srg
kill-nicely unclutter
kill-nicely trayer
# kill-nicely unclutter
toggle-xrandr off
}
if [ -f "$HOME"/.cache/gaming.lock ]; then
[ "$XDG_SESSION_TYPE" = "wayland" ] && wayland_off || x11_off
start-program transmission-daemon
# start-program transmission-daemon
start-program syncthing
rm "$HOME"/.cache/gaming.lock
quick-notify "Gaming Time" "OFF"
else
[ "$XDG_SESSION_TYPE" = "wayland" ] && wayland_on || x11_on
transmission-remote --exit
# transmission-remote --exit
syncthing cli operations shutdown
kill-nicely ferdium
touch "$HOME"/.cache/gaming.lock

View File

@ -1,17 +1,17 @@
#!/bin/sh
if [ $XDG_SESSION_TYPE = "wayland" ]; then
if riverctl list-inputs | grep -i 'mouse' | grep -i 'MOSART' >> /dev/null ; then
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
if riverctl list-inputs | grep -i 'mouse' | grep -i 'MOSART' >>/dev/null; then
riverctl input pointer-1267-12610-ELAN0515:01_04F3:3142_Touchpad events disabled
else
riverctl input pointer-1267-12610-ELAN0515:01_04F3:3142_Touchpad events enabled
fi
exit 0
else
if xinput list | grep -i 'mouse' | grep -i 'MOSART' >> /dev/null; then
exec `xinput disable ELAN0515:01\ 04F3:3142\ Touchpad`
if xinput list | grep -i 'mouse' | grep -i 'MOSART' >>/dev/null; then
exec $(xinput disable ELAN0515:01\ 04F3:3142\ Touchpad)
else
exec `xinput enable ELAN0515:01\ 04F3:3142\ Touchpad`
exec $(xinput enable ELAN0515:01\ 04F3:3142\ Touchpad)
fi
exit 0
fi

39
note Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
if [ $# -eq 0 ]; then
cd "$SECOND_BRAIN"/notes || exit 1
nvim .
exit 0
fi
open_file() {
cd "$SECOND_BRAIN"/notes || exit 1
nvim "${1}.md"
}
remove_file() {
cd "$SECOND_BRAIN"/notes || exit 1
if [ -f "${1}.md" ]; then
rm "${1}.md"
else
echo "File didn't exist"
fi
}
if [ $# -eq 1 ]; then
open_file "$1"
exit 0
elif [ $# -ne 2 ]; then
echo "You need to provide action and file name."
exit 1
fi
case "$1" in
rm)
remove_file "$2"
exit 0
;;
*)
exit 1
;;
esac

13
ns Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Provide a script name"
exit 1
else
name="$1"
fi
touch "$name"
chmod +x "$name"
echo "#!/bin/sh" > "$name"
nvim "+ normal Gzzo" "$name"

39
pblog Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
if [ $# -eq 0 ]; then
cd "$SECOND_BRAIN"/blog || exit 1
nvim .
exit 0
fi
open_file() {
cd "$SECOND_BRAIN"/blog || exit 1
nvim "${1}.md"
}
remove_file() {
cd "$SECOND_BRAIN"/blog || exit 1
if [ -f "${1}.md" ]; then
rm "${1}.md"
else
echo "File didn't exist"
fi
}
if [ $# -eq 1 ]; then
open_file "$1"
exit 0
elif [ $# -ne 2 ]; then
echo "You need to provide action and file name."
exit 1
fi
case "$1" in
rm)
remove_file "$2"
exit 0
;;
*)
exit 1
;;
esac

26
t
View File

@ -1,26 +0,0 @@
#!/bin/sh
[ "$1" ] && result=$(zoxide query $1) || result=$(zoxide query -l | fzf --prompt "Choose directory: ")
[ -z "$result" ] && exit 0
name=$(basename $result)
session=$(tmux list-sessions | grep $name | awk '{print $1}' | sed 's/.$//')
if [ -z "$TMUX" ]; then
if [ -z "$session" ]; then
cd $result
tmux new-session -s $name
else
tmux attach -t $session
fi
else
if [ -z "$session" ]; then
cd $result
tmux new-session -d -s $name
tmux switch-client -t $name
else
tmux switch-client -t $session
fi
fi

View File

@ -1,10 +1,10 @@
#!/bin/sh
doIt() {
if xrandr | grep 'HDMI-A-0' | grep connected >/dev/null; then
xrandr --output HDMI-A-0 --set TearFree "$1"
if xrandr | grep 'HDMI-A-0' | grep disconnected >/dev/null; then
xrandr --output eDP --set TearFree "$1"
else
xrandr --output eDP --set TearFree "on"
xrandr --output HDMI-A-0 --set TearFree "$1"
fi
}

17
vpn
View File

@ -1,17 +0,0 @@
#!/bin/sh
up () {
transmission-remote --exit
sudo wg-quick up $1
exit
}
down () {
sudo wg-quick down $1
start-program transmission-daemon
exit
}
[ "$2" = "up" ] && up $1
[ "$2" = "down" ] && down $1
exit 1