Skip to content

Instantly share code, notes, and snippets.

View littleli's full-sized avatar

Aleš Najmann littleli

View GitHub Profile
@littleli
littleli / webdav.clj
Created July 21, 2023 14:59 — forked from jackrusher/webdav.clj
A minimal webdav server/synthetic filesystem that works with JVM Clojure and babashka. See comments for instructions!
(ns webdav
(:require [clojure.string :as str]
[clojure.data.xml :as xml]
[org.httpkit.server :as hk-server]))
;; add the XML namespace that we'll use later
(xml/alias-uri 'd "DAV:")
(defn dissoc-in
"Should be in the standard library..."
@littleli
littleli / AAA-README.md
Created February 19, 2023 15:27 — forked from jackrusher/AAA-README.md
Clojure + FUSE

Meld

A minimal example of creating a (mostly) working FUSE filesystem using Clojure. NOTE: I have only tested this with OSX, and it assumes you have already installed libfuse.

Trying it out

Create an empty directory at /tmp/meld to serve as your mount point, put these files in a directory called meld, then:

@littleli
littleli / radix_trie.clj
Created July 5, 2022 21:31 — forked from samuelclay/radix_trie.clj
A Radix Trie (aka PATRICIA trie) implemented in Clojure. For my JavaScript implementation, see this interactive JS fiddle: http://jsfiddle.net/jCYAw/
(ns radix
(:require [clojure.string :as string]))
(use 'clojure.java.io)
(use 'clojure.pprint)
(println "Loading names... ")
(time (def names
(with-open
[rdr (reader
"/usr/share/dict/ProperNames")]
@littleli
littleli / SoABenchmark.java
Created January 18, 2021 21:16 — forked from twolfe18/SoABenchmark.java
Does SoA (structure of arrays) beat AoS (array of structures) for Java?
package sandbox;
import java.util.Arrays;
import java.util.Random;
public class SoABenchmark {
public static Random rand = new Random(9001);
public static int NUM_LABELS = 10;
public static Struct[] aos;
@littleli
littleli / spike-day-02-03-20.md
Created March 23, 2020 21:32 — forked from cldwalker/spike-day-02-03-20.md
GraalVM dive in Clojure at work

Spike

I looked into the state of GraalVM and Clojure and wrote some small work-related scripts.

GraalVM Build Tools

@littleli
littleli / transducers.md
Created April 17, 2019 16:59 — forked from pjstadig/transducers.md
The secret feature of transducers that no one talks about!

The Pledge

One thing that always made me a little sad about transducers was how map lost its ability to iterate multiple collections in parallel. This is actually my favorite feature of map. For example:

(map + (range 5) (range 5 10))
=> (5 7 9 11 13)

One somewhat practical use of this is if you want to compare two sequences, pairwise, using a comparator. Though I wish that every? took multiple collections, this is an adequate substitute:

@littleli
littleli / truffle-material.md
Created December 28, 2017 16:39 — forked from smarr/truffle-material.md
Truffle: Languages and Material
@littleli
littleli / README.md
Created January 24, 2017 00:39 — forked from polbins/README.md
Android Studio as default Git Diff Tool

Create Android Studio Command-line Launcher

  1. Open Android Studio
  2. Go to: Tools > Create Command-line Launcher
  3. Leave as default, Press OK

Configure Git to use Android Studio as default Diff Tool

  1. Add the following lines to your .gitconfig
@littleli
littleli / latency.txt
Created November 28, 2016 09:14 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD