Skip to content

Instantly share code, notes, and snippets.

Yannick Scherer xsc

Block or report user

Report or block xsc

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
xsc / benchmark.patch
Created Aug 31, 2014
pjson benchmarks
View benchmark.patch
From a74d2f6d2337d28a97d48aeb06299269bac6354d Mon Sep 17 00:00:00 2001
From: Yannick Scherer <>
Date: Sun, 31 Aug 2014 15:51:53 +0200
Subject: [PATCH] benchmark adjustments.
src/main/bench/pjson/parse_bench.clj | 37 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/src/main/bench/pjson/parse_bench.clj b/src/main/bench/pjson/parse_bench.clj
xsc / kasumi.hs
Created Dec 15, 2012
KASUMI implementation in Haskell
View kasumi.hs
module Kasumi where
import Data.Bits
import Data.List
import Data.Word
-- Helpers
rol16 x 0 = x
rol16 x n = 0xFFFF .&. ((shiftL x n) .|. (shiftR x (16 - n)))
xsc / repl.clj
Last active Dec 16, 2015
Clojure and Thrift using Java Interop (intended for the REPL)
View repl.clj
;; Processor
(import '(org.example Person PersonIndex PersonIndex$Processor
PersonIndex$Client PersonIndex$Iface))
(def person-index-processor
(proxy [PersonIndex$Iface] []
(store [p]
(println "Storing Person:")
xsc / fast_zip_utils.clj
Created Aug 7, 2013
node removal utilities for fast-zip
View fast_zip_utils.clj
(ns fast-zip-utils
(:require [fast-zip.core :as z])
(:import [fast_zip.core ZipperPath ZipperLocation]))
(defn remove-right
"Remove right sibling of the current node (if there is one)."
[^ZipperLocation zloc]
(let [path ^ZipperPath (.path zloc)]
(if (zero? (count (.r path)))
xsc / main.clj
Created Nov 18, 2012
Counting Characters in Clojure
View main.clj
(ns character-counter.main)
;; ------------------------------------------------------------------------
;; ------------------------------------------------------------------------
;; Different Count Strategies
(def count-a-with-regex
xsc / restricted_spec.clj
Last active Oct 26, 2016
Restricted/Dynamic Specs
View restricted_spec.clj
(s/def ::element
(s/def ::list
(s/coll-of ::element))
(s/def ::map
(s/keys :req [::list]))
;; I'd like to make the '::map' spec more restrictive, i.e. only accept a
xsc / ast_spec.clj
Last active Oct 29, 2016
Useless Language AST (clojure.spec)
View ast_spec.clj
;; The AST consists of declarations and calls.
(s/def :lang/ast
(s/keys :req [:lang/declarations :lang/calls]))
;; Throughout, we'll use variables/calls identified by their name.
(s/def :lang/name
(s/and string? #(re-matches #"[a-z]+" %)))
(s/def :lang/variable-name
xsc / user.clj
Created May 11, 2018
Transforming rewrite-clj's Midje testcases to standard Clojure tests
View user.clj
(ns user
(:require [ :as z]
[rewrite-clj.node :as n]))
(defn token=
[loc v]
(and (= :token (z/tag loc))
(= v (z/sexpr loc))))
(defn fact?
xsc / base64.clj
Created May 4, 2013
Base64 Encoding/Decoding in Clojure
View base64.clj
(ns ^{ :doc "Base64 Encoding/Decoding in Clojure"
:author "Yannick Scherer" }
;; ## Conversion Functions
(def ^:private base64-chars
"Base64 Characters in the right order."
You can’t perform that action at this time.