Skip to content

Instantly share code, notes, and snippets.

@JohnnyJayJay
Created April 5, 2021 23:26
Show Gist options
  • Save JohnnyJayJay/f666c35bb0303ff5e3c3597a1da289bc to your computer and use it in GitHub Desktop.
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
#!/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