babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2020-11-02T10:14:34.135700Z

Wrote down some notes on http client and server here: https://github.com/borkdude/babashka/issues/628

Darin Douglass 2020-11-02T14:12:11.137700Z

> http-kit keeps the whole response in memory this kind of surprising to me. is this an artifact of the how it's implemented/added into bb? you should be able to use {:as :stream} to get a bytestream on any request

borkdude 2020-11-02T14:13:30.139100Z

no, it's just how http-kit implemented it. it has nothing to do with bb

borkdude 2020-11-02T14:14:05.139400Z

you will get the stream, but not until it's fully realized in memory first

Darin Douglass 2020-11-02T14:15:08.139700Z

yeah i was just looking at that code

Darin Douglass 2020-11-02T14:15:19.140Z

that's kinda surprising, honestly. good find

borkdude 2020-11-02T14:16:14.140900Z

But you can use babashka.curl for big streams. I hope it will get fixed eventually in http-kit but it's been like this for years apparently

borkdude 2020-11-02T16:07:36.141400Z

This project works with bb: https://github.com/ordnungswidrig/sha-words It translates SHAs or UUIDs in human-readable words

lukasz 2020-11-02T16:08:42.141900Z

wow, that's cool (the lib and BB support)

borkdude 2020-11-02T16:09:02.142200Z

It just happened to work with bb, it wasn't designed like that btw :)

borkdude 2020-11-02T17:03:33.142800Z

so, there is now a Raspberry Pi with 8GB of memory. Should be sufficient to get babashka compiling on such a machine https://www.raspberrypi.org/products/raspberry-pi-4-model-b/?resellerType=home

👍 4
isak 2020-11-02T17:56:45.143500Z

Nice, I was going to ask. I've been using the jar on mine for now.

borkdude 2020-11-02T23:08:54.147500Z

@mathpunk I saw a question about babashka.process, and I was going to give an example, but I saw you removed it. Posting it anyway.

user=> (def cat-proc (babashka.process/process ["cat"]))
#'user/cat-proc
user=> (def writer  (io/writer (:in cat-proc)))
#'user/writer
user=> (binding [*out* writer] (println "hello"))
nil
user=> (binding [*in* (io/reader (:out cat-proc))] (read-line))
"hello"

mathpunk 2020-11-02T23:09:30.147900Z

oh thank you! i had a moment where i felt self-conscious and like i should go answer it via documentation

borkdude 2020-11-02T23:09:33.148200Z

the last line shows how you can read lines from a process and wait for certain output

1
mathpunk 2020-11-02T23:09:40.148300Z

this is very helpful thank you!

lukasz 2020-11-02T23:40:28.149200Z

Am I doing something wrong, is java.security.SecureRandom not in babashka? java.security.MessageDigest is included

lukasz 2020-11-02T23:43:30.149600Z

Not a biggie of course, just checking