Skip to content

Instantly share code, notes, and snippets.

View whamtet's full-sized avatar

Matthew Molloy whamtet

  • Tokyo
View GitHub Profile
#!/usr/local/bin/planck
(require '[planck.core :refer [*in* slurp]])
(require '[clojure.string :as string])
(defn replaces [s]
(reduce
(fn [s [k v]]
(string/replace s k v))
s
{"Object {" "{"
#!/usr/local/bin/planck
(require '[planck.shell :refer [sh]])
(require '[cljs.reader :refer [read-string]])
(defn combinations [[head & rest]]
(if rest
(for [list (combinations rest)
item head]
(cons item list))
(map list head)))
sudo xattr -r -d com.apple.quarantine my-app
(ns app.render
(:require
[app.util :as util]
[clojure.string :as string]))
(defn flatten-list [x]
(filter (complement seq?)
(rest (tree-seq seq? seq x))))
(defn map->style [m]
@whamtet
whamtet / print.py
Last active February 25, 2022 01:11
#!/usr/bin/python3
import time
import tm1637
disp = [63, 6, 91, 79, 102, 109, 125, 7, 127, 111, 119, 108]
tm = tm1637.TM1637(clk=5, dio=4)
# all LEDS on "88:88"
def write(nums):
@whamtet
whamtet / svg.cljs
Created January 20, 2022 05:55
Preprocess svgs
#!/opt/homebrew/bin/planck
(require '[planck.core :refer [*in* slurp]])
(require '[clojure.string :as string])
(require '[cljs.reader :refer [read-string]])
(def in (slurp *in*))
(def subsections
(map second
(re-seq #"d=\"([^\"]+)" in)))
is_debug = false # To get a release build
target_cpu = "arm64"
v8_target_cpu = "arm64"
is_clang = false # To build with GCC instead of clan
treat_warnings_as_errors = false
is_component_build=true
use_custom_libcxx=false
;; deploy to clojars
{:auth {:repository-auth {#"clojars" {:username "whamtet" :password "app-pw"}}}
;; then go lein deploy clojars
(defn flatten-all [m] (->> m (tree-seq coll? seq) (remove coll?)))
(defn- pluralize [todo last-num done]
(if (empty? todo)
done
(let [[f & r] todo]
(recur
r
(if (number? f) f last-num)
(conj done
(if (coll? f)
((if (= 1 last-num) first second) f)