See melpa/melpa#6191 (comment)
(defun key-quiz--shuffle-list (list)
"Shuffles LIST randomly, modying it in-place."
(dolist (i (reverse (number-sequence 1 (1- (length list)))))
(let ((j (random (1+ i)))
(tmp (elt list i)))
;; When editing an image with many layers (e.g. an animated GIF with | |
;; hundreds of frames), it's impossibly tedious to click hundreds and | |
;; hundreds of times on small little boxes to hide or show all layers. | |
;; Since GIMP seems to lack a button to hide/show all of them, and it | |
;; doesn't allow selection of multiple layers, this script provides | |
;; menu items to hide/show all layers at once. | |
;; Who knows if later versions of GIMP than I have provide a way to do | |
;; this, but this works, and maybe it will be helpful to someone. |
;;; Memoization benchmark -*- lexical-binding: t; -*- | |
;; Ref: https://github.com/skeeto/emacs-memoize | |
;; $ emacs -Q --batch -L path/to/memoize -f batch-byte-compile memoize-bench.el | |
;; $ emacs -Q --batch -L path/to/memoize -l memoize-bench.elc | |
;; Note: Benchmark requires at least 64-bit integers. Choose one of: | |
;; * Emacs >= 27 | |
;; * Emacs <= 26 on 64-bit host |
# Please see the script's new home: https://github.com/alphapapa/magit.sh |
See melpa/melpa#6191 (comment)
(defun key-quiz--shuffle-list (list)
"Shuffles LIST randomly, modying it in-place."
(dolist (i (reverse (number-sequence 1 (1- (length list)))))
(let ((j (random (1+ i)))
(tmp (elt list i)))
#!/usr/bin/env hy3 | |
(import [requests [get :as fetch]]) | |
(require [hy.extra.anaphoric [ap-each :as aeach | |
ap-map :as amap]] | |
[hy.contrib.walk [let]]) | |
(defmacro try* [&rest body] | |
`(try ~@body |
;; FIFO queue implementation using cyclic doubly linked lists | |
;; | |
;; This data structure is a bit overkill for a queue, | |
;; but it has many other uses | |
;; a doubly linked list cell look like (val . (prev-cell next-cell)) | |
;; | |
;; a FIFO queue object looks like ('fifo . cyclic-doubly-linked-list) | |
;; | |
;; An empty FIFO queue would be: ('fifo . nil) |
;; Moved to dedicated repo: https://github.com/alphapapa/snow.el |
(cl-defmacro bench-lexical-binding (&key (times 1) forms ensure-equal) | |
"FIXME docstring" | |
(declare (indent defun)) | |
`(let ((dynamic (bench-multi :times ,times :ensure-equal ,ensure-equal :raw t | |
:forms ,forms)) | |
(lexical (bench-multi-lexical :times ,times :ensure-equal ,ensure-equal :raw t | |
:forms ,forms)) | |
(header '("Form" "x faster than next" "Total runtime" "# of GCs" "Total GC runtime")) | |
combined-results) | |
(cl-loop for result in-ref dynamic |