This guy’s tutorials look pretty excellent:
This file contains hidden or 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
#lang racket | |
;; f(x) = x + 1 | |
(define (f x) (+ x 1)) | |
;; g(x) = x*x + 1 | |
(define (g x) (+ (* x x) 1)) | |
(define (respond secret guess) | |
(if (= secret guess) |
This file contains hidden or 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
(defun aw/denote-normalize-org-frontmatter () | |
"Normalize the front-matter in an org-mode file." | |
(interactive) | |
(when-let* ((file (buffer-file-name)) | |
(denote-filename-is-note-p file) | |
(type (denote-filetype-heuristics file)) | |
(title (denote-retrieve-title-value file type)) | |
(id (denote-retrieve-filename-identifier file))) | |
(let ((kwds (denote-retrieve-keywords-value file type))) | |
(delete-matching-lines "^#\\+title:.*$" (point-min) (point-max)) |
This file contains hidden or 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
;;; nm-org-roam-to-denote.el --- Migrate notes from org-roam to denote | |
;; Copyright (C) 2022 bitspook <[email protected]> | |
;; Author: bitspook | |
;; Version: 0.1.0 | |
;; URL: https://github.com/bitspook/notes-migrator | |
;; Package-Requires: ((emacs "28.1") (denote "1.0.0") | |
;;; Commentary: |
This file contains hidden or 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
;; Resource: https://stackoverflow.com/questions/11206140/typewriter-sounds-for-emacs | |
(defvar tink "/System/Library/Sounds/Tink.aiff") | |
(defun play (file) | |
(let ((buf (get-buffer-create "playnoise"))) | |
(start-process-shell-command "play" buf (concat "afplay " file)))) | |
(defun do-tink () | |
(play tink)) |
This file contains hidden or 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
# -*- mode: snippet -*- | |
# name: pipe inspect | |
# key: pi | |
# -- | |
|> IO.inspect(label: "$1") | |
$0 |
This file contains hidden or 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
(defvar bootstrap-version) | |
(setq straight-repository-branch "develop") | |
(let ((bootstrap-file | |
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) | |
(bootstrap-version 5)) | |
(unless (file-exists-p bootstrap-file) | |
(with-current-buffer | |
(url-retrieve-synchronously | |
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" |
This file contains hidden or 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
#lang racket | |
;; Demonstration of a turing-complete language | |
(define (ev e [ρ '()]) | |
(match e | |
[(? symbol? x) (cadr (assoc x ρ))] | |
[`(λ (,xs ...) ,es) `(cls ,ρ ,xs ,es)] | |
[`(,f ,as ...) | |
(match (ev f ρ) | |
[`(cls ,cρ ,xs ,es) (ev es (append (map list xs (map (λ (v) (ev v ρ)) as)) cρ ρ))])])) |
This file contains hidden or 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
#lang racket | |
(define *remaining-choices* '()) | |
(define (choose choices) | |
(call/cc | |
(λ (k) | |
(for ([i (cdr choices)]) | |
(set! *remaining-choices* (cons (cons k i) *remaining-choices*))) | |
(k (car choices))))) |
This file contains hidden or 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
;; Pandoc conversion function | |
;; Requires f.el, as well as pandoc and pandoc-citeproc installed on the host system. | |
;; If on macOS, install with `brew install pandoc pandoc-citeproc' | |
(defcustom pandoc-converter-args "--filter pandoc-citeproc --pdf-engine=xelatex" "Additional arguments to pass to pandoc when running `convert-with-pandoc'") | |
(defun convert-with-pandoc () | |
"Convert a file between formats with Pandoc. | |
This will place the outputted function in the same directory as | |
the source folder. |
NewerOlder