Skip to content

Instantly share code, notes, and snippets.

@gfredericks
Last active March 1, 2019 11:35
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gfredericks/900183dae706aae6361110b2383c8639 to your computer and use it in GitHub Desktop.
Save gfredericks/900183dae706aae6361110b2383c8639 to your computer and use it in GitHub Desktop.
Self-contained clojure file with deps
#!/usr/bin/env bash
#! top-of-file comments can be written using more #! lines, which
#! is a valid comment in both clojure and bash
":";# alternately this works too
#! The construction below uses cross-language syntactic hackery to
#! specify the -Sdeps arg in a part of the file that's interpreted
#! by clojure as clojure syntax (i.e., not a line comment), so it
#! should get syntax highlighting and other editor support
":"; DEPS=\
'{:deps
{org.apache.commons/commons-compress {:mvn/version "1.17"}}}'
":"; exec clojure -Sdeps "$DEPS" "$0" "$@"
(ns frobnicate
(:import
(org.apache.commons.compress.archivers ArchiveStreamFactory)
(org.apache.commons.compress.archivers.tar TarArchiveEntry)))
;; put useful code here
@gfredericks
Copy link
Author

it seems github decides to highlight this as a bash file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment