Skip to content

Instantly share code, notes, and snippets.

alphapapa

Block or report user

Report or block alphapapa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 Sep 30, 2019
Run a standalone Magit editor!
View magit.sh
#!/bin/bash
# Run a standalone Magit editor! To improve startup speed, this
# script ignores the user's Emacs init files and only loads the Emacs
# libraries Magit requires.
# Note that this does NOT install any packages. Magit and its
# dependencies must already be installed in ~/.emacs.d.
dependencies=(magit async dash with-editor git-commit transient)
@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)
View let-it-snow.el
;; -*- lexical-binding: t; -*-
(require 'cl-lib)
(require 'color)
(require 'ov)
(require 's)
(defvar snowflakes-flakes nil)
(defvar snowflakes-amount 2)
View bench-lexical-binding.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
View bench-buffer-local-value.org

--filter

(bench-multi :times 1000 :ensure-equal t
  :forms (("buffer-local-value" (--filter (equal 'magit-status-mode (buffer-local-value 'major-mode it))
                                          (buffer-list)))
          ("with-current-buffer" (--filter (equal 'magit-status-mode (with-current-buffer it
                                                                       major-mode))
                                           (buffer-list)))))
You can’t perform that action at this time.