Rename all shell script files to use .sh extensions for consistency and better editor support (pushover-send, split-1G, xz, zipdir). Update default.nix references to match the new filenames. Add a new ,yt-dlp script that runs yt-dlp from nixpkgs-unstable via `nix run`, so it's always up to date without needing to be in the system packages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1022 B
Bash
Executable File
48 lines
1022 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Send a pushover notification.
|
|
# Usage: pushover-send [--pid <pid>] [message]
|
|
# --pid <pid> Wait for process to finish before sending
|
|
# message Optional message (default: "Job done.")
|
|
|
|
pid=""
|
|
message=""
|
|
|
|
# Parse arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--pid)
|
|
pid="$2"
|
|
shift 2
|
|
;;
|
|
*)
|
|
message="$1"
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Default message
|
|
if [ -z "$message" ]; then
|
|
message="Job done."
|
|
fi
|
|
|
|
# Wait for PID if specified
|
|
if [ -n "$pid" ]; then
|
|
if ! [[ "$pid" =~ ^[0-9]+$ ]]; then
|
|
echo "Error: PID must be a number" >&2
|
|
exit 1
|
|
fi
|
|
if [ ! -d "/proc/$pid" ]; then
|
|
echo "Error: Process $pid does not exist" >&2
|
|
exit 1
|
|
fi
|
|
tail --pid="$pid" -f /dev/null 2>/dev/null
|
|
fi
|
|
|
|
curl \
|
|
https://api.pushover.net/1/messages.json \
|
|
--data-urlencode "token=ak8z7cbxim2t7eksvj7dtudo6cdxgj" \
|
|
--data-urlencode "user=u8hjgdf1hquocmy682w9xfmpf3479u" \
|
|
--data-urlencode "priority=1" \
|
|
--data-urlencode "message=$message"
|