This file contains hidden or 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 pmap+ | |
" | |
Like pmap but accepts a custom size of a parallel | |
window. Not lazy, returns a vector. Takes only | |
one collection of arguments at the moment. | |
" | |
[n func items] | |
(lazy-seq | |
(let [[head tail] | |
(split-at n items)] |
This file contains hidden or 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 index-by | |
"Return a map where a key is (f item) and a value is item." | |
{:added "1.11" | |
:static true} | |
[f coll] | |
(persistent! | |
(reduce | |
(fn [ret x] | |
(assoc! ret (f x) x)) | |
(transient {}) coll))) |
This file contains hidden or 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
(try | |
(let [result# (do ~@body)] | |
~(if rollback? | |
`(.rollback ~bind) | |
`(.commit ~bind)) | |
result#) | |
(catch Throwable e# | |
(.rollback ~bind) | |
(throw e#))) |
This file contains hidden or 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 command | |
[ctx {:keys [id]}] | |
(let [{:keys [aws | |
service-name | |
environment-name-lower]} | |
ctx |
This file contains hidden or 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
(->> summary | |
(.getKey) | |
(.getObject s3 bucket) | |
(.getObjectContent))))) |
This file contains hidden or 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
(.withCredentials cred-wrapper) | |
(.build)))) | |
(defn ctx->client ^AmazonS3 [ctx] | |
(let [{:keys [aws]} | |
ctx | |
{:keys [aws-access-key-id |
This file contains hidden or 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 glms.report.indexes | |
(:import | |
java.io.Reader | |
java.io.File | |
java.io.FileWriter | |
java.io.BufferedReader) | |
(:require | |
[aws.athena :as ath] | |
[glms.index :as idx] | |
[clojure.data.csv :as data.csv] |
This file contains hidden or 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 parse-reader [^Reader reader] | |
(-> reader | |
(BufferedReader. 0xFFFF) | |
(.lines) | |
(.skip 1) | |
(.map (reify Function | |
(apply [_ line] | |
(-> line | |
(data.csv/read-csv) | |
(ffirst) |
This file contains hidden or 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
BOOLEAN (java.lang.Boolean) | |
INT2 (java.lang.Short) | |
INT4 (java.lang.Integer) | |
INT8 (java.lang.Long) | |
FLOAT4 (java.lang.Float) | |
FLOAT8 (java.lang.Double) | |
CHAR (java.lang.String) | |
VARCHAR (java.lang.String) | |
TEXT (java.lang.String) | |
ENUM (java.lang.String) |
This file contains hidden or 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 pg.client-test | |
(:import | |
com.github.igrishaev.Connection) | |
(:import | |
java.io.ByteArrayInputStream | |
java.io.ByteArrayOutputStream | |
java.time.Instant | |
java.time.LocalDate | |
java.time.LocalDateTime | |
java.time.LocalTime |