diff --git a/borg-backup.homeserver.sh b/borg-backup.homeserver.sh old mode 100755 new mode 100644 diff --git a/borg-backup.snowboard.sh b/borg-backup.snowboard.sh old mode 100755 new mode 100644 diff --git a/borg-backup.theseus.sh b/borg-backup.theseus.sh old mode 100755 new mode 100644 diff --git a/btrfs-raid-status.sh b/btrfs-raid-status.sh old mode 100755 new mode 100644 diff --git a/confirm-important.sh b/confirm-important.sh old mode 100755 new mode 100644 diff --git a/confirm.sh b/confirm.sh old mode 100755 new mode 100644 index c9153bb..c10c08f --- a/confirm.sh +++ b/confirm.sh @@ -1,9 +1,8 @@ #!/bin/bash echo "To be executed: $@" read -p "Confirm (Y/N): " -n 1 -r -case "$REPLY" in +case "$REPLY" in y|Y ) echo "es"; eval $@;; n|N ) echo "o";; * ) echo -e "\ninvalid";; esac - diff --git a/couchdb-client.sh b/couchdb-client.sh new file mode 100644 index 0000000..cd7ec03 --- /dev/null +++ b/couchdb-client.sh @@ -0,0 +1,14 @@ +export COUCHDB_HOST=couchdb.homeserver.box +export COUCHDB_USER=admin +export COUCHDB_PASSWORD=setme +export COUCHDB +function couchdb() { + if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -n "$3" ]]; then + echo "USAGE: $0 METHOD URI" + return 1 + fi + method=$1 + local="https://${COUCHDB_USER}:${COUCHDB_PASSWORD}@${COUCHDB_HOST}/${2}" + echo "request: $method $local" + curl -X $method "$local" +} diff --git a/debpkg.sh b/debpkg.sh new file mode 100644 index 0000000..dd0a69d --- /dev/null +++ b/debpkg.sh @@ -0,0 +1,86 @@ +# Create a Debian package from a binary +# Usage: make_binary_deb binary_path package_name version +make_binary_deb() { + local binary="$1" + local pkgname="$2" + local version="$3" + local maintainer="Christoph J. Scherr " + + # Check if all arguments are provided + if [ -z "$binary" ] || [ -z "$pkgname" ] || [ -z "$version" ]; then + echo "Usage: make_binary_deb binary_path package_name version" + return 1 + fi + + # Check if binary exists + if [ ! -f "$binary" ]; then + echo "Error: Binary $binary not found" + return 1 + } + + # Create package directory structure + local pkgdir="${pkgname}_${version}" + mkdir -p "${pkgdir}/usr/local/bin" + mkdir -p "${pkgdir}/DEBIAN" + + # Copy and set permissions + cp "$binary" "${pkgdir}/usr/local/bin/" + chmod 755 "${pkgdir}/usr/local/bin/$(basename "$binary")" + + # Create control file + cat > "${pkgdir}/DEBIAN/control" << EOF +Package: $pkgname +Version: $version +Section: utils +Priority: optional +Architecture: amd64 +Maintainer: $maintainer +Description: Binary package for $(basename "$binary") + Automatically packaged binary for $(basename "$binary") +EOF + + # Build package + dpkg-deb --build "$pkgdir" + + # Clean up + rm -rf "$pkgdir" + + echo "Package created: ${pkgdir}.deb" +} + +# Install a downloaded binary as a Debian package +# Usage: install_binary_as_deb binary_url package_name version +install_binary_as_deb() { + local url="$1" + local pkgname="$2" + local version="$3" + + if [ -z "$url" ] || [ -z "$pkgname" ] || [ -z "$version" ]; then + echo "Usage: install_binary_as_deb binary_url package_name version" + return 1 + } + + # Create temp directory + local tmpdir=$(mktemp -d) + cd "$tmpdir" + + # Download and extract if it's a tar.gz + if [[ "$url" == *".tar.gz" ]]; then + wget "$url" -O "${pkgname}.tar.gz" + tar xf "${pkgname}.tar.gz" + # Assume binary has same name as package + local binary="$pkgname" + else + wget "$url" -O "$pkgname" + chmod +x "$pkgname" + local binary="$pkgname" + fi + + # Create and install package + make_binary_deb "$binary" "$pkgname" "$version" + sudo dpkg -i "${pkgname}_${version}.deb" + + # Clean up + cd - > /dev/null + rm -rf "$tmpdir" +} diff --git a/download-with-sftp.sh b/download-with-sftp.sh old mode 100755 new mode 100644 diff --git a/gnome-hotkeys.sh b/gnome-hotkeys.sh new file mode 100644 index 0000000..18fcec8 --- /dev/null +++ b/gnome-hotkeys.sh @@ -0,0 +1,29 @@ +set -e +# list all +# gsettings list-recursively org.gnome.desktop.wm.keybindings + +# switch to workspace +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['1']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-2 "['2']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-3 "['3']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-4 "['4']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-5 "['5']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-6 "['6']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-7 "['7']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-8 "['8']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-9 "['9']" +gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-10 "['0']" + +# move to workspace +# same but with shift for qwertz +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-1 "['1']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-2 "['2']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-3 "['3']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-4 "['4']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-5 "['5']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-6 "['6']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-7 "['7']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-8 "['8']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-9 "['9']" +gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-10 "['0']" + diff --git a/mail-logger.homeserver.sh b/mail-logger.homeserver.sh old mode 100755 new mode 100644 diff --git a/mail-logger.snowboard.sh b/mail-logger.snowboard.sh old mode 100755 new mode 100644 diff --git a/mail-script b/mail-script old mode 100755 new mode 100644 diff --git a/monitoweb.sh b/monitoweb.sh new file mode 100644 index 0000000..66d4489 --- /dev/null +++ b/monitoweb.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +url="$1" +interval="${2:-60}" # Default to 60 seconds if not specified + +if [ -z "$url" ]; then + echo "Usage: $0 [interval_seconds]" + exit 1 +fi + +# Test if notify-send is available +if ! command -v notify-send >/dev/null 2>&1; then + echo "notify-send not found. Installing libnotify-bin..." + sudo apt-get install libnotify-bin +fi + +# Test notification +notify-send "Test" "Testing notifications..." +echo "If you didn't see a notification, there might be an issue with your notification daemon" + +old_hash="" + +while true; do + new_hash=$(curl -s "$url" | sha256sum | cut -d' ' -f1) + + if [ -n "$old_hash" ] && [ "$old_hash" != "$new_hash" ]; then + echo "CHANGE DETECTED! $(date)" + + # Try multiple notification methods + notify-send -u critical "Website Changed!" "Changes detected at $url" + + # # Alternative: Use zenity if available + # if command -v zenity >/dev/null 2>&1; then + # zenity --info --text="Website changed: $url" & + # fi + # + # Also try to make a sound + if command -v paplay >/dev/null 2>&1; then + paplay --volume=17000 /usr/share/sounds/freedesktop/stereo/complete.oga & + elif command -v spd-say >/dev/null 2>&1; then + spd-say "Website changed" + fi + fi + + old_hash=$new_hash + sleep $interval +done diff --git a/mount-docker-sockets.sh b/mount-docker-sockets.sh old mode 100755 new mode 100644 diff --git a/tailscale.sh b/tailscale.sh old mode 100755 new mode 100644 diff --git a/wakehome.sh b/wakehome.sh old mode 100755 new mode 100644 diff --git a/wanikaliwallpaper-cinnamon.sh b/wanikaliwallpaper-cinnamon.sh old mode 100755 new mode 100644 diff --git a/wanikaliwallpaper-plasma.sh b/wanikaliwallpaper-plasma.sh old mode 100755 new mode 100644 index eac1d8f..01a2377 --- a/wanikaliwallpaper-plasma.sh +++ b/wanikaliwallpaper-plasma.sh @@ -15,14 +15,8 @@ if [[ "$oldhash" = "$newhash" ]]; then exit else echo "[$(eval $date)]: setting wallpaper..." | tee -a $logfile - dbus-send --session --dest=org.kde.plasmashell --type=method_call \ - /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string: - var Desktops = desktops(); - for (i=0;i