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
;; Uses https://github.com/borkdude/jet | |
;; 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 () | |
(interactive) | |
(shell-command-on-region (region-beginning) |
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 appliedsciencestudio.covid19-clj-viz.repl | |
(:require [clojure.string :as string] | |
[hickory.core :as hick] | |
[hickory.select :as s])) | |
;;;; Scraping data | |
(def wiki-page | |
"We want this data, but it's only published as HTML." | |
(slurp "https://en.wikipedia.org/wiki/List_of_countries_by_hospital_beds")) |
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 appliedsciencestudio.covid19-clj-viz.repl | |
(:require [clojure.string :as string] | |
[hickory.core :as hick] | |
[hickory.select :as s])) | |
;;;; Scraping data | |
(def worldometers-page | |
"We want this data, but it's only published as HTML." | |
(-> (slurp "https://www.worldometers.info/coronavirus/") | |
hick/parse |
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
;; Where are all the -ow -itz place names in Germany? (Limit to 10 for printability) | |
(query | |
'[: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]) |
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 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])] | |
(map |
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
;; make sure you've set your default project with: | |
;; gcloud config set project <project-name> | |
(require 'tramp) | |
(add-to-list 'tramp-methods | |
'("gcssh" | |
(tramp-login-program "gcloud compute ssh") | |
(tramp-login-args (("%h"))) | |
(tramp-async-args (("-q"))) | |
(tramp-remote-shell "/bin/sh") |
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 planetoid | |
(:require [chia.util.js-interop :as j] | |
["three" :as three] | |
["bezier-easing" :as BezierEasing])) | |
(defonce renderer | |
(doto (three/WebGLRenderer. (clj->js :antialias true)) | |
(.setPixelRatio (.-devicePixelRatio js/window)) | |
(.setSize (.-innerWidth js/window) (.-innerHeight js/window)) | |
(.setClearColor "#000000") |
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
(global-set-key (kbd "<F12>") | |
(lambda () | |
(shell-command "refresh-chrome"))) |
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 drei | |
(:require [chia.util.js-interop :as j] | |
["three" :as three] | |
["bezier-easing" :as BezierEasing] | |
[colours :refer [palettes]])) ; from Google's art palettes project | |
(defonce renderer | |
(doto (three/WebGLRenderer. (clj->js :antialias true)) | |
(.setPixelRatio (.-devicePixelRatio js/window)) | |
(.setSize (.-innerWidth js/window) (.-innerHeight js/window)) |