Last active
July 4, 2018 16:34
-
-
Save borkdude/8ad63f256e6f834f812b86a2c0e36415 to your computer and use it in GitHub Desktop.
Execute all in one clj script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deps=`awk '/^;; deps.edn$/{flag=1;next}/^;; end deps.edn$/{flag=0}flag' $1` | |
script=`awk '/^;; script$/{flag=1;next}/^;; end script$/{flag=0}flag' $1` | |
clj -Sdeps "$deps" -e "$script" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# initial usage | |
$ time ./script.clj | |
2018-03-03T21:16:06.869Z | |
./script.clj 10.43s user 0.55s system 280% cpu 3.911 total | |
# notice the speedup due to classpath caching in clj 1.9.0.358 | |
$ time ./script.clj | |
2018-03-03T21:16:25.889Z | |
./script.clj 3.77s user 0.22s system 259% cpu 1.536 total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env cljscript | |
;; deps.edn | |
{:deps {clj-time {:mvn/version "0.14.2"}}} | |
;; end deps.edn | |
;; script | |
(require '[clj-time.core :as t]) | |
(println (str (t/now))) | |
;; end script | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment