Skip to content

Instantly share code, notes, and snippets.

alphapapa /
Last active Nov 10, 2021
An Emacs food/weight/workout tracker self-contained in a single Org file




alphapapa /
Created Sep 19, 2020
Emacs native-comp branch convenience c ode

Emacs native-comp Recipes

For lack of a better term.

Update Docker image

  1. Update Andrea’s image.
alphapapa / replace-words-randomly.el
Created Jul 24, 2017
Emacs: Replace all words in buffer with random words of the same length
View replace-words-randomly.el
;; This function replaces all words in a buffer with words of the same length,
;; chosen at random from /usr/share/dict/words. Words are replaced consistently,
;; so e.g. "A" is always replaced with "Z". The mapping changes when Emacs is
;; restarted or when the cache buffer is killed. If all unique words of a certain
;; length are exhausted, random strings are used.
(defun ap/replace-words-randomly (&optional buffer)
"Replace all words in BUFFER or current buffer with randomly selected words from the dictionary.
Every time a new word is found, it is mapped to a replacement
word, so every instance of word A will be replaced with word Z."
View display-buffer-in-side-window.el
(cl-defun ap/display-buffer-in-side-window (&optional (buffer (current-buffer)))
"Display BUFFER in dedicated side window."
(let ((display-buffer-mark-dedicated t))
(display-buffer-in-side-window buffer
'((side . right)
(no-delete-other-windows . t))))))
View elfeed-config.el
;;; elfeed configuration
(use-package elfeed
;;;; Keymaps
(:keymaps '(shr-map)
"a" 'pocket-reader-shr-add-link)
(:keymaps '(elfeed-show-mode-map elfeed-search-mode-map)
alphapapa / emacs-process-status-bug-ecm.el
Last active Aug 18, 2021
An ECM for a possible bug in Emacs's process-status code
View emacs-process-status-bug-ecm.el
;;; emacs-process-status-sentinel-ecm.el --- -*- lexical-binding: t; -*-
;; This file provides an ECM for a possible bug in Emacs's process
;; handling. The rub is whether a process sentinel may be called with
;; a STATUS string of "finished\n" while the process's
;; `process-status' is `open': If that is expected, then this may not
;; indicate a bug (but perhaps an issue that needs to be more
;; prominently documented). But if it's not supposed to happen, then
;; this may provide a means to reproduce the behavior and troubleshoot
;; the bug.
alphapapa / .dockerignore
Created Jul 9, 2021 — forked from jscheid/.dockerignore
Running makem in Docker
View .dockerignore
alphapapa / mangle
Last active Jun 21, 2021
Mangle man pages to show just the parts you need (suitable for aliasing to "man")
View mangle
less_command='| less $less_no_init -aiF -Ps"Manual page\: $man_page (?ltline %lt?L/%L.:byte %bB?s/%s..? (END):?pB %pB\%..)"'
# Get section
if [[ $1 =~ [0-9]+ ]]
alphapapa /
Last active Apr 4, 2021
Standalone Dired launcher
# Launch Dired in a plain Emacs configuration.
# Arguments are passed to Emacs, e.g. "-nw" works as expected.
emacs -q "$@" \
--eval "(dired default-directory)" \
--eval "(defun kill-window-or-emacs () (interactive) (if (one-window-p) (kill-emacs) (delete-window)))" \
--eval "(setq dired-dwim-target t delete-by-moving-to-trash t)" \
alphapapa /
Created Jan 5, 2021 — forked from thibaudcolas/
Video Downloader professional kmdldgcmokdpmacblnehppgkjphcbpnn background.js

Video Downloader professional kmdldgcmokdpmacblnehppgkjphcbpnn background.js

This is the source of background.js for a now-unpublished Chrome extension called "Video Download professional" (ID kmdldgcmokdpmacblnehppgkjphcbpnn, since then replaced with another "Video Download professiona" (ID bacakpdjpomjaelpkpkabmedhkoongbi). This script is republished here for educational purposes. It has initially been extracted from the extension’s archive available as v2.4 on

Why is this interesting?

The extension has appeared in malware discussions in the past. Its replacement of Video downloader professional "bacakpdjpomjaelpkpkabmedhkoongbi" seems related to the ownership change of The Great Suspender.

What does t