This file contains 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- mk* [m [a b & rest]] | |
(cond | |
(keyword? a) (recur (assoc m a b) rest) | |
a (recur (assoc m (keyword a) (symbol a)) (list* b rest)) | |
:else m)) | |
(defmacro mk [& syms] | |
(mk* {} syms)) |
This file contains 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
/media/mmcblk0p1/apks | |
http://repo.jing.rocks/alpine/v3.20/main | |
http://repo.jing.rocks/alpine/v3.20/community | |
# mount -o remount,rw /media/mmcblk0p1 |
This file contains 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 sh | |
[dir & args] | |
(let [proc (.exec (Runtime/getRuntime) | |
^"[Ljava.lang.String;" (into-array args) | |
(make-array String 0) | |
(io/as-file dir))] | |
(with-open [stdout (.getInputStream proc) | |
stderr (.getErrorStream proc)] | |
(future (io/copy stdout *out*)) | |
(future (io/copy stderr *err*)) |
This file contains 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 modal-scroll [width & contents] | |
[:div#modal {:class "fixed left-0 top-0 w-full h-full | |
z-10" | |
:style {:background-color "rgba(0,0,0,0.4)"} | |
:_ "on click if target.id === 'modal' add .hidden"} | |
[:div {:class (str "mx-auto border rounded-lg bg-white overflow-y-auto overflow-x-clip " width) | |
:style {:max-height "94vh" | |
:margin-top "3vh" | |
:margin-bottom "3vh"}} | |
contents]]) |
This file contains 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
(def cors-headers | |
{"Access-Control-Allow-Origin" "*" | |
"Access-Control-Allow-Methods" "POST, GET, OPTIONS, DELETE" | |
"Access-Control-Allow-Headers" "*" | |
"Access-Control-Expose-Headers" "*"}) | |
(defn wrap-cors [handler] | |
(fn [req] | |
(if (-> req :request-method (= :options)) | |
{:status 200 |
This file contains 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
(defmacro format-js [s] | |
`(-> ~s | |
~@(for [[to-replace replacement] (re-seq #"\{([^\}]+)}" s)] | |
`(string/replace-first ~to-replace ~(read-string replacement))))) |
This file contains 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 scripts.simplify-svg | |
(:require | |
[clojure.string :as string]) | |
(:import | |
java.text.DecimalFormat)) | |
(defn- map-rest [f [x & rest]] | |
(conj | |
(map f rest) | |
x)) |
This file contains 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 email-edit.core | |
(:import | |
java.util.Base64)) | |
(def encoder (Base64/getMimeEncoder)) | |
(def decoder (Base64/getMimeDecoder)) | |
(defn decode [^String s] | |
(String. (.decode decoder s))) | |
(defn encode [^String s] |
This file contains 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 -i | |
;; Usage: | |
;; Install babashka at https://github.com/babashka/babashka | |
;; put this script on PATH and make it executable | |
;; copy logs to the clipboard | |
;; to filter SimpleAsyncTaskExecutor-3 run | |
;; pbpaste | slct.clj 3 | |
(require '[clojure.string :as string]) |
NewerOlder