Skip to content

Instantly share code, notes, and snippets.

@rgm
Created November 15, 2023 19:53
Show Gist options
  • Save rgm/790e0d1e06077eeb2a0d02492aa4ddfb to your computer and use it in GitHub Desktop.
Save rgm/790e0d1e06077eeb2a0d02492aa4ddfb to your computer and use it in GitHub Desktop.
a bash script to create a new clerk notebook with emmy, plus a clojure nrepl process to render it
#!/usr/bin/env bash
if [ ! -f notebook.clj ]; then
INITIAL_FILE=$(cat <<EOF
^{:nextjournal.clerk/toc :collapsed
:nextjournal.clerk/visibility :hide-ns}
(ns user
"https://book.clerk.vision
https://emmy.mentat.org"
(:require
[emmy.env :as e]
[nextjournal.clerk :as clerk]))
;; # Title
(comment
(e/->infix (e/square (e/sin (e/+ (quote a) 3))))
(clerk/serve! {:watch-paths ["."] :browse true})
(clerk/show! *ns*))
EOF
)
echo "$INITIAL_FILE" > notebook.clj
fi
clj -Sdeps '{:paths ["."] :deps {nrepl/nrepl {:mvn/version "RELEASE"} cider/cider-nrepl {:mvn/version "RELEASE"} org.mentat/emmy {:mvn/version "RELEASE"} io.github.nextjournal/clerk {:mvn/version "RELEASE"}}}' -M -m nrepl.cmdline --middleware '[cider.nrepl/cider-middleware]' --interactive --color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment