Skip to content

Instantly share code, notes, and snippets.

@CoderPrans
CoderPrans / get-sicp.clj
Last active July 13, 2021 21:11
ba.bash.ka script to download SICP
#!/usr/bin/env bb
(require '[babashka.curl :as curl])
(def sicp-url "https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/")
(def pages (map #(str "book-Z-H-" % ".html" ) (rest (range 39))))
(def data (map #(vector (str sicp-url %) %) pages))
@luzhuomi
luzhuomi / pocketchip_debian10.md
Last active April 16, 2024 13:05
A tutorial to upgrade NXT pocket C.H.I.P to Debian Buster

Pocket Chip Debian 10 Upgrade Guide

The purpose of this tutorial is to walk through the required steps to upgrade NXT chip (or pocketchip) from debian jessie to debian buster.

If you would like to start your Chip from scratch, follow the steps in the Preparation section.

Preparation (Optional)

A linux host machine, recommended Ubuntu 18.04. However I managed to do it with 20.10 with some tweak.

@lgessler
lgessler / deftx.clj
Last active May 6, 2021 06:42
Crux transaction function-backed mutations to avoid race conditions
(ns foo (:require [crux.api :as crux]))
(defmacro deftx [name bindings & body]
"Defines a function used for mutations that uses a Crux transaction function under the hood.
body must return a valid Crux transaction vector, with any non-clojure.core variables fully
qualified. `install-tx-fns` must be called on namespaces where deftx is used for the function
to work."
(let [kwd-name (keyword (str *ns*) (str name))
symbol-name (symbol (str name))]
`(def
@lgessler
lgessler / txfn_macro.clj
Last active September 24, 2020 14:24
Macro for crux tx-fns
(defmacro deftx [name node tx-fn]
"Defines a transaction function on the given node."
(let [kwd-name (keyword (str *ns*) (str name))]
`(do
(crux/submit-tx ~node [[:crux.tx/put {:crux.db/id ~kwd-name
:crux.db/fn (quote ~tx-fn)}]])
(defn ~name [& ~'args]
(crux/submit-tx ~node (log/spy [(into [:crux.tx/fn ~kwd-name] ~'args)]))))))
;; without macro
(ns ncgl.datum-human-readable
(:require [ncgl.db.fixtures :as db-fxt]
[datomic.api :as d]))
(defn fixture []
(let [conn (db-fxt/make-test-conn)]
@(d/transact conn
[{:db/id "FOO"
:gene/hgnc-id "FOO"}
{:db/id "panel-id"
@dragon788
dragon788 / .crypt-fix.md
Last active March 13, 2024 09:52
Repair "ubuntu--vg-root" not found with LUKS and LVM encryption

Crypt-fix

Use this script via curl -L -O https://gist.github.com/dragon788/e777ba64d373210e4f6306ad40ee0e80/raw/a86f3d05fb56feb6ef01fc2d61a4feb2fd82b281/crypt-fix.sh and sudo bash ./crypt-fix.sh. You may need to edit the DEVICE variable to reflect your disk and partition layout (this was created on an EFI system using LUKS and LVM). It will prompt you for your disk password once to mount and discover the correct name for the encrypted volume mount and then prompt again to mount with the correct name so that the update-initramfs command succeeds with the appropriate mapping, if this wasn't done you would get a warning and your next boot would still fail.

@mrcnc
mrcnc / core.clj
Last active December 13, 2017 10:07
clojure.spec at NOFUN
(ns nofun.spec.core
(:gen-class)
(:require [clojure.spec :as s]
[clojure.spec.gen :as gen]
[com.gfredericks.test.chuck.generators :as gen']
[camel-snake-kebab.core :refer :all]
[camel-snake-kebab.extras :refer [transform-keys]]))
;; require the namespace
(require '[clojure.spec :as s])
@itod
itod / split_keyboards.md
Last active April 28, 2024 19:44
Every "split" mechanical keyboard currently being sold that I know of
(defn select-view
"Navigates to a sequence that is the result of a select on the
current structure. Has similar functionality of srange and filterer,
but can be used with arbitrary selectors making it vastly more
powerful."
[& path]
(fixed-pathed-path [late path]
(select* [this structure next-fn]
(next-fn (compiled-select late structure)))
(transform* [this structure next-fn]
@mfikes
mfikes / scljs.md
Last active December 29, 2015 10:47
State of ClojureScript

If you look at the 2014 State of ClojureScript survey, these are the top items for What has been most frustrating for you in your use of CLJS?, and my take on work done in these areas is below. It is nothing short of amazing, IMHO.

Therefore I urge you to do the current survey.

  1. Difficulty using ClojureScript REPL: The Node.js REPL was added, as well as a Nashorn REPL, as well as a lot of new "ease-of-use" stuff baked into all base REPLs (doc, pst, etc.). Additionally, a few new ClojureScript REPLs (Ambly, Replete, Planck) rely heavily on new stuff in ClojureScript.
  2. Difficulty debugging generated JavaScript: Source map capability was essentially extended to all REPLs with stack traces automatically being mapped. The