This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-05
Channels
- # announcements (8)
- # asami (70)
- # babashka (28)
- # beginners (163)
- # calva (7)
- # cider (15)
- # clj-kondo (47)
- # cljs-dev (45)
- # clojars (2)
- # clojure (56)
- # clojure-europe (24)
- # clojure-italy (1)
- # clojure-losangeles (2)
- # clojure-nl (4)
- # clojure-spec (2)
- # clojure-uk (53)
- # clojurescript (46)
- # data-oriented-programming (15)
- # data-science (10)
- # datahike (2)
- # defnpodcast (1)
- # depstar (27)
- # emacs (35)
- # figwheel-main (28)
- # fulcro (38)
- # girouette (1)
- # graphql (16)
- # jobs-discuss (3)
- # kaocha (9)
- # keechma (2)
- # leiningen (6)
- # lsp (87)
- # malli (19)
- # membrane (16)
- # pathom (4)
- # re-frame (11)
- # shadow-cljs (25)
- # spacemacs (2)
- # testing (12)
- # tools-deps (14)
- # tree-sitter (4)
- # xtdb (20)
Hi @uiltjesrups - that's a cool nickname ;)
And when I do, all 0.8% of the world's Clojure developers using Sublime Text can rejoice that they can bask in the glory of Babashka!
Great experience using bb today for some elastic search queries and drilling around in the json response. Feels like a huge improvement over my old jq ways-
It's hard to break old habits and if the hold habits work fine for you, then there's no reason to change. E.g. if you know the jq syntax from heart, keep using it. I certainly don't :).
for JQ it isnβt bad, but I also do a lot of cut
sort
, etc. Itβs a lot more fragile than having a smarter parser
I want to convert this: https://github.com/hugsy/gef/blob/dev/tests/perf/context_times.sh Itβs pretty janky: bash to git checkout stuff, then invoke gdb, and in gdb invoke python, and then parse the output π
oh, and then write a CSV
is there some function for quoting for shell?
@grazfather can you give an example of what you want?
Sure. See this line of bash? https://github.com/hugsy/gef/blob/dev/tests/perf/context_times.sh#L10
gdb -ex 'start' -ex 'pi import profile' -ex "pi profile.run(\"gdb.execute('context')\", sort=\"cumtime\")" -ex 'quit' \
/tmp/pattern.out 2>&1 | get_context_time
The gdb.execute('context')
is a string in python that is eval
ed, but also I am invoking it on the command line. So I am avoiding some escaping by using single quotes.
I would like to safely quote a variable that would replace "gdb.execute('context')"
and safely escape so that itβs a valid python string after it make it into gdbsomething like:
user=> (pr-str "gdb.execute('context')")
"\"gdb.execute('context')\""
?Yes, or if the client goes gdb.execute("context")
(double quotes) it works
right now it would break:
Python Exception <class 'SyntaxError'> ('invalid syntax', ('<string>', 1, 27, 'profile.run("gdb.execute("context")", sort="cumtime")\n'
a naive replace of "
with \"
might get me pretty far
oh i thought you were using a hypothetical function π
@huxley This works for me for opening VSCode:
#!/usr/bin/env bb
(require '[babashka.process :as p])
(p/process '[code])
nil
Launching Firefox also worked:
#!/usr/bin/env bb
(require '[babashka.process :as p])
(p/process ["/Applications/Firefox.app/Contents/MacOS/firefox"])
nil
then the problem is with sway, because the scripts fired by the keyboard shortcut die together with the application
Alright, so this is esoteric, but I got it working pretty well. Thanks for the help! https://gist.github.com/Grazfather/be5d5d15057fc985e3c6f03e26dd1aa5 Basically it lets you run a python statement within the context of GDB multiple times across different git commits. I used a similar bash implementation to profile whether certain changes caused performance regressions