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 datomic-oom | |
| (:require [datomic.api :as d] | |
| [clojure.set :as set]) | |
| (:import (java.util UUID))) | |
| ; This gist reproduces an odd (?) OutOfMemoryError with datomic-pro v1.0.6344 | |
| (def conn (let [uri "datomic:mem://demo"] | |
| (d/delete-database uri) | |
| (d/create-database uri) |
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 iterate-gql-connection [{:keys [api-url token]} query variables] | |
| (->> (iteration | |
| (fn [after] | |
| (some->> (client/post api-url {:content-type :json | |
| :accept :json | |
| :as :json | |
| :headers {"authorization" (str "Bearer " token)} | |
| :form-params {:query query | |
| :variables (merge variables {:after after})}}) | |
| :body |
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 com.github.ivarref.cas-should-resolve-tempid-string | |
| (:require [clojure.test :as test :refer [deftest is]] | |
| [datomic.api :as d])) | |
| (def ^:dynamic *conn* nil) | |
| (def test-schema | |
| [#:db{:ident :e/id, :cardinality :db.cardinality/one, :valueType :db.type/string :unique :db.unique/identity} | |
| #:db{:ident :e/info, :cardinality :db.cardinality/one, :valueType :db.type/string} | |
| #:db{:ident :e/version, :cardinality :db.cardinality/one, :valueType :db.type/long}]) |
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 com.github.ivarref.clj-paginate.ticker | |
| (:require [clojure.string :as str]) | |
| (:import (clojure.lang IFn) | |
| (java.lang AutoCloseable))) | |
| (def is-cursive? | |
| (try | |
| (require '[cursive.repl.runtime]) | |
| true | |
| (catch Exception _ |
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 user.db.transact-assert-basis-t | |
| (:require [clojure.edn :as edn] | |
| [clojure.stacktrace :as st] | |
| [datomic.api :as d]) | |
| (:import (clojure.lang IBlockingDeref IDeref IPending) | |
| (datomic Connection) | |
| (java.util.concurrent Future TimeUnit TimeoutException))) | |
| (def schema | |
| "transact-assert-basis-t requires a single function present in the transactor: this function. |
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
| package no.nsd; | |
| import java.awt.*; | |
| import java.awt.event.*; | |
| import java.io.IOException; | |
| import java.net.ConnectException; | |
| import java.net.URI; | |
| import java.net.URISyntaxException; | |
| import java.net.http.HttpClient; | |
| import java.net.http.HttpRequest; |
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
| #!/usr/bin/env bb | |
| (ns tray-tail | |
| (:require [clojure.java.io :as io] | |
| [clojure.string :as str] | |
| [cheshire.core :as json] | |
| [babashka.http-client :as http]) | |
| (:import (java.io File) | |
| (java.net URLEncoder) | |
| (java.time ZonedDateTime) | |
| (java.time.format DateTimeFormatter) |
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
| # based on https://mdk.fr/blog/how-apt-does-its-fancy-progress-bar.html | |
| # to run: python -u ./demo.py | |
| # notice the -u for unbuffered | |
| import time | |
| import os | |
| from datetime import datetime | |
| columns, lines = os.get_terminal_size() |
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 time | |
| import os | |
| from datetime import datetime | |
| columns, lines = os.get_terminal_size() | |
| def write(s): | |
| print(s, end="") | |
| # time.sleep(0.02) |
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 faulthandler | |
| import multiprocessing | |
| import os | |
| import signal | |
| def run_buggy(): | |
| shutdown_event = multiprocessing.Event() | |
| def sigterm_handler(_signo, _stack_frame): |