This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-19
Channels
- # announcements (5)
- # babashka (49)
- # beginners (11)
- # biff (5)
- # calva (123)
- # clerk (9)
- # cljdoc (5)
- # cljs-dev (9)
- # clojure (62)
- # clojure-europe (32)
- # clojure-nl (1)
- # clojure-norway (54)
- # clojure-uk (3)
- # clojurescript (30)
- # community-development (5)
- # cursive (9)
- # devops (5)
- # events (1)
- # fulcro (35)
- # graalvm (10)
- # gratitude (3)
- # hyperfiddle (9)
- # jobs (3)
- # keechma (1)
- # lsp (10)
- # malli (14)
- # off-topic (42)
- # overtone (1)
- # releases (3)
- # shadow-cljs (66)
- # squint (153)
- # xtdb (19)
Is there a reason the https://github.com/babashka/babashka/blob/655760d2a96a84f56a0e113933fe9a08d0e3883f/src/babashka/impl/clojure/core/server.clj#L156-L259 doesn't implement https://github.com/clojure/clojure/blob/92d86872d242d5176b0e616de91c339f79ff39cc/src/clj/clojure/core/server.clj#L298-L341?
I've been idly wondering if I could do something like this:
https://clojurians.slack.com/archives/CLX41ASCS/p1632220955376300
Except connecting to a remote prepl instead. In particular I'm wondering if I can use remote-prepl
in babashka to connect to a remote "actual clojure" prepl, so that I could use little bb scripts to interact with a long running clojure process
(I realize nrepl would probably work for this too)
You can probably copy paste that code somewhere and run it in bb, at first glance it seems fairly standalone
I have an executable script written in bb, and set it to a certain global shortcut key, it work fine. However, when I run bb inside it, bb seems not to run. test:
(shell {:out :write
:out-file (io/file "/tmp/out.txt")}
"which bb")
the output is: /usr/local/bin/bb
(shell {:out :write
:out-file (io/file "/tmp/out.txt")}
"bb --version")
and /tmp/out.txt is empty
What did I do wrong? Can bb run inside independent script?Hm yeah, this worked for me:
(require '[babashka.process :refer [shell]])
(require '[ :as io])
(shell {:out :write
:out-file (io/file "/tmp/out.txt")}
"bb --version")
(prn (slurp "/tmp/out.txt"))
Output:
"babashka v1.3.190-SNAPSHOT\n"I bind the script to a global shortcut, here is the shurtcut command: /home/.../bb_script
here is the whole script
#!/usr/bin/env bb
(require '[babashka.process :refer [shell]])
(require '[clojure.edn :as edn])
(def script-path "/home/scripts/")
(def config (edn/read-string (slurp (str script-path "src/bb/config.edn"))))
(shell "sleep 0.5")
(shell "xdotool key ctrl+c")
(shell "sleep 0.2")
(def text (-> (shell {:out :string} "xclip -o")
:out))
(shell "sleep 0.1")
(def file (str (-> config :clip :path)
(-> config :clip :default-file)))
(spit file text)
;; not work
(shell {:out :write
:out-file (io/file "/tmp/out.txt")}
"bb --version")
It seems like the issue is related to how Ubuntu executes scripts, which is a bit beyond my knowledge area. I'm not quite clear about the differences between executing global scripts and command-line commands.as the global shortcut key is runs directly by ubuntu, I don't know where to check the logs. Maybe temporarily set aside this issue.
Thanks for taking the time to look into this. It's likely just a matter of my knowledge limitations.
change the shortcut command to /home/.../bb_script > /tmp/out.txt
and magically works, outputting: babashka v1.3.186
.
i'm setting up a new machine, and trying to be diligent about security; neither the output of sha256sum
on babashka-1.3.189-linux-amd64-static.tar.gz
or the bb
inside it match the .sha256 file of the same base name I downloaded from the github releases. Am I missing something?
these seem to match for me:
$ sha256sum babashka-1.3.189-linux-amd64-static.tar.gz
228e8ccee724ba8d66c66d8672161b991bb00b00e538e7aecd0b902330e5a712 babashka-1.3.189-linux-amd64-static.tar.gz
$ cat babashka-1.3.189-linux-amd64-static.tar.gz.sha256
228e8ccee724ba8d66c66d8672161b991bb00b00e538e7aecd0b902330e5a712
doh!
ā ī° ~/ļ ī° sha224sum babashka-1.3.189-linux-amd64-static.tar.gz
f95ee73e63b363e280d6ecb49b6716f5986b25c6c11059b6d742290c babashka-1.3.189-linux-amd64-static.tar.gz
ā ī° ~/ļ ī° cat babashka-1.3.189-linux-amd64-static.tar.gz.sha256
228e8ccee724ba8d66c66d8672161b991bb00b00e538e7aecd0b902330e5a712ā
must have hit s-h-a-2-2-[tab]
I remember reading about custom babashka distributions, but I don't remember exaclty where it was described. I need some java libs (json schema validation mainly) to be included and probably build my own cli app from bb sources. I would like to build that for multiple OS / platforms - and reuse bb build scripts if possible. Not sure if this was all in the article I remember reading, but explained for context . (building a better docker swarm client - improved templating)
you could do that, but you could also just build your own GraalVM CLI without bb I guess. bb only adds value if your app needs to execute scripts
if startup isn't that important you could also just run it on the JVM of course, that would be the best way to iterate before you invest in all the graalvm native-image build stuff
I use appveyor for windows and for mac x64 I use circleci, for mac aarch64 I use cirrus CI
why so many different CIs? because those were the only ones that worked for those platforms at the time and I stuck with them. technically you could probably use Github Actions for most of them now, but I kinda dislike Github Actions in some ways, mostly their UI + performance
I don't use Github Actions for any of my binaries, but I have it as a backup solution