babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
maxp 2021-02-08T05:17:35.387900Z

how to (prn ...) to stderr in babashka script?

borkdude 2021-02-08T09:19:30.388600Z

@maxp Not sure what your problem with System/err was, but this works as well:

user=> (binding [*out* (io/writer System/err)] (println :err))
:err

maxp 2021-02-09T03:31:04.405200Z

I've missed io/writer

lispyclouds 2021-02-08T05:21:29.388Z

This should work?

(binding [*out* *err*] (prn {:a "1" :b 2}))

maxp 2021-02-08T05:32:47.388200Z

Thank you. I've tried System/err before - and that did not work %) `*err*` binding is ok.

borkdude 2021-02-08T09:19:30.388600Z

@maxp Not sure what your problem with System/err was, but this works as well:

user=> (binding [*out* (io/writer System/err)] (println :err))
:err

borkdude 2021-02-08T10:17:18.388800Z

wow ... 🀯

2021-02-08T10:56:35.389300Z

Happy birthday @borkdude πŸ™‚ πŸŽ‰

9πŸŽ‚821πŸŽ‰
borkdude 2021-02-08T10:58:02.389500Z

Thanks :)

2021-02-08T11:09:56.390100Z

Happy Birthday πŸŽ‰ πŸŽ‚

borkdude 2021-02-08T11:10:35.390300Z

Thanks @jayzawrotny and thanks for your blog post gift!

1🎁
kwrooijen 2021-02-08T11:20:15.390600Z

Happy birthday! :babashka:

1
wilkerlucio 2021-02-08T13:07:47.392Z

happy birthday! πŸŽ‚

1πŸŽ‰
Pradeep B 2021-02-08T15:48:02.393300Z

Happy Birthday @borkdude have a good one. πŸŽ‚ πŸŽ‰

1❀️
Mno 2021-02-08T17:51:01.394500Z

Omg Happy Borkthday!

1πŸ˜†
Mno 2021-02-08T17:53:30.394700Z

May the babushkas shower you with gifts that spark kondo-esque joy. Hope you carve a big chunk of happiness that's sci-entifically incalculable.

1
borkdude 2021-02-08T18:45:19.396400Z

I missed this blog post when it came out almost a year ago: Deploy babashka script to AWS Lambda by @dainius.jocas https://www.jocas.lt/blog/post/babashka-aws-lambda/

lukasz 2021-02-08T18:47:05.397Z

@borkdude as you mentioned in the thread, this is way easier now that Lambda supports Docker images

2πŸ‘
lukasz 2021-02-08T18:47:22.397400Z

layers were always a weird thing, clearly their (AWS) way of doing things

lread 2021-02-08T19:25:01.398400Z

Happy birthday! May your borktitude continue to flourish!

3πŸ‘
grazfather 2021-02-08T22:05:19.399800Z

Actually, x-posting here since it’s relevant, and they even mention babashka https://clojurians.slack.com/archives/C03S1KBA2/p1612814934358300

grazfather 2021-02-08T22:22:45.400600Z

In particular I like the idea of adding a reader macro to bb to make it extra easy to write a bash lines

borkdude 2021-02-08T22:25:03.400900Z

@grazfather try:

user=> (require '[babashka.process :refer [$]])
nil
user=> ^{:inherit true} ($ ls -la)

grazfather 2021-02-08T22:27:46.401800Z

cool

grazfather 2021-02-08T22:27:53.402100Z

what is the ^ {} part?

borkdude 2021-02-08T22:28:49.402800Z

$ is a fancy macro to make it look like you're writing some shell invocation, it's part of the babashka.process lib: https://github.com/babashka/babashka.process The ^{..} part controls what to do with the output of the process. E.g. when you want to have a string:

(-> ^{:out :string} ($ ls -la) deref :out)

borkdude 2021-02-08T22:30:15.403500Z

it's clojure metadata so you don't have to provide options inside the $ expression. the normal functional invocation would look like:

(-> (process ["ls" "-la"] {:out :string}) deref :out)

borkdude 2021-02-08T22:34:03.404100Z

The $ macro also supports interpolation:

(let [dir "src"] (-> ^{:out :string} ($ ls -la ~dir) deref :out))

grazfather 2021-02-08T22:41:03.404700Z

awesome