Skip to content

Instantly share code, notes, and snippets.


Dirk Wetzel NPException

View GitHub Profile
NPException / allergie_sort.clj
Last active October 19, 2021 09:41
Futtermittel-Allergie IgE-IgG Sortierung
View allergie_sort.clj
(ns allergie-sort
(:require [clojure.string :as str]))
(def ^:private categories
'{Weizen :Pflanze
Soja :Pflanze
Reis :Pflanze
Mais :Pflanze
Gerste :Pflanze
Kartoffel :Pflanze
View infix.clj
(defn ^:private encase-single-op
"Puts a single matching target operation in parentheses"
[expression target-op?]
;; no need to do something if it's already a simple expression
(if (= 3 (count expression))
(loop [prev []
[a op b & more] expression]
(target-op? op)
NPException / ants.clj
Created April 25, 2020 05:31 — forked from michiakig/ants.clj
Clojure ant sim from Rich Hickey
View ants.clj
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
NPException /
Last active January 27, 2020 19:10
implementation of the "infer" method from nipafx' Twitch stream
private Stream<TypedRelation> infer() {
// Clojure's "for" macro works essentially just like this nested loop,
// except that the resulting stream/sequence is lazily generated.
Builder<TypedRelation> relations = Stream.builder();
for (Article a1 : articles) {
for (Article a2 :articles) {
NPException / caffeine-wrapper.clj
Last active May 9, 2022 05:56
Clojure snippets
View caffeine-wrapper.clj
(ns caffeine-wrapper.core
(:require [com.stuartsierra.component :as component])
(:import [com.github.benmanes.caffeine.cache Cache Caffeine]
[java.util.concurrent TimeUnit]
[clojure.lang ITransientMap]
[com.codahale.metrics MetricSet Gauge]))
(defn store
"Stores an element for the given key in the Caffeine cache.
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
public interface INode {
* @return node identifier
public String getIdent();
NPException /
Created August 28, 2015 07:35
Stateful Random
import java.lang.reflect.Field;
import java.util.Random;
import java.util.concurrent.atomic.AtomicLong;
* @author NPException
* @date 28.08.2015
NPException /
Last active August 1, 2017 08:48
Shocky cheatsheet

Shocky cheatsheet

This is a collection of placeholders to use within factoids for the bot Shocky on EsperNet IRC. They were collected by manually checking this list for used placeholders and testing them on EsperNet.

Factoid placeholders

Placeholder Description
%arg{idx}[-[to_idx]] examples: %arg0%, %arg1-3%, %arg4-% - prints out the provided argument with index idx. A range of arguments to be printed can also be given by appending a "-" to the index. If no to_idx is provided, all following arguments will be printed out.
%bot% the name of the bot
%chan% current channel