Skip to content

Instantly share code, notes, and snippets.


Jack Rusher jackrusher

View GitHub Profile
jackrusher / seq-primer.clj
Created Jun 1, 2021
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,



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 Apr 16, 2020
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 "")
jackrusher /
Created Mar 4, 2020
A few shell things to make working with emacs nicer (OSX focus)...
View wikidata-geo.clj
;; Where are all the -ow -itz place names in Germany? (Limit to 10 for printability)
'[:select *
:where [[?ort (wdt :instance-of) / (wdt :subclass-of) * (entity "human settlement")
_ (wdt :country) (entity "Germany")
_ rdfs:label ?name
_ (wdt :coordinate-location) ?wo]
:filter ((lang ?name) = "de")
:filter ((regex ?name "(ow|itz)$"))]
:limit 10])
jackrusher / negative-harmony.clj
Created Jun 25, 2019
Some example code for calculating triad transformations using Ernst Levy's concept of Negative Harmony, as recently popularized by Jacob Collier.
View negative-harmony.clj
(def the-notes
(cycle [:c :db :d :eb :e :f :gb :g :ab :a :bb :b]))
(def key-offset
(zipmap (take 12 the-notes) (range)))
(defn triads [the-key]
(let [offset (key-offset the-key)
scale (cycle [0 2 4 5 7 9 11])]
jackrusher / gcloud-tramp.el
Created Jun 19, 2019
Tramping into GCloud instances from within emacs
View gcloud-tramp.el
;; make sure you've set your default project with:
;; gcloud config set project <project-name>
(require 'tramp)
(add-to-list 'tramp-methods
(tramp-login-program "gcloud compute ssh")
(tramp-login-args (("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")