Skip to content

Instantly share code, notes, and snippets.

View camsaul's full-sized avatar
💭
I am Cam

Cam Saul camsaul

💭
I am Cam
View GitHub Profile
@camsaul
camsaul / weston.log
Last active August 19, 2021 03:35
weston.log
Date: 2021-08-18 PDT
[18:42:58.437] weston 9.0.0
https://wayland.freedesktop.org
Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
Build: 9.0.0-38-g46756d0e
[18:42:58.438] Command line: /usr/bin/weston --backend=rdp-backend.so --xwayland --shell=rdprail-shell.so --logger-scopes=log,rdp-backend,rdprail-shell --log=/mnt/wslg/weston.log
[18:42:58.438] OS: Linux, 5.10.43.3-microsoft-standard-WSL2, #1 SMP Wed Jun 16 23:47:55 UTC 2021, x86_64
[18:42:58.438] Using config file '/home/wslg/.config/weston.ini'
[18:42:58.439] Output repaint window is 7 ms maximum.
[18:42:58.439] Loading module '/usr/lib/libweston-9/rdp-backend.so'
@camsaul
camsaul / yes-it-is.md
Created August 16, 2021 23:57
Markdown test

Yes, it is

@camsaul
camsaul / deps.edn
Created June 21, 2021 20:48
Tree example
{:deps {org.clojure/tools.deps.alpha {:mvn/version "0.11.931"}
clj-http/clj-http {:mvn/version "3.10.3"}}}
@camsaul
camsaul / presto_jdbc_timezones.clj
Created June 16, 2021 00:28
Testing Presto JDBC Timezone Support
(defn- unwrap-connection ^PrestoConnection [^C3P0ProxyConnection conn]
(.unwrap conn PrestoConnection))
(defn set-timezone! [conn ^String zone-id]
(.setTimeZoneId (unwrap-connection conn) zone-id))
(defn get-timestamp-utc [^com.facebook.presto.jdbc.PrestoResultSet rset ^Integer index]
(let [method (doto (.getDeclaredMethod com.facebook.presto.jdbc.PrestoResultSet
"getTimestamp"
(into-array Class [Integer/TYPE com.facebook.presto.jdbc.internal.joda.time.DateTimeZone]))
@camsaul
camsaul / presto_jdbc.clj
Last active June 7, 2021 21:33
Presto-JDBC Metabase test data extensions
(ns metabase.test.data.presto-jdbc
"Presto JDBC driver test extensions."
(:require [clojure.string :as str]
[metabase.config :as config]
[metabase.connection-pool :as connection-pool]
[metabase.driver :as driver]
[metabase.driver.sql-jdbc.execute :as sql-jdbc.execute]
[metabase.test.data.interface :as tx]
[metabase.test.data.sql :as sql.tx]
[metabase.test.data.sql-jdbc :as sql-jdbc.tx]
@camsaul
camsaul / unprefer_method.clj
Created May 21, 2021 19:55
Clojure unprefer-method
(defmulti my-multimethod
keyword)
(derive ::x ::keyword)
(derive ::y ::keyword)
(defmethod my-multimethod ::x
[_]
::x)
@camsaul
camsaul / search.clj
Created May 5, 2021 00:31
Finding a line in a file (binary search vs other strategies)
(defn unsorted [password]
(let [lines (atom 0)]
(with-open [reader (java.io.BufferedReader. (java.io.FileReader. (io/file (io/resource "common_passwords.txt"))))]
{:bad? (boolean
(some
(fn [a-password]
(swap! lines inc)
(= a-password password))
(iterator-seq (.. reader lines iterator))))
:n @lines})))
@camsaul
camsaul / updated.json.diff
Created April 30, 2021 23:06
Jabba autodiscovery output diff
--- updated.old.json 2021-04-30 15:50:09.720000000 -0700
+++ updated.json 2021-04-30 15:59:20.510000000 -0700
@@ -14,6 +14,7 @@
"1.14.0-0": "zip+https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14-win_x64.zip",
"1.14.0": "zip+https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-win_x64.zip",
"1.13.0-6": "zip+https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-win_x64.zip",
+ "1.13.0-5.1": "zip+https://cdn.azul.com/zulu/bin/zulu13.35.51-ca-jdk13.0.5.1-win_x64.zip",
"1.13.0-5": "zip+https://cdn.azul.com/zulu/bin/zulu13.35.17-ca-jdk13.0.5-win_x64.zip",
"1.13.0-4": "zip+https://cdn.azul.com/zulu/bin/zulu13.33.25-ca-jdk13.0.4-win_x64.zip",
"1.13.0-3": "zip+https://cdn.azul.com/zulu/bin/zulu13.31.11-ca-jdk13.0.3-win_x64.zip",
@camsaul
camsaul / logs.txt
Created April 16, 2021 21:26
Connections
2021-04-16 14:25:10,346 DEBUG middleware.log :: GET /api/card/8717 200 8.8 ms (5 DB calls) App DB connections: 5/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued)
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 8.3 ms (5 DB calls) App DB connections: 9/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued)
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 8.6 ms (5 DB calls) App DB connections: 9/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued)
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 9.9 ms (5 DB calls) App DB connections: 4/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total active threads) Queries in flight: 0 (0 queued)
2021-04-16 14:25:10,347 DEBUG middleware.log :: GET /api/card/8717 200 9.0 ms (5 DB calls) App DB connections: 3/15 Jetty threads: 41/50 (6 idle, 0 queued) (96 total ac
@camsaul
camsaul / expectations-to-deftest.el
Last active March 24, 2021 09:08
Emacs Lisp convert Clojure expectations form to clojure.test deftest form
(defun cam/-next-sexp-on-current-line-p ()
"Whether the next sexp after point is one the current line."
(let ((next-sexp (save-excursion
(paredit-forward)
(current-line))))
(= next-sexp (current-line))))
(defun cam/-clojure-in-expect-form-p ()
"Whether we are currently in a expect form."
(save-excursion