Skip to content

Instantly share code, notes, and snippets.

@Jaretbinford
Jaretbinford / metric-grep.sh
Created August 22, 2016 18:35
updated metric-grep to pull all vars for a given metric
#!/usr/bin/env bash
function metric-grep () {
cat *.log | perl -n -e 'print "$1 $2\n" if /^(.*) INFO .* '"$1"' {.*?'"$2"' (.*?)\}/' | less
}
# call like:
# metric-grep :StorageGetMsec
# output example
@Jaretbinford
Jaretbinford / Merge.clj
Created September 9, 2016 15:00
Example of Merging two attributes
(ns merge.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
(def db-uri "datomic:dev://localhost:4334/merge")
(d/create-database db-uri)
(def conn (d/connect db-uri))
@Jaretbinford
Jaretbinford / core.clj
Created September 19, 2016 18:54
Testing write throughput on in-memory datomic db
(ns inmemperformance.core
(require [datomic.api :as d]
[clojure.java.io :as io]))
(def db-uri "datomic:mem://memory")
(d/delete-database db-uri)
(d/create-database db-uri)
(def conn (d/connect db-uri))
@Jaretbinford
Jaretbinford / core.clj
Created September 19, 2016 19:30
in-memory transaction tests
(ns inmemperformance.core
(require [datomic.api :as d]
[clojure.java.io :as io]))
(def db-uri "datomic:mem://memory")
(d/delete-database db-uri)
(d/create-database db-uri)
(def conn (d/connect db-uri))
@Jaretbinford
Jaretbinford / IntLongTestFree.clj
Created December 9, 2016 15:42
Test for google group question
(ns intlong.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
(def db-uri "datomic:free://localhost:4334/intlong")
(d/create-database db-uri)
(def conn (d/connect db-uri))
; Schema
@Jaretbinford
Jaretbinford / stringtemp.clj
Created December 26, 2016 14:07
String temp ids do not work with d/entity function calls
;;google group discussion link https://groups.google.com/forum/#!topic/datomic/m6vSa6CjqjQ
(ns stringtemp.core
(:import datomic.Util)
(require [datomic.api :as d]
[clojure.java.io :as io]))
;;Create the DB
(def db-uri "datomic:dev://localhost:4334/stringtemp")
(d/create-database db-uri)
@Jaretbinford
Jaretbinford / peermetrics.txt
Created January 18, 2017 13:58
metrics reported from the peer
The Datomic Pro peer can create the following CloudWatch metrics:
-----------------------------------PEER METRICS
|-------------------------------+------------+---------------+-----------------------------------------------------------------------------+
| Metric | Units | Statistic | Description |
|-------------------------------+------------+---------------+-----------------------------------------------------------------------------+
| AvailableMB | MB | minimum | unused RAM on peer * |
@Jaretbinford
Jaretbinford / peermetrics.txt
Created January 18, 2017 13:59
metrics reported from the peer
The Datomic Pro peer can create the following CloudWatch metrics:
-----------------------------------PEER METRICS
|-------------------------------+------------+---------------+-----------------------------------------------------------------------------+
| Metric | Units | Statistic | Description |
|-------------------------------+------------+---------------+-----------------------------------------------------------------------------+
| AvailableMB | MB | minimum | unused RAM on peer * |
@Jaretbinford
Jaretbinford / merge_.gitignore
Created January 30, 2017 18:53
Merge attributes/add FULLTEXT to an attribute
/target
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
.hgignore
@Jaretbinford
Jaretbinford / core.clj
Created January 30, 2017 18:54
merge attributes and add :db/fulltext to an already created attribute
;****How to Merge two attributes in Datomic.****
;
;Our database has recorded two attributes for a user. The user's e-mail and the users username.
;The username is required to be the e-mail for the user. Due to a design decision, e-mails will no longer
;be recorded. As such we need to depricate the e-mail attribute and merge it to our username attribute to ensure
;all e-mails represent usernames.
;
;The steps to this process are as follows:
;
;1. Rename the old attribute (i.e. :user/email to :user/email-deprecated)