Add scripts

main
trivernis 10 months ago
parent d6c79d8e3f
commit 265d2a1f66
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -0,0 +1,70 @@
#!/bin/nu
$env.BORG_REPO = '/run/media/trivernis/Backup'
let BACKUP_PATHS = ([
~/Documents
~/Videos
~/Pictures/
~/Music
~/.config
~/.zshrc
~/.local
/mnt/Data/Cloud/Nextcloud/
/mnt/Data/Bilder/
/mnt/Data/Dokumente/
/mnt/Data/Filme/
/mnt/Data/Audio/
/mnt/Massdata/
/etc
] | path expand )
if (pgrep borg | length) > 0 {
echo "Borg is running"
exit
}
borg break-lock
echo "Creating archive"
(borg create
--progress
--warning
--filter AME
--compression zstd
--exclude-caches
--exclude '*/.cache'
--exclude '*/Rust/*/target'
--exclude '*/target/debug'
--exclude '*/target/release'
--exclude '*/node_modules'
--exclude '*/massdata.tar.gz'
--exclude '*/dynmap/web/tiles'
--exclude '*/work/*decompile'
--exclude '*/PortableGit*'
--exclude '*.pyc'
--exclude '*/Java/*/build'
--exclude '*/Java/*/out/artifacts'
--exclude '*/Java/*/target'
--exclude '*/Kotlin/*/target'
--exclude '*/Kotlin/*/out'
--exclude '*/Kotlin/*/build'
--exclude '*/.local/share/Steam'
--list
--stats
'::{hostname}-{now}'
$BACKUP_PATHS
)
echo "Deleting old files"
(borg prune
--progress
--list
--glob-archives '{hostname}-*'
--show-rc
--keep-daily 2
--keep-weekly 2
--keep-monthly 1
)
echo "Running check for five minutes"
(borg check
--progress
--repository-only
--max-duration 300
)

@ -0,0 +1,15 @@
#!/bin/nu
def main [
dir: string # The directory that contains the rust projects
] {
echo $"Cleaning ($dir)"
(
ls $dir
| get name
| where ($it | ls $it | where name =~ 'Cargo.toml' | length ) > 0
| par-each { cd $in; cargo clean }
| ignore
)
echo $"($dir) cleaned"
}

@ -0,0 +1,2 @@
#!/usr/bin/bash
until gpg --pinentry-mode loopback $@ || (( count++ >= 5 )); do echo "Try again!"; done

@ -0,0 +1,23 @@
#!/bin/env nu
def main [] {
zellij --layout {{dirs.config}}/zellij/development.toml
}
def `main open-file` [path: string] {
match ($path | path parse | get extension | str downcase) {
"png" => { open-image $path }
"jpg" => { open-image $path }
"jpeg" => { open-image $path }
_ => { open-editor $path }
}
}
def open-editor [path: string] {
zellij ac move-focus right
zellij ac write-chars $":open ($path)\r"
}
def open-image [path: string] {
zellij ac new-pane -f -- chafa -C on --scale max $path
}

@ -0,0 +1,8 @@
export def `ytdl playlist` [url: string] {
yt-dlp --yes-playlist -N 8 --playlist-reverse --embed-metadata --sponsorblock-mark sponsor -f "bv[vcodec~='av01\\..*']+ba / bv+ba" -o "%(uploader)s - %(title)s - %(id)s.%(ext)s" $url
}
export def `ytdl playlist 1080p` [url: string] {
yt-dlp --yes-playlist -N 8 --playlist-reverse --embed-metadata --sponsorblock-mark sponsor -f "bv[height=1080][vcodec~='av01\\..*']+ba / bv[height=1080]+ba" -o "%(uploader)s - %(title)s - %(id)s.%(ext)s" $url
}
Loading…
Cancel
Save