Skip to content

Instantly share code, notes, and snippets.

View cddr's full-sized avatar

Andy Chambers cddr

View GitHub Profile
(ns kafka.test-helpers
"Here, we define a simpler version of jackdaw's test-machine
Tries to capture the two essential features of jackdaw via
a simple functional interface rather than having to learn a
whole new data format to write tests.
See `journal`/`with-journal` and `wait-for` for the main
entrypoints to this ns.
[diff "clj"]
xfuncname = "^(\\((def|ns)([^\\[])*).*$"
@cddr
cddr / ns.clj
Created April 16, 2020 08:40
Enumerate parameters permitted by some clojure spec
(ns scratch.ns
(:require
[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]))
(ns mock-avro-example
(:require
[clojure.data.json :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
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?
https://uk.reuters.com/article/uk-britain-eu-immigration-insight/where-do-i-go-eu-citizens-face-legal-limbo-after-decades-in-britain-idUKKCN1VK0CV
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.
(def client-impl
{:alter-topics* (fn [this topics]
(d/future
(->> (.alterConfigs this topics)
.all deref)))
:create-topics* (fn [this topics]
(d/future
(->> (.createTopics this topics)
.all deref)))
:delete-topics* (fn [this topics]
(ns cddr.avro2ddl
(:require
[clojure.string :as string]
[clojure.java.io :as io]
[clojure.data.json :as json])
(:gen-class))
(def home (System/getProperty "user.home"))
(def loan (-> (format "%s/Projects/avro-schemas/schemas/loan-3.json"
@cddr
cddr / schema-for.sh
Last active December 9, 2018 23:13
Show the schema loaded by the app contained in the specified docker image
#!/bin/bash
function cleanup () {
docker rm -f $pg >/dev/null
}
trap cleanup EXIT
PARAMS=""
while (( "$#" )); do
@cddr
cddr / startup.log
Last active October 10, 2017 22:37
clojure startup times
# traditional way to run program via lein
$ time lein run -m clojure.main -e '(println "yolo")'
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
cddr / schema.txt
Last active February 27, 2017 16:54
silly schema
tweet-published
id
user-id
msg
unique-key: id
partition-key: id
record-key: ?
user-mentioned
id