Skip to content

Instantly share code, notes, and snippets.


Jack Rusher jackrusher

View GitHub Profile
tell application "Chrome" to tell the active tab of its first window
end tell
jackrusher /
Created January 17, 2022 15:22
Writing and deploying Google Cloud Functions in Clojure using NBB
# command line to deploy the project
gcloud functions deploy hello --runtime nodejs14 --trigger-http
View truchet-os.asm
;; Boot to PRINT10
;; Use nasm to assemble the code to a binary:
;; $ nasm -f bin -o boot.bin boot.nasm
;; Use dd to make an empty floppy disk image:
;; $ dd if=/dev/zero of=boot.flp ibs=1k count=1440
jackrusher / seq-primer.clj
Created June 1, 2021 12:55
Condensed visual tutorial in #Bauhaus style for a subset of the #Clojure seq API (inspired by similar JS tweets)
View seq-primer.clj
(def ■ '■)
(def ▲ '▲)
(def ● '●)
(first [● ■ ▲]) ; ●
(second [● ■ ▲]) ; ■
(nth [● ■ ▲] 2) ; ▲
(rest [● ■ ▲]) ; (■ ▲)
(last [● ■ ▲]) ; ▲
(butlast [● ■ ▲]) ; (● ■)

Twitter abuses all media file uploads, each type in its own way. If we want to upload a good looking animation loop from some low-color, high-detail generative art, we have to game their system's mechanisms.

  • don't upload a video file, they will re-encode it into absolute 💩

  • create a GIF, which they will auto-convert into a video file 😱

  • The frames of the GIF will be resized to an even-sized width using an extremely naive algorithm. Your GIF should be an even size (1000, 2000,

jackrusher / trinity.js
Created March 29, 2021 09:23
A fast, minimal JS triple store implementation in ~70 lines of code
View trinity.js
// three indices to efficiently support all lookups
function createDB() {
return {eav: new Map(),
ave: new Map(),
vea: new Map()};
function addToIndex(xs, x, y, z, triple) {
let ys = xs.get(x);
if(ys == undefined) {
jackrusher /
Created October 16, 2020 12:02
Clojure + FUSE


A minimal example of creating a (mostly) working FUSE filesystem using Clojure. NOTE: I have only tested this with OSX, and it assumes you have already installed libfuse.

Trying it out

Create an empty directory at /tmp/meld to serve as your mount point, put these files in a directory called meld, then:

jackrusher / json->edn.el
Created April 16, 2020 13:26
Convert the current region in emacs from JSON to EDN using Bork's Jet.
View json->edn.el
;; Uses
;; On OSX, install jet with:
;; brew install borkdude/brew/jet
;; I invoke this with M-x, you might want to bind it to a key
(defun json->edn ()
(shell-command-on-region (region-beginning)
View extract-tables.clj
(ns appliedsciencestudio.covid19-clj-viz.repl
(:require [clojure.string :as string]
[hickory.core :as hick]
[ :as s]))
;;;; Scraping data
(def wiki-page
"We want this data, but it's only published as HTML."
(slurp ""))
View scrape-worldometer.clj
(ns appliedsciencestudio.covid19-clj-viz.repl
(:require [clojure.string :as string]
[hickory.core :as hick]
[ :as s]))
;;;; Scraping data
(def worldometers-page
"We want this data, but it's only published as HTML."
(-> (slurp "")