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:

@otfrom
otfrom / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.

----------- DATASETS -------------
-- Divide--
curl -v -H 'Content-Type: application/json' -u <username>:<password> -X POST --data "{\"entity_id\":\"9ac7f5635832d843dda594f58525239263ffdd37\",\"operation\":\"divide\", \"name\": \"systemEfficiencyOverall\", \"members\": [\"interpolatedHeatConsumption-b4f0c7e2b15ba9636f3fb08379cc4b3798a226bb\", \"interpolatedElectricityConsumption-268e93a5249c24482ac1519b77f6a45f36a6231d\"]}" http://www.getembed.com/4/entities/9ac7f5635832d843dda594f58525239263ffdd37/datasets/
-- Subtract --
curl -v -H 'Content-Type: application/json' -u <username>:<password> -X POST --data "{\"entity_id\":\"9ac7f5635832d843dda594f58525239263ffdd37\",\"operation\":\"subtract\", \"name\": \"cop-subtraction\", \"members\": [\"interpolatedElectricityConsumption-268e93a5249c24482ac1519b77f6a45f36a6231d\", \"interpolatedElectricityConsumption-3aae0fe7ddaa5e400a2cf9580a5e548d9255c70a\", \"interpolatedElectricityConsumption-122b4bf8dfa66cbf8f321f2d03c4d73f924bb719\"]}" http://www.getembed.com/4/enti