This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns favila.eid-utils | |
"Utilities to construct or decompose entity ids on on-prem systems. | |
Many of these utilities replicate datomic.api functions because the peer api | |
lacks them. | |
The entity id format is: | |
sign-bit, reserved-bit, 20-partition-bits, 42-t-bits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Uses the h2 jar in a datomic distribution to give raw SQL access | |
# to the h2 database datomic "dev" storage uses. | |
# The 'SHUTDOWN COMPACT' command in particular performs all | |
# vaccum-like compaction of the h2 database file to remove | |
# unused blocks from deleted (garbage-collected) segments. | |
DATOMIC_HOME=${DATOMIC:-$HOME/lib/datomic/current} | |
DATOMIC_ADMIN_PASSWORD=${1:?Storage admin password must be provided} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
States | |
# No Signup uuid is known. | |
# These requests are parameterized by email address. | |
No Signup* | |
Create Signup request -> Create Signup Response? | |
Get Redirect to Google OAuth Signup -> TODO | |
Create Signup via Google OAuth -> TODO | |
# A Signup uuid is known. An Incomplete Signup satisfies `find-active-signup-id` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn nav-> [x p] | |
(nav x p (get x p))) | |
(defn array-game-inc [x k v] | |
(with-meta | |
(assoc x k (inc v)) | |
(meta x))) | |
(defn array-game [] | |
(with-meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def format-spans #"(?x) | |
(?:( (?: [^\\\{]++ | \\\{ )+ ) | |
|(?:\{ ( (?: [^\\}]*+ | \\} )+ ) }))") | |
(defmacro cljt [formatstr] | |
{:pre [(string? formatstr)]} | |
(if (= formatstr "") | |
formatstr | |
`(str ~@(binding [*read-eval* false] | |
(->> (re-seq format-spans formatstr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn safe-merge | |
"Like merge, but throws if maps have the same keys but different values." | |
[& maps] | |
(reduce | |
(fn [m [m2k m2v :as re]] | |
(if-some [[_ mv :as le] (find m m2k)] | |
(if (= mv m2v) | |
m | |
(throw (ex-info "Attempted to safe-merge maps with conflicting entries" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ENDPOINT=localhost:8998 \ | |
ACCESS=accesskey \ | |
SECRET=secret \ | |
ALIAS=alias \ | |
clj -Sdeps '{:deps {com.datomic/client-pro {:mvn/version "0.8.28"}}}' \ | |
-e "(require '[datomic.client.api :as d])" \ | |
-e '(defmacro E [sym] `(System/getenv ~(name sym)))' \ | |
-e '(-> (d/client {:server-type :peer-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package breeze.collections; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.CancellationException; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Future; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(with-open [pdf-document (PDDocument/load (clojure.java.io/file THE-FILE))] | |
(let [doc (.getDocument pdf-document) | |
getobj (fn [^COSObject x] | |
[:pdf.type/object (.getObjectNumber x) (.getGenerationNumber x)]) | |
visit (fn [^COSBase x ^ICOSVisitor vis] | |
(if (.isDirect x) | |
(if (instance? COSObject x) | |
(getobj x) | |
(.accept x vis)) | |
(cond |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns com.breezeehr.specs.keys-plus | |
"Variants of clojure.spec/keys and keys* that allow additional inline spec-ing." | |
(:refer-clojure :exclude [keys]) | |
(:require [clojure.core :as c] | |
[clojure.spec.alpha :as s] | |
[clojure.spec.gen.alpha :as gen] | |
[clojure.walk :as walk]) | |
#?(:cljs (:require-macros [com.breezeehr.specs.keys-plus])) | |
#?(:clj (:import (java.util UUID)))) |
NewerOlder