tons of little scripts
Signed-off-by: PlexSheep <software@cscherr.de>
This commit is contained in:
parent
45fd2e35d5
commit
71f31bc645
|
@ -1,9 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "To be executed: $@"
|
echo "To be executed: $@"
|
||||||
read -p "Confirm (Y/N): " -n 1 -r
|
read -p "Confirm (Y/N): " -n 1 -r
|
||||||
case "$REPLY" in
|
case "$REPLY" in
|
||||||
y|Y ) echo "es"; eval $@;;
|
y|Y ) echo "es"; eval $@;;
|
||||||
n|N ) echo "o";;
|
n|N ) echo "o";;
|
||||||
* ) echo -e "\ninvalid";;
|
* ) echo -e "\ninvalid";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
|
@ -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 <software@cscherr.de>"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
}
|
|
@ -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 "['<Primary><Alt>1']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-2 "['<Primary><Alt>2']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-3 "['<Primary><Alt>3']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-4 "['<Primary><Alt>4']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-5 "['<Primary><Alt>5']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-6 "['<Primary><Alt>6']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-7 "['<Primary><Alt>7']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-8 "['<Primary><Alt>8']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-9 "['<Primary><Alt>9']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-10 "['<Primary><Alt>0']"
|
||||||
|
|
||||||
|
# move to workspace
|
||||||
|
# same but with shift for qwertz
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-1 "['<Shift><Primary><Alt>1']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-2 "['<Shift><Primary><Alt>2']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-3 "['<Shift><Primary><Alt>3']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-4 "['<Shift><Primary><Alt>4']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-5 "['<Shift><Primary><Alt>5']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-6 "['<Shift><Primary><Alt>6']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-7 "['<Shift><Primary><Alt>7']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-8 "['<Shift><Primary><Alt>8']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-9 "['<Shift><Primary><Alt>9']"
|
||||||
|
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-10 "['<Shift><Primary><Alt>0']"
|
||||||
|
|
|
@ -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 <url> [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
|
|
@ -15,14 +15,8 @@ if [[ "$oldhash" = "$newhash" ]]; then
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo "[$(eval $date)]: setting wallpaper..." | tee -a $logfile
|
echo "[$(eval $date)]: setting wallpaper..." | tee -a $logfile
|
||||||
dbus-send --session --dest=org.kde.plasmashell --type=method_call \
|
gsettings set org.gnome.desktop.background picture-uri file://${filelocation}
|
||||||
/PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:
|
gsettings set org.gnome.desktop.background picture-uri-dark file://${filelocation}
|
||||||
var Desktops = desktops();
|
gsettings set org.gnome.desktop.background picture-options 'stretched'
|
||||||
for (i=0;i<Desktops.length;i++) {
|
|
||||||
d = Desktops[i];
|
|
||||||
d.wallpaperPlugin = "org.kde.image";
|
|
||||||
d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");
|
|
||||||
d.writeConfig("Image", "file://'$filelocation'");
|
|
||||||
}'
|
|
||||||
echo "[$(eval $date)]: done" | tee -a $logfile
|
echo "[$(eval $date)]: done" | tee -a $logfile
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue