Skip to content

Instantly share code, notes, and snippets.

@claj
claj / redacted-log.log
Created Apr 15, 2020
crashing datomic ddb-local
View redacted-log.log
This file has been truncated, but you can view the full file.
2020-04-06 18:51:31.333 DEBUG default com.amazonaws.AmazonWebServiceClient - Internal logging succesfully configured to commons logger: true
2020-04-06 18:51:31.432 DEBUG default c.a.internal.config.InternalConfig - Configuration override awssdk_config_override.json not found.
2020-04-06 18:51:31.570 DEBUG default com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics
2020-04-06 18:51:31.621 INFO default datomic.slf4j.bridge - SLF4J Bridge installed
@claj
claj / kombucha.md
Created May 2, 2017
Kombucharecept.md
View kombucha.md

Kombucha

Ingredienser

  • 3 l vatten
  • 5 tsk grönt, rött eller svart te (viktigt att det inte har smaksättning)
  • 2 dl rårörsocker
  • Bär eller fruktpuré (helst syrligt, typ hallon)
  • 2 st smala glasbehållare, 1,5-2,0 l (tips är 3-litersburkar från Cordon Bleu)
  • Bomullstyg (t.ex. gammalt lakan)
@claj
claj / db-fn-tx-error-reproduce.clj
Last active Mar 3, 2017
datomic db/fn transactional behaviour (datomic 0.9.554)
View db-fn-tx-error-reproduce.clj
;; transact a db-fn using io.pedestal.log, but forget to add require!
user> (d/transact conn [{:db/id (d/tempid :db.part/user)
:db/ident :some-dbfn
:db/fn (d/function
'{:lang "clojure"
:params [db params]
:code (io.pedestal.log/error :some-dbfn "hello")})}])
#<promise$settable_future$reify__3565@738ad462:
{:db-before datomic.db.Db@e6de0f53,
:db-after datomic.db.Db@87233408,
View service_test.clj
(ns example.service-test
"Assuming we have a example.service returning a component system (with using... etc)
starts this, stops it etc."
(:require
[clojure.test :refer :all]
[example.service :refer :all]
[com.stuartsierra.component :as component]) )
(defn first-free-port
"Returns first free ephemeral port
View queryforms.clj
{:db/id #db/id [db.part/user 100001]
:question "what is your favourite animal?"
:question-type :single-option ;; could actually can be deduced from the fact below
:single-options ;; components or something.
[{:answer "cat"
:db/id #db/id [db.part/user 100002]}
{:answer "dog"
:db/id #db/id [db.part/user 100003]}
{:answer "rhino"
:db/id #db/id [db.part/user 100004]}]}
@claj
claj / core.clj
Last active Mar 17, 2016
state in go-loop
View core.clj
(ns world.core
(:require [clojure.core.async :refer [go chan >! <! <!! put! timeout close!]]))
(defn apply-to-fsm
[[state _] event]
(case [state event]
[:init :create] [:running [:allocate :run]]
[:running :stop] [:stopped [:stop]]
[:running :start] [:running []]
View path-with-enlive-example.clj
(ns path-with-enlive-example
(:require [net.cgrand.xml :as xml]
[clojure.zip :as z]))
;; This is meant to be answer to the question
;; "Enlive as a hammer" posted in the enlive mailing list:
;; https://groups.google.com/forum/#!topic/enlive-clj/Da0l_Vpu05U
;; div
;; | :content
@claj
claj / cas_enum_error.clj
Created Jun 1, 2015
CAS/enum error in Datomic 0.9.5173
View cas_enum_error.clj
(ns traktor.error
(:require [datomic.api :as d :refer [db q]]))
(d/create-database "datomic:mem://casenum")
(def conn (d/connect "datomic:mem://casenum"))
;; simple schema
@(d/transact conn [{:db/id #db/id [:db.part/db]
@claj
claj / init.el
Created May 25, 2015
emacs clojure toolbox setup
View init.el
;; put this in ~/.emacs.d/init.el :
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)
@claj
claj / example.clj
Last active Aug 29, 2015
Steam-roller function
View example.clj
(steam-roller [:a {1 2 3 4} 1 1 :a :a])
-> ([:a {1 2, 3 4} 1 1 :a :a] :a {1 2, 3 4} 1 3 2 4 1 1 :a :a)
count: 11
;;identityHashCodes:
(map #(System/identityHashCode %) (steam-roller [:a {1 2 3 4} 1 1 :a :a]))
(1460028191
2005509007
1545655515
504432400