babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
2021-05-12T03:30:00.226300Z

brilliant, looks great

2021-05-12T03:34:28.227400Z

I've found using bb to calculate a dynamic GitHub Actions testing matrix to be really useful at home and at work. https://github.com/typedclojure/typedclojure/blob/main/script/print-actions-matrix.clj

borkdude 2021-05-12T07:17:13.231Z

Nice!

2021-05-12T03:36:18.227600Z

For the rest of the glue, grep for "matrix" https://github.com/typedclojure/typedclojure/blob/main/.github/workflows/clj.yml

pithyless 2021-05-12T06:25:33.228Z

> if you have some ideas how babashka could pass down args to the deps system... Nothing directly comes to mind, the -C-Sforce is interesting, because it's consistent with the approach deps.tools have taken; maybe it would be enough to have a :clojure-opts setting in the bb.edn ? The complexity also stems from the fact that you have the clojure that is internal and used to resolve things like bb :deps; but there is also the clojure that can be invoked by a user task. If one were to pass or configure some default clojure args, should they be applied the same to both?

borkdude 2021-05-12T06:40:12.229600Z

That’s not really an issue. clojure is a drop-in replacement to which you can pass all args

borkdude 2021-05-12T06:40:45.230600Z

The args we are discussing should only affect bb deps

pithyless 2021-05-12T06:51:02.230800Z

touché

borkdude 2021-05-12T07:17:13.231Z

Nice!

Jakub Holý 2021-05-12T08:01:28.233100Z

Hello! How can I distinguish between whether a file is run from the terminal via bb <http://myfile.bb|myfile.bb> or evaluated in repl via my editor's load file in REPL? What I do now is checking (str/includes? *file* "\n") which, if true, means we run from repl as the var is the content of the file instead of a path. But there must surely be a better way?

borkdude 2021-05-12T08:02:51.233500Z

@holyjak https://book.babashka.org/#main_file

Jakub Holý 2021-05-12T08:03:22.233900Z

How could I have overlooked that? Thanks a lot!

borkdude 2021-05-12T08:03:31.234300Z

I'm afk for the rest of the day, back tonight (hiking!)

1👍
Jakub Holý 2021-05-12T08:04:01.234400Z

enjoy the trip! ⛰️

Jakub Holý 2021-05-12T08:04:45.234600Z

(Living in Norway, when you say hiking, I of course only think about mountains, though I bet the situation is rather different in Holland)

Jakub Holý 2021-05-12T08:09:09.234800Z

@avidrucker Hi! regarding ☝️ and the "replacements to mv, rm, and cp", it would be also note pointing to the more ergonomic https://babashka.org/fs/babashka.fs.html#var-copy included with bb: bb -e '(babashka.fs/copy "server.pem" "server.pem.copy")'

tatut 2021-05-12T08:21:28.236100Z

are people using bb for server automation tasks? like “ssh in, do some config changes, restart a service” typo of things?

tatut 2021-05-14T05:27:59.310900Z

sure, I can always shell out to ssh command line

tatut 2021-05-14T05:29:54.311100Z

that gives me an idea that if the other machine has bb installed, one could make a macro like (remote-bb "<mailto:foo@example.com|foo@example.com>" (println "I'm evaluated on the remote machine")) that would invoke bb on the other machine via ssh and return result

tatut 2021-05-12T08:22:00.236200Z

there’s also https://epiccastle.io/spire/ but bb is more general purpose

Jakub Holý 2021-05-12T09:48:38.237800Z

Any tips how to encrypt data from bb? Since javax.crypto.Cipher is not available? I see there is a pod for https://github.com/rorokimdim/stash but I want something that does not require to install an external binary. So I guess my best option is to use openssl via CLI?

borkdude 2021-05-12T11:01:24.238300Z

There is a buddy pod for this

borkdude 2021-05-12T11:02:14.238800Z

I don’t see why not :)

tatut 2021-05-12T11:17:29.239Z

any examples publicly available?

Jakub Holý 2021-05-12T12:03:57.239200Z

But it seemed to have only Mac, hash, nonce, not crypto ns?

victorb 2021-05-12T12:14:02.239400Z

true, but it does seem simple to add though, without having looked into it further than just looking here: https://github.com/babashka/pod-babashka-buddy/blob/37ce1185d43e5f5855e56425ee46550a167687c0/src/pod/babashka/buddy.clj

borkdude 2021-05-12T12:48:07.239900Z

Good catch

borkdude 2021-05-12T16:01:34.240100Z

@tatut I was afk today, but I'm finally back. An example:

bb -e '(:out @(babashka.process/process ["ssh" "<mailto:borkdude@foobar.com|borkdude@foobar.com>" "ls"] {:out :string :err :inherit}))'

borkdude 2021-05-12T16:01:51.240300Z

this would return the string return from the ssh command and would pipe the stderr stream to bb's stderr

borkdude 2021-05-12T16:03:48.240500Z

@holyjak So did you find another solution?

Jakub Holý 2021-05-12T17:03:40.240700Z

Just sh/sh openssl