initial commit: silly simple notifications pub/sub with ntfy.sh
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
17c9fcfc93
commit
b68358a57a
5 changed files with 72 additions and 2 deletions
14
README.md
14
README.md
|
@ -1,3 +1,13 @@
|
|||
# ntfy-playgroung
|
||||
# Notifications Playground
|
||||
|
||||
Playing with https://ntfy.sh/
|
||||
|
||||
```shell
|
||||
curl \
|
||||
-H "Title: Unauthorized access detected" \
|
||||
-H "Priority: urgent" \
|
||||
-H "Tags: warning,skull,poop" \
|
||||
-d "Hi, from $(hostname)" \
|
||||
ntfy.sh/farts
|
||||
```
|
||||
|
||||
Playing with https://ntfy.sh/
|
20
README.md.orig
Normal file
20
README.md.orig
Normal file
|
@ -0,0 +1,20 @@
|
|||
<<<<<<< HEAD
|
||||
# ntfy-playgroung
|
||||
|
||||
Playing with https://ntfy.sh/
|
||||
||||||| (empty tree)
|
||||
=======
|
||||
# Notifications Playground
|
||||
|
||||
Playing with https://ntfy.sh/
|
||||
|
||||
```shell
|
||||
curl \
|
||||
-H "Title: Unauthorized access detected" \
|
||||
-H "Priority: urgent" \
|
||||
-H "Tags: warning,skull,poop" \
|
||||
-d "Hi, from $(hostname)" \
|
||||
ntfy.sh/farts
|
||||
```
|
||||
|
||||
>>>>>>> e8afe85 (initial commit: silly simple notifications pub/sub with ntfy.sh)
|
3
go.mod
Normal file
3
go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module tmp.L5lWoL3VeT
|
||||
|
||||
go 1.20
|
14
pub.go
Normal file
14
pub.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.Post("https://ntfy.sh/farts", "text/plain",
|
||||
strings.NewReader("Backup successful 😀"))
|
||||
}
|
23
sub.go
Normal file
23
sub.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
resp, err := http.Get("https://ntfy.sh/farts/raw")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
for scanner.Scan() {
|
||||
println(scanner.Text())
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue