Skip to content

Instantly share code, notes, and snippets.


Andy Chambers cddr

  • High Quality Systems
  • Stirling, Scotland
View GitHub Profile
View .gitconfig
[diff "clj"]
xfuncname = "^(\\((def|ns)([^\\[])*).*$"
cddr / ns.clj
Created Apr 16, 2020
Enumerate parameters permitted by some clojure spec
View ns.clj
(ns scratch.ns
[clojure.spec.alpha :as s]))
(s/def ::foo string?)
(s/def ::bar string?)
(s/def ::baz string?)
(s/def ::yolo (s/keys :req-un [::foo ::bar]
:opt-un [::baz]))
View mock-avro-mvp.clj
(ns mock-avro-example
[ :as json]
[jackdaw.streams :as k]
[jackdaw.serdes.avro :as avro]
[jackddaw.serdes.avro.schema-registry :as reg]
[jackdaw.test :as jdt]))
(def foo-schema
{:type :record
View gist:b6f0c566c8aa6dec6a8851368a385a33
Saturday 31 August 2019
Dear Stephen Kerr,
Can you please just look at the devastation and anxiety you are causing thousands of innocent people around the UK. How can you sleep at night knowing that you have caused this? And for what?
I know first-hand how much it costs to move overseas, not only financially but emotionally and physically. I am beyond rage at this point on behalf of the friends and colleagues who have come to this country to improve our health service, build our houses, cook our food, develop our IT systems and so on. Each day I read stories about the impossible situation we have put these people in. They would like to stay here but they simply do not know whether they will be allowed.
View threaded-style.clj
(def client-impl
{:alter-topics* (fn [this topics]
(->> (.alterConfigs this topics)
.all deref)))
:create-topics* (fn [this topics]
(->> (.createTopics this topics)
.all deref)))
:delete-topics* (fn [this topics]
View avro2ddl.clj
(ns cddr.avro2ddl
[clojure.string :as string]
[ :as io]
[ :as json])
(def home (System/getProperty "user.home"))
(def loan (-> (format "%s/Projects/avro-schemas/schemas/loan-3.json"
cddr /
Last active Dec 9, 2018
Show the schema loaded by the app contained in the specified docker image
function cleanup () {
docker rm -f $pg >/dev/null
trap cleanup EXIT
while (( "$#" )); do
cddr / startup.log
Last active Oct 10, 2017
clojure startup times
View startup.log
# traditional way to run program via lein
$ time lein run -m clojure.main -e '(println "yolo")'
real 0m6.678s
user 0m9.845s
sys 0m0.961s
# new clojure script (supported by tools.deps.alpha)
# in this test, we force clojure to compute the classpath before running the script
cddr / schema.txt
Last active Feb 27, 2017
silly schema
View schema.txt
unique-key: id
partition-key: id
record-key: ?
View puma.clj
(defn holdings-manager
"Returns a collection of kstreams, one for each different way in which
loan ownership state may be updated"
(let [ownership-store (k/store "loan-ownership")]
(-> (k/kstream puma-events)
(k/transform (update-ownership ownership-store))
(k/branch [trade-result?