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 / shell
Created June 24, 2022 16:16
clj -Ttools install io.github.babashka/http-server '{:git/tag "v0.1.4"}' :as serve
~ $ clj -Ttools install io.github.babashka/http-server '{:git/tag "v0.1.4"}' :as serve
Checking out: https://github.com/clojure/tools.tools.git at 9c5baa56cff02de98737a71d4dab098b268cd68b
Error building classpath. Failed to read artifact descriptor for org.clojure:tools.deps.alpha:jar:0.14.1212
org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.clojure:tools.deps.alpha:jar:0.14.1212
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:259)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:175)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
at clojure.tools.deps.alpha.extensions.maven$read_descriptor.invokeStatic(maven.clj:115)
at clojure.tools.deps.alpha.extensions.maven$fn__1137.invokeStatic(maven.clj:143)
@littleli
littleli / example.cljs
Created April 8, 2022 11:36
Bitcoinjs-lib example
(ns example
(:require ["bitcoinjs-lib$default" :as btc]
["tiny-secp256k1" :as secp]
["ecpair$default" :as ecpair]
["axios$default" :as axios]
[promesa.core :as p]
[cljs-bean.core :refer [->clj]]))
(def ecpf (ecpair/ECPairFactory. secp))
@echo off
set ARGS=%*
bb.exe -f gh_releases.clj %ARGS%
@littleli
littleli / gh_releases.clj
Created September 27, 2021 22:09
List github releases
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {borkdude/gh-artifacts
{:git/url "https://github.com/borkdude/gh-release-artifact"
:git/sha "2f8898d84126a4e922c490f8614211a8b0cf67cd"}}})
(assert (System/getenv "GITHUB_TOKEN") "GITHUB_TOKEN env var not set")
(require '[borkdude.gh-release-artifact :as gh])
(def args
(into {}
(for [[arg-name arg-val] (partition 2 (rest *command-line-args*))]
@littleli
littleli / hello.clj
Last active September 27, 2021 12:50
Say hello
(println "Hello world from Babashka")
@littleli
littleli / vlang-install.md
Created September 21, 2021 12:03
Install V lang on Windows 10 using scoop installer

There is a way how to install V lang on Windows using Scoop installer. I prepared the manifest myself and put it to bucket maintained by me.

scoop bucket add scoop-littleli https://github.com/littleli/Scoop-littleli.git
scoop install vlang

There is also an option to bootstrap V lang using llvm-mingw which contains stable Clang. I successfully recompiled V lang with it.