Skip to content

Instantly share code, notes, and snippets.

Loving Clojure

Jakub Holy holyjak

Loving Clojure
Block or report user

Report or block holyjak

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
holyjak / Beginner-friendly
Last active May 10, 2019
Beginner-friendly Clojure
View Beginner-friendly

Setup optimized for beginner friendliness.

BEWARE: Too many extra libraries can eventually cause problems of their own, with dependency conflicts etc.

Editor with REPL integration


  • Use Parinfer
holyjak /
Last active May 2, 2019
Kubernetes resources on AWS EKS having the "no available volume zone" problem

Resources for

The eks-pod-no-avail-volume-zone.yml file is nearly the same as the one we use in prod, only difference is hostname and "prod" / "stage" so this file is most likely not the source of the problem.

The storage is defined and AWS console shows I do have a gp2 volume attached to each worker node.

One difference between stage (broken) and prod (working): the former runs Kubernetes 1.11, the latter 1.10.

Cause & Solution

holyjak /
Last active Apr 10, 2019
Benefits of Clojure's use of generic data structures over Java's object graphs

WIP - collecting examples that show the benefit of using generic data structures over types and object graphs

Case 1

Task: Combine data usage amounts for individual subscribers together. If a subscriber appears multiple times, their amounts should be summed. SubscribersWithUsage.subscriberUsage is essentially a map of <user id> -> (map of <category> -> (map of <amount name> -> amount)). Most subscribers appear only once in the input but some do multiple times, in which case we sum all their usage amounts.


holyjak /
Last active Feb 12, 2019
Blog DRAFT: It will only take one hour... (On why programmers suck at estimating and the perils of software development) (WIP)
title tags
It will only take one hour... (On why programmers suck at estimating and the perils of software development)

"It will only take about an hour," I said to her. Two days later, a pull request awaits review. Where has all that time gone? What are the sources of delay in software development and how can we make it faster?

Our story

(If you are in a hurry and not interested in the details, feel free to jump to Obstacles and speed-ups)

holyjak /
Last active Dec 14, 2018
Java: Simulating various connection problems with Toxiproxy

Java: Simulating various connection problems with Toxiproxy

Simulate various connection issues with Toxiproxy and Java's HttpURLConnection to see what kind of errors get produced: connect timed out vs. read timed out vs. connection refused ... .


System: openjdk 11.0.1 2018-10-16

  1. (.setConnectTimeout 1) => connect timed out
holyjak / oz.clj
Created Nov 4, 2018
Comparison of gnuplot, Incanter, oz/vega-lite for plotting usage data - Oz
View oz.clj
(ns clj-charting.oz
[oz.core :as oz]
[incanter.core :refer :all]
[clj-charting.usage-chart-preparation :refer [read-usage-data moving-window-means]]))
(defn dataset->map-list
"Incanter dataset into a list of maps like
{\"0\" 1541065398391, \"1\" 446693376, \"2\" 99.9, \"cpu_mean\" 89}"
holyjak / incanter.clj
Last active Nov 4, 2018
Comparison of gnuplot, Incanter, oz/vega-lite for plotting usage data - Incanter
View incanter.clj
(ns clj-charting.incanter
[incanter.core :refer :all]
[incanter.charts :refer :all]
[clj-charting.usage-chart-preparation :refer [read-usage-data moving-window-means]])
[org.jfree.chart JFreeChart]
[org.jfree.chart.plot XYPlot]
(org.jfree.chart.axis ValueAxis NumberAxis NumberTickUnit TickUnitSource TickUnit)
(java.text NumberFormat DecimalFormat FieldPosition)))
holyjak / usage-chart-preparation.clj
Last active Nov 4, 2018
Incanter - prepare usage data
View usage-chart-preparation.clj
(ns clj-charting.usage-chart-preparation
[incanter.core :refer :all]
[incanter.stats :as s]
[ :as io]))
(defn- resolve-unit-suffix
"Replace values such as 333k, 800m, 1.2g with the corresponding value in bytes"
(if-let [[_ val unit] (and
holyjak /
Created Nov 1, 2018
Incanter: show bytes as kB/MB/GB on an axis

Modify an axis to display the number of bytes with scale suffixes such as kB, MB, GB, and display more reader-friendly ticks such as "500MB" instead of "496M".

The trick is to supply a custom "tick source" that tells JFreeChart what ticks it should prefer. I cheat a little and reuse the existing IntegerTickUnitSource, optimally I would rewrite it to work with multiples of 2 rather than 10.

holyjak / async-context.js
Created Nov 1, 2018
Async hooks on Nodejs
View async-context.js
const asyncHooks = require('async_hooks'); // Node 8.9+
const querystring = require('querystring');
const crypto = require("crypto");
const context = {};
function createHooks() {
function init(asyncId, type, triggerId, resource) {
// if (context[triggerId]) {
// context[asyncId] = context[triggerId];
You can’t perform that action at this time.