Skip to content

Instantly share code, notes, and snippets.

View claj's full-sized avatar

Linus Ericsson claj

  • Sweden
  • 21:53 (UTC +02:00)
View GitHub Profile
@claj
claj / redacted-log.log
Created April 15, 2020 12:35
crashing datomic ddb-local
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
2020-04-06 18:51:31.633 INFO default datomic.transactor - {"datomic.metricsCallback" clojure.core/identity, :tid 21, "datomic.printConnectionInfo" true, "datomic.txTimeoutMsec" 10000, "datomic.indexWorkDir" #object[java.io.File 0x73fb5bd0 "data/indexer"], "datomic.heartbeatIntervalMsec" 5000, "datomic.memoryIndexThreshold" 33554432, "datomic.versionUnique" "5544", "datomic.objectCacheMax" 134217728, "datomic.allowLogOverlap" false, "datomic.readAheadPool" 18, "datomic.version" "0.9.5544", :pi
@claj
claj / kombucha.md
Created May 2, 2017 18:45
Kombucharecept.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 March 3, 2017 13:29
datomic db/fn transactional behaviour (datomic 0.9.554)
;; 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,
(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
{: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 March 17, 2016 10:38
state in go-loop
(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 []]
(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 June 1, 2015 15:09
CAS/enum error in Datomic 0.9.5173
(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 11:26
emacs clojure toolbox setup
;; 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 August 29, 2015 14:05
Steam-roller function
(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