Created
April 5, 2021 23:26
-
-
Save JohnnyJayJay/f666c35bb0303ff5e3c3597a1da289bc to your computer and use it in GitHub Desktop.
A small babashka script to post text to a haste-server and get the url back
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bb | |
(def ^:const base-url "https://hastebin.com") | |
(as-> (or (first *command-line-args*) System/in) $ | |
(io/input-stream $) | |
(curl/post (str base-url "/documents") {:body $}) | |
(:body $) | |
(json/parse-string $ true) | |
(:key $) | |
(str base-url \/ $) | |
(println $)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment