Skip to content

Instantly share code, notes, and snippets.

@srenatus
Last active March 22, 2023 20:00
Show Gist options
  • Save srenatus/5a112cb9732a144addb200f0a69b5e64 to your computer and use it in GitHub Desktop.
Save srenatus/5a112cb9732a144addb200f0a69b5e64 to your computer and use it in GitHub Desktop.
{:deps {djblue/portal {:mvn/version "0.37.1"}}}
package portal
import (
"bytes"
"encoding/json"
"os/exec"
)
func Tap(x any) {
payload, err := json.Marshal(x)
if err != nil {
panic(err)
}
tap(payload)
}
func tap(x []byte) {
t := exec.Command("tap")
t.Stdin = bytes.NewReader(x)
if _, err := t.Output(); err != nil {
panic(err)
}
}
bb -cp `clj -Spath -Sdeps '{:deps {djblue/portal {:mvn/version "0.35.1"}}}'`
Babashka v1.1.173 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (require '[portal.api :as p])
nil
user=> (def p (p/open {:launcher :vs-code :port 5678}))
#'user/p
user=>
#!/usr/bin/env -S bb --config /users/stephan/Scratch/clojure/portal/bb.edn
(require '[portal.client.jvm :as p])
(def submit (partial p/submit {:port 5678}))
(-> (json/parse-stream *in* true)
submit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment