Skip to content

Instantly share code, notes, and snippets.

@sachac
sachac / clock.html
Created Nov 6, 2018
Simple analog clock for A-
View clock.html
<html>
<head>
<!-- Based on https://bl.ocks.org/vasturiano/118e167e9bc93356221f67905c87cd6f , Vasco Asturiano, MIT License -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/4.6.0/d3.min.js"></script>
<script src="http://unpkg.com/d3-radial-axis@1.5/dist/d3-radial-axis.min.js"></script>
<style type="text/css">
body {
text-align: center;
font-family: Sans-serif;
margin: 0;
@sachac
sachac / cooking.org
Created May 2, 2017
Org Mode cooking notes, with some code for compiling a grocery list and comparing it with staples
View cooking.org

Meal planning tool

View idtypes2.txt
{ p_record_id: [ '1000004', '1000004', '1000004' ],
p_date_general: [ '2001' ],
p_num_isbn: [ '0908307942' ],
p_title_short: [ 'The historical dimensions of democracy and human rights in Zimbabwe' ],
p_publication_results: [ 'Mount Pleasant, Harare, Zimbabwe : Zimbabwe University Publications, 2001-.' ],
p_publication_full: [ 'Mount Pleasant, Harare, Zimbabwe : Zimbabwe University Publications, 2001-.' ],
p_publication: [ 'Zimbabwe University Publications, 2001-.' ],
p_description_results: [ 'v. <1 > ;' ],
p_description_full: [ 'v. <1 > ; 21 cm.' ],
p_notes_contents: [ 'v.1. Pre-colonial and colonial legacies' ],
View organizer.org

Save package symbols:

(with-temp-file "~/.emacs.d/.package-list"
  (prin1 (mapcar 'car package-archive-contents) (current-buffer))
  nil)

Compare package symbols:

View *scratch*.txt
| Notes | Start | End | Duration |
|--------------------------------------------------------+------------+------------+-----------|
| Emacs configuration | 4:02:25.37 | 4:27:09.30 | 00:24:44 |
| Hearing from Emacs Beginners | 4:27:27 | 5:01:00 | 00:33:33 |
| Lightning talk: Emacs Club | 5:03:19.30 | 5:19:37.83 | 00:16:18 |
| Starting an Emacs Meetup - Harry Schwartz | 5:31:52.03 | | -05:31:52 |
| Starting an Emacs Meetup - Harry Schwartz | 0:0:00 | 0:20:04 | 00:20:04 |
| Literate Devops - Howard Abrams | 1:28:20 | 2:08:15 | 00:39:55 |
| Lightning talk: Wanderlust and other mail clients | 2:15:04 | 2:26:55 | 00:11:51 |
| Making Emacs a Better Tool for Scholars - Erik Hetzner | 2:27:00 | 2:57:38 | 00:30:38 |
View flickr-upload.js
/**
* Upload the file to my Flickr sketchbook and then moves it to
* Dropbox/Inbox/To blog. Save the Org Mode links in the clipboard. -
* means the photo already existed, + means it was uploaded.
*/
var async = require('async');
var cp = require('child_process');
var fs = require('fs');
var glob = require('glob');
View tasks.org[*Org Src tasks.el
(ert-deftest sacha/org-capture-prefill-template ()
(should
;; It should fill things in one field at a time
(string=
(sacha/org-capture-prefill-template
"* TODO %^{Task}\nSCHEDULED: %^t\n:PROPERTIES:\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\n%?\n"
"Hello World")
"* TODO Hello World\nSCHEDULED: %^t\n:PROPERTIES:\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\n%?\n"
))
(should
View set-descriptions-from-url.js
/**
* Adds "Blogged" links to Flickr for images that don't yet have "Blogged" in their description.
* Command-line argument: URL to retrieve and parse
*/
var secret = require('./secret');
var flickrOptions = secret.flickrOptions;
var Flickr = require("flickrapi");
var fs = require('fs');
var request = require('request');
View Sketches to think about
* Inbox of sketches to classify or write about
- Learning
- [[https://www.flickr.com/photos/sachac/16180954156/][2015.01.04 Rhythm for learning -- index card]]
- [[https://www.flickr.com/photos/sachac/16052554957/][2015.01.08 Learning as an event -- index card]]
- [[https://www.flickr.com/photos/sachac/16052554877/][2015.01.09 Cross-pollination of ideas -- index card]]
- [[https://www.flickr.com/photos/sachac/16077216200/][2015.01.12 How I stopped looking for answers -- index card #reading]]
- [[https://www.flickr.com/photos/sachac/16077215930/][2015.01.12 What am I learning about -- index card #plans]]
- Emacs
- [[https://www.flickr.com/photos/sachac/16206810125/][2015.01.03 Why Emacs -- index card]]
View Sacha.org
(defun sacha/copy-code-as-org-block-and-gist (beg end)
  (interactive "r")
  (let ((filename (file-name-base))
        (mode (symbol-name major-mode))
        (contents
         (if (use-region-p) (buffer-substring beg end) (buffer-string)))
        (gist (if (use-region-p) (gist-region beg end) (gist-buffer))))
    (kill-new
     (format "\n[[%s][Gist: %s]]\n#+begin_src %s\n%s\n#+end_src\n"
You can’t perform that action at this time.