Skip to content

Instantly share code, notes, and snippets.

Avatar

Oliver Powell greywolve

View GitHub Profile
@greywolve
greywolve / main.go
Created Aug 17, 2020
GoManila Cardinality Demo
View main.go
package main
import (
//"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"math/rand"
"net/http"
"time"
)
@greywolve
greywolve / permissions.clj
Created Jul 23, 2018
Apache Shiro style permissions in Clojure
View permissions.clj
(require '[clojure.set :as set])
(require '[clojure.string :as string])
(def wildcard :*)
(defn permission-string->permission [perm-str]
(->> (string/split perm-str #":")
(mapv (fn [s]
(->> (string/split s #",")
(map keyword)
@greywolve
greywolve / get-schema.clj
Last active Oct 5, 2016
Get all schema from a Datomic database, in a form that can be re-transacted.
View get-schema.clj
(defn get-schema [db]
(letfn [(attr->schema-tx [db attr]
(let [e (d/entity db attr)
em (->> e
(map identity)
(into {}))]
(cond
;; attribute
(:db/valueType e)
(merge em {:db/id (d/tempid :db.part/db)