Skip to content

Instantly share code, notes, and snippets.

@tristanstraub
tristanstraub / init.el
Created August 9, 2018 04:00
el-get with ensure-package
(load "server")
(unless (server-running-p)
(server-start))
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("melpa" . "https://stable.melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'load-path (expand-file-name "el-get/el-get" "~/.emacs.d"))
@tristanstraub
tristanstraub / consumer.sh
Created August 30, 2018 01:38 — forked from dongjinleekr/consumer.sh
Kafka benchmark commands
## Consumer Throughput: Single consumer thread, no compression
## Consumer Throughput: 3 consumer thread, no compression
bin/kafka-consumer-perf-test.sh --topic benchmark-3-3-none \
--zookeeper kafka-zk-1:2181,kafka-zk-2:2181,kafka-zk-3:2181 \
--messages 15000000 \
--threads 1
(ns watermarks)
(defn partition-of
[partitions key]
(mod (.hashCode "test") partitions))
(def partitions 12)
(defn produce!
[broker topic key message]
(setq-default indent-tabs-mode nil)
(load "server")
(unless (server-running-p)
(server-start))
(defun mac-metas ()
"for mac keyboard"
(setq mac-option-modifier 'super)
(setq mac-command-modifier 'meta))
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='{:deps {aysylu/loom {:mvn/version "1.0.2"}
org.apache.kafka/kafka-streams {:mvn/version "2.2.0"}}}'
#_You can put other options here
OPTS='-J-Xms256m -J-Xmx256m -J-client'
exec clojure $OPTS -Sdeps "$DEPS" "$0" "$@"
)
(def values
[[(/ 1.0 2.0)
(/ 1.0 2.0)]
[(/ 1.0 3.0)
(/ 1.0 3.0)
(/ 1.0 3.0)]])
(defn mean
[xs]
(/ (double (reduce + xs)) (count xs)))