Skip to content

Instantly share code, notes, and snippets.

@opqdonut
opqdonut / README.md
Last active December 4, 2024 15:08
An example of an Architecture Decision Record for a real project

Architecture Decision Records

This directory contains Architecture Decision Records (ADRs) that document technical decisions made during the development of the system.

A good ADR should have the following parts:

  • A date
  • People involved with the decision
@opqdonut
opqdonut / partitions.clj
Created October 31, 2024 08:38
All partitions of a sequence, without recursion
(ns partitions)
(defn nth-partition
"Interpreting i as a binary sequence, split coll at every 1 in the sequence."
[i coll]
(loop [current [(first coll)]
out []
coll (next coll)
i i]
(if-not coll
@opqdonut
opqdonut / seniority-and-acceptance.md
Last active September 26, 2024 09:53
On Seniority and Acceptance

https://www.metosin.fi/blog/2024-09-26-on-seniority-and-acceptance

On Seniority and Acceptance

There have been two hard pills for me to swallow as I've matured in my career, moving to more senior positions. By maturing I mean widening my impact from my individual contribution to the team level and beyond – being a multiplier, as they say. These hard pills are:

@opqdonut
opqdonut / pineapple.svg
Last active September 12, 2024 12:07
Pineapple mirage svg animation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@opqdonut
opqdonut / a10n.clj
Last active April 11, 2024 09:38
a10n.clj
(ns a10n
(:require [clojure.set :as set]
[clojure.string :as str]))
(defn i4t [t2e w2d val]
(if (empty? w2d)
(assoc t2e :end val)
(update t2e
(first w2d)
i4t (rest w2d) val)))
@opqdonut
opqdonut / README.md
Last active February 1, 2024 06:58
Python-Clojure communication with msgpack-over-udp

Python-Clojure communication with msgpack-over-udp

Install deps & start the python broadcast:

python -m venv venv
. ./venv/bin/activate
pip install -r requirements.txt
python broadcast.py
@opqdonut
opqdonut / unparse.clj
Created March 27, 2023 07:02
unparsing in clojure
(declare unparse)
(defn unparse-args [lang args]
(cond
(map? (first args))
(update-vals (first args) (partial unparse lang))
:else
(mapv (partial unparse lang) args)))
(defn unparse [lang data]
@opqdonut
opqdonut / deps.edn
Created June 1, 2022 11:31
Clojure structured logging via Log4J2
{:deps {org.apache.logging.log4j/log4j-api {:mvn/version "2.17.2"}
org.apache.logging.log4j/log4j-core {:mvn/version "2.17.2"}
org.apache.logging.log4j/log4j-layout-template-json {:mvn/version "2.17.2"}
org.apache.logging.log4j/log4j-slf4j18-impl {:mvn/version "2.17.2"}}}
@opqdonut
opqdonut / Fix.hs
Created February 13, 2022 15:27
ASTs with Functor fixpoints
{-# LANGUAGE DeriveFunctor, StandaloneDeriving #-}
import Data.Functor.Classes (Show1)
data ExprFunctor a = Literal Int | Plus a a | Times a a
deriving (Show, Functor)
data LineNumber a = LineNumber Int a
deriving (Show, Functor)
@opqdonut
opqdonut / card
Created December 21, 2021 07:51
Christmas card in Clojure
;;Merry Christmas from
;;Metosin! Run this
;;hand-baked Clojure
;;cookie to find our
;;wish for this holiday
(reduce reduce reduce[,
[reduce[comp][eval,,,,,
replace]][{\e,,,,,,,,,,
(comment)\h,,,,,,,,,,,,
assoc\i,,,,,,,,,,,,,,,,