Skip to content

Instantly share code, notes, and snippets.

View otfrom's full-sized avatar
I may be slow to respond.

Bruce Durling otfrom

I may be slow to respond.
View GitHub Profile
(defun refile-by-created ()
(interactive)
(let* ((capture-header "* From Orgzly")
(created-ts (org-entry-get nil "created"))
(timestamp (cadr (org-timestamp-from-string created-ts)))
(file-date (format "%04d-%02d-%02d"
(plist-get timestamp :year-start)
(plist-get timestamp :month-start)
(plist-get timestamp :day-start))))
(org-cut-subtree)
@otfrom
otfrom / spec.json
Created December 21, 2023 13:49
Vega-Lite spec from Thu Dec 21 2023
{
"height": 800,
"width": 1360,
"title": {"text": "Number of Children in Care", "fontSize": 24},
"config": {
"legend": {"titleFontSize": 20, "labelFontSize": 14},
"axisX": {"titleFontSize": 16, "labelFontSize": 12},
"axisY": {"titleFontSize": 16, "labelFontSize": 12}
},
"data": {
^{:nextjournal.clerk/visibility {:result :hide}}
(defn md-row [v]
(str "| " (apply str (interpose " | " v)) " |\n"))
^{:nextjournal.clerk/visibility {:result :hide}}
(defn md-table [{:keys [columns alignment-spec data]}]
(clerk/md
(apply
str
(into [(md-row columns)
@otfrom
otfrom / dataset_sankey.clj
Created November 22, 2022 11:23
Converting some datasets (badly) into a sankey chart using plotly and clerk
(let [links (tc/dataset
[{:source 0 :target 2 :value 8}
{:source 1 :target 3 :value 4}
{:source 0 :target 4 :value 2}
{:source 2 :target 5 :value 8}
{:source 3 :target 5 :value 4}
{:source 3 :target 5 :value 2}])
nodes (tc/dataset {:label ["red" "orange" "yellow" "green" "blue" "violet"]
:color ["red" "orange" "yellow" "green" "blue" "violet"]})]
(clerk/plotly
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@otfrom
otfrom / copper.clj
Created February 19, 2018 17:09
How I learned core.async
(ns otfrom.copper
(:require [clojure.core.async :as a]))
(def tenner (a/chan))
(def mten (a/mult tenner))
(def t1 (a/tap mten (a/chan)))
(def t2 (a/tap mten (a/chan)))

Keybase proof

I hereby claim:

  • I am otfrom on github.
  • I am otfrom (https://keybase.io/otfrom) on keybase.
  • I have a public key whose fingerprint is 530E 1B82 4511 B1F9 B7A5 D21E 4458 A97B 2FE3 EE19

To claim this, I am signing this object:

(maybe-install-and-require 'gist)
@otfrom
otfrom / init.el
Last active December 26, 2015 02:49
A minimally broken ~/.emacs.d/init.el for cider.
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
;; This means we prefer things from ~/.emacs.d/elpa over the standard packages.
(package-initialize)
;; This bootstraps us if we don't have anything
(when (not package-archive-contents)