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
| ;; test larger gzip bytes | |
| (defn gzip-bytes | |
| [arr] | |
| (let [os (java.io.ByteArrayOutputStream.)] | |
| (with-open [gz (java.util.zip.GZIPOutputStream. os)] | |
| (.write gz arr)) | |
| (.toByteArray os))) | |
| (def arr1 (byte-array 65536 (byte 0))) | |
| (def arr2 (gzip-bytes arr1 )) | |
| (alength arr1) |
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 gzip-bench | |
| (:import [java.io ByteArrayInputStream ByteArrayOutputStream] | |
| [java.util.zip GZIPInputStream])) | |
| (defn gzip | |
| [arr] | |
| (let [os (java.io.ByteArrayOutputStream.)] | |
| (with-open [gz (java.util.zip.GZIPOutputStream. os)] | |
| (.write gz arr)) | |
| (.toByteArray os))) |
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 ssm-test) | |
| (require '[cognitect.aws.client.api :as aws]) | |
| (def ssm (aws/client {:api :ssm})) | |
| (aws/invoke ssm {:op :GetParametersByPath | |
| :request {:Path "/foo"}}) | |
| ;; works com.cognitect/http-client 1.0.127 |
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
| * Update JSR (Java Specification Request) to 4.0 | |
| - Questions about the update | |
| - What is changed? | |
| - Changelog JSR-000366 | |
| https://jcp.org/aboutJava/communityprocess/maintenance/jsr366/366ChangeLog.html | |
| - What is involved in the update? | |
| - JSR 366 overview of the Java EE 8 platform | |
| - JSR 365 CDI 2.0 | |
| - JSR 367 JSON binding JSON-B 1.0 | |
| - JSR 369 Java Servlet 4.0 |
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 http-thread-pool.core | |
| (:import | |
| [java.net URI] | |
| [java.net.http HttpClient HttpClient$Version | |
| HttpRequest HttpResponse$BodyHandlers] | |
| [java.time Duration] | |
| [java.util.concurrent CompletableFuture | |
| Executors LinkedBlockingQueue RejectedExecutionHandler | |
| ThreadFactory ThreadPoolExecutor TimeUnit])) |
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 dep-graph-db | |
| "Queries Maven Central to build a dependency graph of tracked artifacts" | |
| (:require [datomic.api :as d] | |
| [clojure.java.io :as io] | |
| [clojure.string :as str] | |
| [clojure.xml :as xml] | |
| [clojure.pprint :as pp])) | |
| (def tracked-artifacts | |
| #{"com.datomic/peer" |
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
| (require '[clojure.test.check.generators :as tgen]) | |
| (def gen-vals-and-select | |
| (tgen/bind | |
| gen-db-vals | |
| (fn [db-vals] | |
| (def db-vals db-vals) | |
| (if (seq db-vals) | |
| (tgen/let [nth1 (tgen/choose 1 3) | |
| nth2 (tgen/choose 1 3) | |
| sz1 (tgen/choose 1 (count db-vals)) |
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
| (require '[clojure.core.async :as a]) | |
| (a/<!! (a/thread (Thread/sleep 3000) "Foo")) | |
| (def c (a/chan 2)) | |
| (def o (a/thread (a/<!! c))) | |
| (a/>!! c "Foo") | |
| (Thread/getAllStackTraces) |
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
| (require '[clojure.core.async :as a]) | |
| (def from (a/chan 10)) | |
| (def to (a/chan 10)) | |
| (a/onto-chan!! from [1 2 3 4 5]) | |
| (a/<!! from) | |
| (a/pipeline-async 4 |
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 system.process) | |
| ;; Define a Long Running Task | |
| (defprotocol LongRunningProcessLifecycle | |
| (start [this] "Start a long running task") | |
| (finish [this] "Stop the runnig task")) | |
| ;; Implements lifecycle protocol | |
| (defrecord LongRunningProcess | |
| [worker] | |
| LongRunningProcessLifecycle |
NewerOlder