Skip to content

Instantly share code, notes, and snippets.

@alphapapa
alphapapa / elfeed-views.el
Last active Feb 11, 2020
Elfeed views (i.e. filter sets)
View elfeed-views.el
;; See https://github.com/alphapapa/unpackaged.el#filter-hydra
@alphapapa
alphapapa / intersection-benchmarks.org
Last active Jan 30, 2020
Benchmarking list intersections
View intersection-benchmarks.org

Note that the update to the macros which provide the :setup argument is not published yet…

(bench-multi-lexical ;; :ensure-equal t
  :times 100
  :setup (progn
           (setq lst1 (make-random-list 1000)
                 lst2 (make-random-list 1000))
           (defun make-random-list (n)
             (let ((l nil))
View overlay-testing.el
(defun ap/overlay-isearch-test ()
(interactive)
(with-current-buffer (get-buffer-create "*overlay-isearch-test*")
(pop-to-buffer (current-buffer))
(erase-buffer)
(dolist (ov (overlays-in (point-min) (point-max)))
(delete-region (overlay-start ov) (overlay-end ov))
(delete-overlay ov))
(insert "foo\n")
(ap/insert-overlaid "bar\n" :transcluded-content t)
@alphapapa
alphapapa / hide-show-layers.scm
Created Oct 8, 2019
GIMP: Hide/Show all layers in current image
View hide-show-layers.scm
;; 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.
@alphapapa
alphapapa / juliet-0ac22.el
Created Sep 2, 2019
Benchmarking Emacs stuff
View juliet-0ac22.el
;;; 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
@alphapapa
alphapapa / magit.sh
Last active Apr 5, 2020
Run a standalone Magit editor!
View magit.sh
# Please see the script's new home: https://github.com/alphapapa/magit.sh
@alphapapa
alphapapa / bench.org
Last active Aug 17, 2019
Emacs: Benchmarking sequence shuffling
View bench.org
View melpa-packages.hy
#!/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
@alphapapa
alphapapa / test-data.org
Created Jan 16, 2019
org-ql all-dates testing
View test-data.org

Plain inactive

[2019-02-01 Fri]

Deadline

Scheduled

Closed

Plain active

@alphapapa
alphapapa / dll-fifo.el
Created Jan 1, 2019 — forked from jordonbiondo/dll-fifo.el
A fifo queue in emacs lisp using a cyclic doubly linked list.
View dll-fifo.el
;; 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)