Skip to content

Instantly share code, notes, and snippets.

Gone fishin'

Max Penet mpenet

Gone fishin'
Block or report user

Report or block mpenet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:fa611105b4a0a38126c5ba8ffe60d8a7
(clojure.spec.alpha/def ::asd (clojure.spec.alpha/keys :req [::foo]))
(clojure.spec.alpha/valid? ::asd {})
(clojure.spec.alpha/valid? ::asd {::foo 1})
;; ::foo was never declared
View deterministic_sampler.clj
(defn deterministic-sampler
(let [bound (Integer/divideUnsigned -1 rate)] ;; -1 as int is 0xffffffff
(fn [s]
(pos? (Integer/compareUnsigned bound (hash s))))))
View gist:35451344629372b34bdb2280aade387e
(defn until
(fn [rf]
(let [p? (volatile! false)]
([x] (rf x))
([x y]
(if @p?
mpenet / .scaffolding.clj
Created Jul 11, 2018
just a hack to use deps.edn dependencies in lein/boot projects without having to rely on half working plugins + versioning from git tags
View .scaffolding.clj
'[ :as sh]
'[clojure.edn :as edn])
(set! *warn-on-reflection* true)
(defn next-version [version]
(when version
(let [[a b] (next (re-matches #"(.*?)([\d]+)" version))]
(when (and a b)
View i3.config
# i3 config file (v4)
# Please see for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:terminus 10
mpenet / gist:674c13bb8cc3b6fefa23f08bbea5446f
Last active Feb 5, 2018
like clojure.core sequence but without chunking
View gist:674c13bb8cc3b6fefa23f08bbea5446f
(defn unchunked-sequence [xform coll]
(->> coll
(clojure.lang.TransformerIterator/create xform)
;; realizes 10 values
(unchunked-sequence (comp (map #(do (prn %) %))
(partition-all 10))
View specx.clj
(defmacro ns-local
"Creates a locally aliased namespace matching supplied symbol"
`(alias ~k (create-ns (symbol (str *ns* "." (str ~k))))))
# Build and slim Erlang
# Change the line below if you want to use a different version of Erlang
# (Keep in mind that patches may not apply cleanly)
View gist:4ba85df7020aa534914f
[translation:info] 2.7.9 (default, Mar 8 2015, 00:52:26)
[translation:info] [GCC 4.9.2]
[platform:msg] Set platform with 'host' cc=None, using cc='gcc', version='Unknown'
[translation:info] Translating target as defined by target
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-default-3/gcctest.c -o /tmp/usession-default-3/gcctest.o
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-default-3/gcctest.c -o /tmp/usession-default-3/gcctest.o
[platform:execute] gcc /tmp/usession-default-3/gcctest.o -pthread -Wl,--export-dynamic -lrt -o /tmp/usession-default-3/gcctest
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-default-3/platcheck_0.c -o /tmp/usession-default-3/platcheck_0.o
[platform:execute] gcc /tmp/usession-default-3/platcheck_0.o -pthread -Wl,--export-dynamic -lrt -o /tmp/usession-default-3/platcheck_0
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unuse
View gist:43b3e33a6cdb529f92a1
(defn foo
[{:keys [x]
:or {x (println :set-default)}}]
user> (foo {:x 1})
You can’t perform that action at this time.