Update scripts.
This commit is contained in:
parent
9eb0fa22a9
commit
614e626902
8
backuper
8
backuper
@ -1,17 +1,17 @@
|
|||||||
#!/bin/env bash
|
#!/bin/env bash
|
||||||
|
|
||||||
copy () {
|
copy() {
|
||||||
while read -r Line; do
|
while read -r Line; do
|
||||||
echo "Syncing $(basename "$Line")"
|
echo "Syncing $(basename "$Line")"
|
||||||
rsync -ahAX -v --delete "$Line" "$HOME"/.local/backup
|
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)
|
x=$(date +%d.%m.%y)
|
||||||
cd "$HOME/.local" || exit 1
|
cd "$HOME/.local" || exit 1
|
||||||
[ ! -d "$HOME/.local/cloud" ] || mkdir -p "$HOME/.local/cloud"
|
[ ! -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
|
[ -z "$*" ] && exit 1
|
||||||
|
8
cue2chd
Executable file
8
cue2chd
Executable 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
44
day
Executable 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"
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/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
|
# Turn off laptop monitor
|
||||||
xrandr --output eDP --off
|
xrandr --output eDP --off
|
||||||
# Make sure it's running at 144hz
|
# Make sure it's running at 144hz
|
||||||
xrandr --output HDMI-A-0 --mode 1920x1080 --rate 144
|
xrandr --output HDMI-A-0 --mode 1920x1080 --rate 144
|
||||||
# Enable tear free
|
# Enable tear free
|
||||||
xrandr --output HDMI-A-0 --set TearFree on
|
xrandr --output HDMI-A-0 --set TearFree on
|
||||||
else
|
|
||||||
# Just enable tearfree
|
|
||||||
xrandr --output eDP --set TearFree on
|
|
||||||
fi
|
fi
|
||||||
|
24
gaming-time
24
gaming-time
@ -1,51 +1,51 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
disableCronJobs () {
|
disableCronJobs() {
|
||||||
crontab -l | sed '2 s/./#&/' | crontab
|
crontab -l | sed '2 s/./#&/' | crontab
|
||||||
}
|
}
|
||||||
|
|
||||||
enableCronJobs () {
|
enableCronJobs() {
|
||||||
crontab -l | sed '2s/^.//' | crontab
|
crontab -l | sed '2s/^.//' | crontab
|
||||||
}
|
}
|
||||||
|
|
||||||
wayland_off () {
|
wayland_off() {
|
||||||
start-program wbg ~/pics/wallpapers/spooky_spill.jpg
|
start-program wbg ~/pics/wallpapers/spooky_spill.jpg
|
||||||
start-program waybar
|
start-program waybar
|
||||||
}
|
}
|
||||||
|
|
||||||
wayland_on () {
|
wayland_on() {
|
||||||
kill-nicely wbg
|
kill-nicely wbg
|
||||||
kill-nicely waybar
|
kill-nicely waybar
|
||||||
}
|
}
|
||||||
|
|
||||||
x11_off () {
|
x11_off() {
|
||||||
start-program picom
|
start-program picom
|
||||||
# start-program polybar top -r
|
# start-program polybar top -r
|
||||||
start-program xmobar ~/.config/xmobar/xmobarrc
|
start-program xmobar ~/.config/xmobar/xmobarrc
|
||||||
start-program unclutter --timeout 5
|
# start-program unclutter --timeout 5
|
||||||
toggle-xrandr on
|
toggle-xrandr on
|
||||||
sleep 2
|
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 picom
|
||||||
# kill-nicely polybar
|
# kill-nicely polybar
|
||||||
kill-nicely xmobar
|
kill-nicely xmobar
|
||||||
kill-nicely trayer-srg
|
kill-nicely trayer
|
||||||
kill-nicely unclutter
|
# kill-nicely unclutter
|
||||||
toggle-xrandr off
|
toggle-xrandr off
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f "$HOME"/.cache/gaming.lock ]; then
|
if [ -f "$HOME"/.cache/gaming.lock ]; then
|
||||||
[ "$XDG_SESSION_TYPE" = "wayland" ] && wayland_off || x11_off
|
[ "$XDG_SESSION_TYPE" = "wayland" ] && wayland_off || x11_off
|
||||||
start-program transmission-daemon
|
# start-program transmission-daemon
|
||||||
start-program syncthing
|
start-program syncthing
|
||||||
rm "$HOME"/.cache/gaming.lock
|
rm "$HOME"/.cache/gaming.lock
|
||||||
quick-notify "Gaming Time" "OFF"
|
quick-notify "Gaming Time" "OFF"
|
||||||
else
|
else
|
||||||
[ "$XDG_SESSION_TYPE" = "wayland" ] && wayland_on || x11_on
|
[ "$XDG_SESSION_TYPE" = "wayland" ] && wayland_on || x11_on
|
||||||
transmission-remote --exit
|
# transmission-remote --exit
|
||||||
syncthing cli operations shutdown
|
syncthing cli operations shutdown
|
||||||
kill-nicely ferdium
|
kill-nicely ferdium
|
||||||
touch "$HOME"/.cache/gaming.lock
|
touch "$HOME"/.cache/gaming.lock
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ $XDG_SESSION_TYPE = "wayland" ]; then
|
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||||
if riverctl list-inputs | grep -i 'mouse' | grep -i 'MOSART' >> /dev/null ; 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
|
riverctl input pointer-1267-12610-ELAN0515:01_04F3:3142_Touchpad events disabled
|
||||||
else
|
else
|
||||||
riverctl input pointer-1267-12610-ELAN0515:01_04F3:3142_Touchpad events enabled
|
riverctl input pointer-1267-12610-ELAN0515:01_04F3:3142_Touchpad events enabled
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
if xinput list | grep -i 'mouse' | grep -i 'MOSART' >> /dev/null; then
|
if xinput list | grep -i 'mouse' | grep -i 'MOSART' >>/dev/null; then
|
||||||
exec `xinput disable ELAN0515:01\ 04F3:3142\ Touchpad`
|
exec $(xinput disable ELAN0515:01\ 04F3:3142\ Touchpad)
|
||||||
else
|
else
|
||||||
exec `xinput enable ELAN0515:01\ 04F3:3142\ Touchpad`
|
exec $(xinput enable ELAN0515:01\ 04F3:3142\ Touchpad)
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
39
note
Executable file
39
note
Executable 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
13
ns
Executable 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
39
pblog
Executable 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
26
t
@ -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
|
|
@ -1,10 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
doIt() {
|
doIt() {
|
||||||
if xrandr | grep 'HDMI-A-0' | grep connected >/dev/null; then
|
if xrandr | grep 'HDMI-A-0' | grep disconnected >/dev/null; then
|
||||||
xrandr --output HDMI-A-0 --set TearFree "$1"
|
xrandr --output eDP --set TearFree "$1"
|
||||||
else
|
else
|
||||||
xrandr --output eDP --set TearFree "on"
|
xrandr --output HDMI-A-0 --set TearFree "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user