This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-31
Channels
- # announcements (4)
- # aws (1)
- # babashka (52)
- # beginners (178)
- # boot (4)
- # cider (2)
- # clj-kondo (10)
- # cljs-dev (39)
- # clojure (744)
- # clojure-europe (12)
- # clojure-germany (6)
- # clojure-india (56)
- # clojure-italy (5)
- # clojure-nl (60)
- # clojure-spec (9)
- # clojure-sweden (14)
- # clojure-uk (36)
- # clojuredesign-podcast (6)
- # clojurescript (11)
- # community-development (5)
- # core-async (4)
- # data-science (6)
- # datomic (6)
- # emacs (7)
- # events (4)
- # exercism (33)
- # fulcro (11)
- # funimage (2)
- # graalvm (29)
- # java (1)
- # joker (3)
- # lambdaisland (15)
- # malli (2)
- # meander (55)
- # mid-cities-meetup (1)
- # nrepl (8)
- # observability (4)
- # off-topic (2)
- # pathom (5)
- # re-frame (31)
- # shadow-cljs (73)
- # spacemacs (18)
- # sql (27)
- # test-check (14)
- # testing (1)
- # tools-deps (5)
- # xtdb (13)
so that takes a leiningen project.clj and produces a deps.edn file with converted dependencies using babashka?
We also had one of those examples here: https://github.com/borkdude/babashka/#convert-projectclj-to-depsedn
bb --classpath /Users/mk/.m2/repository/nrepl/bencode/1.0.0/bencode-1.0.0.jar --repl β 130
Babashka v0.0.78 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (require 'bencode.core)
Unable to resolve classname: clojure.lang.RT [at bencode/core.clj, line , column ]
user=>
you are trying to use bencode itself from the interpreter? that doesn't work. should it?
I am using the bencode library in the nrepl-server branch, so we have a dependency on it anyway. we could just expose it to the interpreter if it makes sense...
ok, and in general (for a lib you donβt already have included) I would do a fork and include it?
is there cases when requiring a lib through the interpreter would work or does it never work?
@mkvlr a fork isn't always needed. there are several libraries out there that work out of the box: https://github.com/borkdude/babashka/#tools-and-libraries mostly when it's pure clojure, it works
oh, when you want to do built-in support for a library that doesn't make sense for bb in the general case, but for your specific use case, a fork makes sense
hey, I am relying on the fact bencode is a bijection to hash json files in a way thats cross platform and language
I did a thing in python for data pipelines ( https://github.com/binaryaffairs/a-la-mode https://www.youtube.com/watch?v=jjVp4QudLaw ) and I'd like to do the same trick to rebuild Packer images if the json describing it or the checksum of any input files changes
I take the SHA256 of the bencoded dictionary/hash
@thattommyhall what about https://github.com/borkdude/babashka/#cryptographic-hash ?
that would do for the SHA bit I think
why do you need a hash of a bencoded thing instead of the stringified thing itself? (I'm just asking to learn more about your use case)
that was for cross-language stability
json does not have a unique string representation
ah, so you encode from language X and Y into bencode, which then yield exactly the same bytes?
this is a nice-to-have for the current need, but yeah
if the clojure map hash fn is stable, I could use that
fwiw, I have bencode inside the nrepl-server branch and I needed to make a small tweak to it for GraalVM: https://github.com/borkdude/babashka/blob/b04f812d73b79124c51ad6db89059c14b74a7977/src/babashka/impl/bencode/core.clj#L319
which function do you need from bencode? I could try to expose that inside that branch
https://ocert.org/advisories/ocert-2011-003.html they usually are not any more
read-bencode
write-bencode
its probs a weird use case tbh
@thattommyhall In the nrepl-server
branch:
$ ./bb '(with-open [os (io/output-stream (io/file "out.txt"))] (bencode/write-bencode os {"a" 1})) (slurp "out.txt")'
"d1:ai1ee"
thats lovely, cheers
$ ./bin/build.bb
d1:ai3e1:bi4ee
im fairly sure this will work for me now, cheers!
cool. I hope to release this soon-ish, there are a few details to iron out with the nrepl-server
Created an open collective for those who prefer it over Github sponsors. https://opencollective.com/babashka
Added a first contribution π