Fork me on GitHub

@lukaszkorecki I can add it if you want, it takes about 80kb extra. Can you explain the use case a bit?


Btw, I now fixed this example on master:

$ ./bb -e "(take 4 (iterator-seq (.iterator (.doubles (java.util.Random.)))))"
(0.11018020853952415 0.8538439232524406 0.24374736204535452 0.975224420988415)


@borkdude I have reimplemented RabbitMQ's password hashing algo, at one point it requires 4 bytes of a random salt, so out of habit I always reach for SecureRandom but in this case good old j.u.Random will suffice. I guess it comes from the fact that MessageDigest is included. Babashka/SCI is so good I keep forgetting it's not "full" Clojure :-)


I suppose if it only adds 80kb, it would be worth including, since it adds that "parity" to MessageDigest


but, it's not like it's critically needed


MessageDigest is included to calculate sha-256 hashes, etc, which is quite common in scripting


yep, exactly what I'm doing right now


How does j.s.R relate to MessageDigest?


It doesn't really, apart from both being a part of package. It only came up in my use case - I needed both, being used to having both in regular Clojure and implementing various cryptography stuff (which I'm surprised how much I had to do this year :thinking_face: )


If I'm also not mistaken, UUID generation using Java uses the SecureRandom class


OK, but we already have that:


$ bb '(java.util.UUID/randomUUID)'
#uuid "705b0ba1-d637-45aa-ad35-4aba31cbd9e2"


fwiw, this entire library works with bb:


I guess you could bind *rnd* to a j.s.R instance for more secure randomness?


yeah, could work. Again: it's not incredibly painful to not have SecureRandom, I naively assumed it's already in BB


PEKBAC etc etc


no problem. if the need arises I would add it, if it would enable access to some interesting library for example


btw, @lukaszkorecki are you still considering writing an AWS pod? I noticed is graal compatible. Together with the new support for transit in pods it might feasible, maybe using some code generation.


Good timing - I have just kicked off the work which will involve this. At this point I'm considering using babashka.process and AWS CLI v2 as we are using AWS SSO for credentials, and none of the AWS SDKs (Java, Go etc) support that right now. Also, that gives access to all AWS services in a programatic way - my understanding is that with amazonica and the AWS SDK we had to pick and choose what gets included when compiling using native-image, right?


That's correct. The way I usually accomplish this is by putting stuff in a map and looking it up dynamically. This ensures GraalVM will hold on to it.


So yeah, going with aws cli might be more flexible since services you might need to interact with might not be known (we need ECS, S3, SecretsManager, SSM and couple of more, some people might need S3 and DynamoDB only etc).


yeah, shelling out to a CLI is a good way to get stuff done


The good thing is that the CLI is somewhat structured in the way you call it, so I think it can have a sane API in Clojure in terms of the interface. Something like (aws :ec2 :describe-instances {:instance-ids ["a" "b"] }) We will see.


By the way - the post about monitoring ECS with babashka will be published soon :-)

🍿 6

@lukaszkorecki :-) Here's an example of a lib that shells out to psql: Might be cool to publish somewhere at some point.


I've heard that the AWS cli sometimes makes breaking changes, not sure how bad those are? Is that what you're referring to with v2?


Yep, I'm planning to open source our RMQ monitoring + Docker setup - all tooling is based on BB


the AWS CLI pod is speculative atm, I'll be digging into it properly in a week or so


V2 broke in the sense that it went straight into python3 (but it vendors) it and it has features that v1 doesn't (SSO integration for example)


so if you were installing the CLI via python's pip, you were going to have a bad time


Wow.... matchete, a library like meander, works with babashka:

$ rlwrap bb -cp "$(clojure -Spath -Sdeps '{:deps {io.xapix/matchete {:mvn/version "1.2.0"}}}')"
user=> (require '[matchete.core :as mc])
user=> (mc/matches '{?k 1} {:x 1 :y 1})"
({?k :y} {?k :x})

👏 15
👀 6