Skip to content

Instantly share code, notes, and snippets.

[Adblock Plus 1.1]
! Version: 202305300905
! Title: KindPrivacy
! Last modified: 30 May 2023 09:05 UTC
! Expires: 4 days (update frequency)
! *** easylist:template_header.txt ***
!
! Please report any unblocked adverts or problems
! in the forums (https://forums.lanik.us/)
! or via e-mail ([email protected]).
@tggreene
tggreene / checkpoint_gc.clj
Created June 14, 2022 16:28
Retain N Checkpoints
(ns excel.api.s3
(:require [cognitect.aws.client.api :as aws]
[integrant.core :as ig]
[clojure.tools.logging :as log]))
(defmethod ig/init-key ::client
[_ _]
(create-s3-client))
;; Code below may end up being a periodic background process for limiting s3

Bluetooth failing on boot

If you've ever had a message like:

Bluetooth: hci0: Failed to load intel firmware file ibt-20-1-3.sfi (-2)

displayed during the boot process (particularly if you have a LUKS partition and with mkinitcpio-bluetooth configured) this might solve the problem.

@tggreene
tggreene / logback.xml
Last active April 15, 2022 20:58
Logback Explainer
<!-- Logback Configuration. See http://logback.qos.ch/ -->
<!-- Adapted from https://github.com/stuartsierra/log.dev/blob/master/resources/logback.xml -->
<!-- For development (or even prod) you may want scan behaviour to pick up changes dynamically
<configuration scan="true" scanPeriod="1 seconds">
You can always modify runtime log levels with:
(.setLevel (org.slf4j.LoggerFactory/getLogger "your.namespace")
(ch.qos.logback.classic.Level/valueOf "INFO"))
@tggreene
tggreene / tampermonkey-scittle.js
Created April 5, 2022 10:46
TamperMonkey Scittle
// ==UserScript==
// @name <name>
// @namespace http://tampermonkey.net/
// @version 0.1
// @description <description>
// @author You
// @match <match>
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/scittle.js
// @resource cljs file:///path/to/some.cljs
// @grant GM_getResourceText
@tggreene
tggreene / depedencies.md
Created January 17, 2022 17:43
NPM Dependency Declarations

NPM Dependency Declarations

Some of the different ways of including npm dependencies:

Git

Note: There's some trickiness with how the package is built when pulling from git you should be able to rely on prepare being run, however, I'veseen a number of times where this has failed on people's machines.

"glamor": "github:tggreene/glamor#f6af50c70494b6e04f6ae5edc4db12320df37329"
@tggreene
tggreene / option1.cljs
Last active June 7, 2022 20:08
Potential Workaround for reagent managed inputs
(set! (.-isInput TextInput) true)
(set! (.-isInput Textarea) true)
(set! (.-isInput TextareaAutosize) true)
(set! reagent.impl.input/input-component?
(fn ^boolean [x]
(or (contains? #{"input" "textarea"} x)
(.-isInput ^js/Object x))))
@tggreene
tggreene / urandom.clj
Created May 4, 2020 18:57
Get random bytes in clojure
(defn urandom
[n]
(with-open [in (io/input-stream (io/file "/dev/urandom"))]
(let [buf (byte-array n)
_ (.read in buf)]
buf)))
@tggreene
tggreene / thread_by_name.clj
Created May 4, 2020 11:16
Get a thread by name in clojure
(defn get-thread-by-name
[thread-name]
(let [threads (keys (Thread/getAllStackTraces))]
(->> threads
(filter #(= thread-name (.getName %)))
(some identity))))
;; You can then use the value to stop the thread:
(.stop (get-thread-by-name "server-loop"))
@tggreene
tggreene / shadow-cljs-refactor-nrepl.md
Last active April 2, 2020 09:13
Setting up refactor-nrepl with shadow-cljs

shadow-cljs plays nicely with cider-nrepl courtesy of this little fella, however, not so much love for cider-nrepl's little brother refactor-nrepl.

Unfortunately there's no project agnostic way of loading nrepl middleware with the nrepl launched by shadow-cljs using user config alone (as stated here), but you can ask nrepl to configure middleware for itself with ~/.nrepl/nrepl.edn.

I have a working setup with the following (with shadow-cljs > 0.2.39 and nrepl 0.6.0):