Fork me on GitHub
#babashka
<
2021-05-12
>
ambrosebs03:05:28

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

Jakub Holý (HolyJak)08:05:28

Hello! How can I distinguish between whether a file is run from the terminal via 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?

Jakub Holý (HolyJak)08:05:22

How could I have overlooked that? Thanks a lot!

borkdude08:05:31

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

👍 2
Jakub Holý (HolyJak)08:05:01

enjoy the trip! ⛰️

Jakub Holý (HolyJak)08:05:45

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

tatut08:05:28

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

tatut08:05:00

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

borkdude11:05:14

I don’t see why not :)

tatut11:05:29

any examples publicly available?

borkdude16:05:34

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

bb -e '(:out @(babashka.process/process ["ssh" "" "ls"] {:out :string :err :inherit}))'

borkdude16:05:51

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

tatut05:05:59

sure, I can always shell out to ssh command line

tatut05:05:54

that gives me an idea that if the other machine has bb installed, one could make a macro like (remote-bb "" (println "I'm evaluated on the remote machine")) that would invoke bb on the other machine via ssh and return result

Jakub Holý (HolyJak)09:05:38

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?

borkdude11:05:24

There is a buddy pod for this

Jakub Holý (HolyJak)12:05:57

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

victorb12:05:02

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

borkdude16:05:48

@holyjak So did you find another solution?