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 |
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
| printf '\x46\x49\x4c\x20\x57\x41\x53\x20\x48\x45\x52\x45' |
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
| (import '[java.net DatagramSocket DatagramPacket InetAddress]) | |
| (def query | |
| (byte-array | |
| [(byte 0x12) (byte 0x34) (byte 0x01) (byte 0x00) | |
| (byte 0x00) (byte 0x01) (byte 0x00) (byte 0x00) | |
| (byte 0x00) (byte 0x00) (byte 0x00) (byte 0x00) | |
| (byte 0x07) (byte \c) (byte \l) (byte \o) | |
| (byte \j) (byte \u) (byte \r) (byte \e) | |
| (byte 0x03) (byte \o) (byte \r) (byte \g) |
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 '[org.httpkit.server :as server] | |
| '[hiccup2.core :as h]) | |
| (def content | |
| (str (h/html | |
| [:meta {:charset "UTF-8"}] | |
| [:head | |
| [:script {:src "https://livejs.com/live.js" :type "text/javascript"}]] | |
| [:body {:style {:background-color :black, :text-align :center}} | |
| [:img {:src "https://github.com/clojurehackers/website/blob/main/assets/logo.jpg?raw=true", :align :center}] |
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 '[dev.nu.morse :as morse] | |
| '[clojure.main :as main]) | |
| (morse/launch-in-proc) | |
| (main/repl | |
| :eval | |
| (fn [form] | |
| (let [v (eval form)] | |
| (morse/submit form v) | |
| v))) |
NewerOlder