Fork me on GitHub

I don't remember who asked a while ago about image processing stuff in babashka, but now there is #nbb and e.g. rotating an image was pretty easy using jimp:

👀 4
👍 4

not for me?

Jakub Holý (HolyJak)11:09:22

that was weird. Now it works.

Jakub Holý (HolyJak)11:09:38

The Tasks talk, clojure use (do (run 'clean) (run 'uberjar)) I assume we could just and well, and perhaps more easily, write it as {:depends [clean uberjar]} right? Does it execute the dependencies in order ( does not say?)? Though we risk to screw up if we run it with run --parallel so perhaps a bad idea...


yeah, that's the reason: the task dependencies will be run in order if you don't use --parallel, but if you do, then there is no defined order


also note that dependency order depends on topological sorting, e.g. :depends [x y z] doesn't always mean that y is before z, e.g. not if z is also a dependency of x


so to keep the order defined, just use run explicitly

👍 2
🙏 2
Jakub Holý (HolyJak)11:09:19

Question about Fish completions for tasks - there is

function __bb_complete_tasks
  if not test "$__bb_tasks"
    set -g __bb_tasks (bb tasks |tail -n +3 |cut -f1 -d ' ')

  printf "%s\n" $__bb_tasks
so once I run this, the tasks list will be set forever. If I run it again in a different folder, I do not get that folder's tasks but the ones saved previously. Is that intended?

Jakub Holý (HolyJak)11:09:22

Hi @UFBL6R4P3 , you added ☝️ , right? I have fixed mine to simply not use a cache variable, I assume the (bb tasks ...) is fast enough for my needs.

Michaël Salihi22:09:11

Hi, yes it's me.

Michaël Salihi22:09:36

I'll try to reproduce and fix this issue 👍

Michaël Salihi22:09:14

Thx for the feedback


This was contributed by people other than me, I don't know fish, so I hope those people will respond/fix :)

Jakub Holý (HolyJak)11:09:15

ok! do you remember who?


you can see it in the commit history of the book

👍 4
Jakub Holý (HolyJak)11:09:53

@borkdude would it be possible to add a link to the slide to the youtube description? 🙏


do you mean a link to speaker deck?

Jakub Holý (HolyJak)11:09:35

in the talk description at youtube. Yes, I guess it is Bruno who must do that 🙏


I think you should ask @bruno.bonacci to update the description, I don't manage that account

Jakub Holý (HolyJak)11:09:14

FYI again I got an error accessing the book page: > This site can’t be reached > Check if there is a typo in after a reload it showed up. Something fishy going on with the server(s)...


Hi, I can see Lanterna mentioned in BB book but i can’t see it in what’s the current status? Can it be used? Thanks


@zikajk The current state is a bit experimental I would say. I'm not actively working on it at the moment.

🙂 2

There is however a working tetris example


Perhaps you can also consider #nbb + reagent + ink for this kind of usage

👏 2

@borkdude Thank you. Ink is looking really interesting - new for me. It may be much better choice than lanterna.


Ahh, it depends on node.js which i cant install on that old and restricted server..


You're welcome to work on the lanterna pod. Afaik this is the main issue left:


I could also just publish it to the pod registry and take things from there


I will trigger a build so you can just use it locally to play with


are you on linux or macos?


On macos, much appreciated


and that old restricted server is too?


No, i will target Linux servers. (but i am used to do uberscript on macos before deploying self-contained script to these linux machines)


load as: (pods/load-pod "./the-local-binary" {:transport :socket})

🙏 2

(EDIT: added {:transport :socket}, this is important)

👍 2

Then we can identify issues and perhaps release an initial version


If it's remotely useful, we could just release the initial, but somewhat not perfect version.


And this is the version that works until I will try to compile it with graalvm if I understand the github issue correctly?


this is already a graalvm compiled binary


the github issue just identifies something that doesn't work with lanterna 3 which did work with 2


we have an upgraded version of clojure-lanterna in the babashka org to lanterna 3. the original clojure-lanterna library is based on 2


which we use in the pod


So to back up a little: There is a clojure library called clojure-lanterna. But this uses lanterna 2, while lanterna moved to v3 meanwhile. But the clojure lib seems unmaintained.


Since we didn't want to build a pod on an unmaintained lib, we tried upgraded clojure-lanterna to lanterna v3.


And at the same time we made a tetris game and compiled it to graalvm with both v2 and v3. The v3 one has some problems. While the pod seems to work ok. But this may an issue which needs to be fixed.


But if you get some usefulness out of the pod as it is, then I'm ok with just publishing it as v0.0.1


and then we can see after that what needs to be fixed


Basically: just use it and report if there are issues we can fix before v0.0.1 and if it works ok, then we'll also publish it as v0.0.1

🙏 2

i am trying to do something like this with bb and running into issues

clojure --init "/full/path/to/bla.clj" --main bla arg1 arg2
what would be equivalent with bb?


BABASHKA_PRELOADS=$(cat /full/path/to/bla.clj) bb -m bla arg1 arg2 perhaps?


or BABASHKA_PRELOADS='(load-file "/bla.clj")', something like that


or make a bb.edn where you load this code in :init


that works! awesome thank you! tried --file --eval but it did not work


like {:init (load-file "/bla.clj") :tasks {foo foo}}


we could introduce another flag to make --init behave like babashka-preloads from a file


that would be cool!


could you make an issue where you describe your use case? since the official Clojure has this, I think it makes sense


i use something like this in my one file scripts

#_(-*- clojure -*- sorcery to allow to run this script as executable on Linux/Unix
       BABASHKA_PRELOADS="(load-file \"$0\")" exec bb --main bla -- "$@"
       #_exec clojure -J-Xms256m -J-Xmx256m -J-client -M --report file --init "$0" --main bla "$@")
(ns bla)


Humm... I use.

#!/usr/bin/env bb
the args are in command-line-args


yep will make case later, too crazy at work right now 🙂


Thank-you for writing babashka! As a longtime clojure user who hasn't written much clojure in the past 2 years, it was super refreshing to be able to look to bb for a simple task. Basically, I use a database at work that lacks the ability to output a "record view" where you can see the entire record one at a time, like \x in postgres. I came up with

cat mytabfile | bb -i ' (let [v (mapv #(clojure.string/split % #"\t") (vec *input*)) header (first v) rows (rest v)] (mapv (fn [row] (println (apply str "\nNEW ROW\n\t" (flatten (interpose "\t" (flatten (interpose "\n" (zipmap header row)))))))) rows ) )'
I'm sure this can be improved, but already it is a nice hack to have. Along these lines, is there a common repo somewhere of cool things folks have done with babashka ?


@aaelony Great to hear! There is an examples directory in the repo. I keep track of libs and projects here: and there is also this news page: There there is also the Show and Tell forum on Github Discussions.

👍 2

cool! I'll check it out 🙂