Skip to content

Instantly share code, notes, and snippets.

@tunalad
Last active October 21, 2023 15:18
Show Gist options
  • Save tunalad/8316da055eb16586fd809b56f86bf32f to your computer and use it in GitHub Desktop.
Save tunalad/8316da055eb16586fd809b56f86bf32f to your computer and use it in GitHub Desktop.
A wrapper script for curl to send push notifications via ntfy
#!/bin/bash
seed="your seed here"
random_string=$(echo "$seed" | sha256sum | cut -c 1-32)
url="ntfy.sh/$random_string"
message="example"
headers=()
data="-d \"$message\""
while [[ $# -gt 0 ]]; do
case "$1" in
-H|--header)
headers+=("-H \"$2\"")
shift 2
;;
-d|--data)
data="-d \"$2\""
shift 2
;;
*)
shift
;;
esac
done
eval "curl ${headers[*]} $data \"$url\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment