Fork me on GitHub
#babashka
<
2021-09-21
>
borkdude10:09:35

I've got a pretty interesting experiment going here: https://github.com/clj-easy/graal-build-time/blob/35354aa9767a0b871702a035166c7332ee83c5dd/bb.edn#L43-L46 This runs expressions in a Clojure prepl while still leveraging the bb tasks dependency stuff. So you can re-use the pREPL and launch it at most once, when a REPL is needed.

👀 2
stijn11:09:59

Hello, is there a utility method for converting binary to hex built into babashka? It looks like javax.xml.bind.DatatypeConverter is not on the classpath e.g.

borkdude11:09:42

@stijn

$ bb -e '(format "%016x" (BigInteger. 1 (.getBytes "foo")))'
"0000000000666f6f"

borkdude11:09:05

(I believe something along those lines)

stijn11:09:23

interesting, I didn't consider going through BigInteger. thanks!

borkdude11:09:49

That looks about right compared to the output of xxd

stijn11:09:21

(defn bytes->hex
  [bytes]
  (.toString (BigInteger. 1 bytes) 16))
is what I ended up using

👍 2