install the Leiningen build tool
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x lein
create a new project
(ns bloom.core | |
(:require [com.github.kyleburton.clj-bloom | |
:refer [make-optimal-filter | |
optimal-n-and-k | |
make-permuted-hash-fn | |
make-hash-fn-crc32 | |
add! | |
include?]]) | |
(:import [java.util BitSet])) |
(ns html-pdf | |
(:require [clojure.xml :refer [parse]] | |
[clj-pdf.core :refer [pdf]])) | |
(def tag-map | |
{:html [{}] | |
:h1 [:paragraph {:leading 20 :style :bold :size 14}] | |
:h2 [:paragraph {:leading 20 :style :bold :size 12}] | |
:h3 [:paragraph {:leading 20 :style :bold :size 10}] | |
:hr [:line] |
(ns file-watcher | |
(:require [clojure.set :refer [rename-keys]] | |
[clojure.java.io :refer [file]]) | |
(:import | |
[java.nio.file | |
FileSystems | |
Path | |
Paths | |
StandardWatchEventKinds])) |
(ns noise) | |
(def distributions | |
{:uniform 1 | |
:triangular 2 | |
:bell 5}) | |
(defn random-parametric [n bias] | |
(Math/pow | |
(/ (->> #(Math/random) |
(ns ascii-table) | |
(defn transpose [m] | |
(apply mapv vector m)) | |
(defn col-width [rows text-width] | |
(let [num-cols (-> rows first count)] | |
(int (/ (- text-width 2 (dec num-cols)) num-cols)))) | |
(defn height [length width] |
(def dict-16 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F]) | |
(def dict-32 [\1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \J \K \M \N \P \Q \R \S \T \U \V \W \X \Y \Z]) | |
(def dict-64 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z]) | |
(def dict-89 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z \+ \" \@ \* \# \% \& \/ \| \( \) \= \? \~ \[ \] \[ \} \$ \- \_ \. \: \space \, \; \< \>]) | |
(defn encode [dict value] | |
(let [base (-> dict count str BigInteger.)] |
(def messages (atom ["message 1" "message 2" "message 3"])) | |
(defn side-bar [] | |
(let [users (atom ["Bob" "Jane" "Alice"]) | |
selected-user (atom nil)] | |
(fn [] | |
[:ul.list-group | |
(into | |
[:ul] | |
(map |
(defn gen-name [k l] | |
(loop [n #(mod (* 399 %) 509) | |
r (nth "BDGKPNTVZ" (mod (n k) 9)) | |
k k | |
i 0] | |
(if (< i l) | |
(recur n | |
(str r (-> ["aeiouaeio" "bdgknptvwz"] (nth (bit-and i 1)) (nth (mod (n k) 9)))) | |
(n k) | |
(inc i)) |
(def doc (atom {:items ["foo" "bar" "baz"] | |
:table-items [["foo" "bar" "baz"] | |
["blah" "bleh" "blub"]]})) | |
(defn remove-at [v i] | |
(vec (into (subvec v 0 i) (subvec v (inc i) (count v))))) | |
(defn list-field [] | |
[:div | |
[:ul |