Skip to content

Instantly share code, notes, and snippets.

View vermiculus's full-sized avatar
I may be slow to respond.

Sean Allred vermiculus

I may be slow to respond.
View GitHub Profile
vermiculus /
Last active September 25, 2022 12:45
Squash a Git repository to just include specific snapshots
# usage: ./ <new-branch-name>
# Expects a list of refs on standard input. One commit will be made
# per ref. The last line provided will be the tip of the new branch.
# This version is provided to illustrate the concept without any
# error-handling. It is unforgiving against any mistakes -- I strongly
# recommend you use the '' script instead!
;; a packagelet for figuring out where melpa is. will move point to commit in magit-log buffers.
(defun melpautil-where-is-melpa (package &optional force-refresh)
(interactive (list (intern (let-alist (magithub-repo) .name))
(let ((commit (melpautil-commit-for-package package force-refresh)))
(unless commit
(error "Commit not found"))
(setq commit (magit-rev-parse "--short" commit))
(when (derived-mode-p 'magit-log-mode)
(goto-char 0)
<!DOCTYPE html>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src data:; script-src 'self'; style-src 'unsafe-inline'">
<meta content="origin" name="referrer">
<title>Server Error &middot; GitHub</title>
<style type="text/css" media="screen">
body {
background-color: #f1f1f1;
;;; Neat convenience function for working with Elisp's EIEIO objects
(defmacro oref* (object &rest slots)
"Like `oref', but each slot in SLOTS is applied in sequence.
For example,
\(oref* obj :inner :property)
is equivalent to
;; Show a backtrace whenever an error is encountered
(defun user-error-to-backtrace (&rest r)
(get-buffer-create "*issue*")
#'display-buffer-pop-up-window nil
(insert (kill-new (with-output-to-string (backtrace))))))
(mapc (lambda (e) (advice-remove e #'user-error-to-backtrace))
'(user-error error))
(mapc (lambda (e) (advice-add e :before #'user-error-to-backtrace))
(defn get-topic-children [topics topic-id]
(map first (filter #(= topic-id (:parent (second %))) topics)))
(defn get-routes [topics topic-id & [slug-so-far]]
(let [children (get-topic-children topics topic-id)
newslug (if (= topic-id :root) ""
(str slug-so-far "/" (:slug (get topics topic-id))))]
(if children
(into (if (= topic-id :root) {} {topic-id newslug})
(map #(get-routes topics % newslug) children))
Use CIDER's nREPL handler
2 files changed, 5 insertions(+), 2 deletions(-)
project.clj | 3 ++-
src/clj/myapp/core.clj | 4 +++-
modified project.clj
@@ -55,7 +55,8 @@
[ring/ring-mock "0.3.0"]
[ring/ring-devel "1.4.0"]
# Run as sudo
if [ "$EUID" -ne 0 ] ; then
>&2 echo "Please run as sudo."
exit 1
if [ -z "$1" ] ; then
read -p "Package name: " PKG
test.o: test.c chunklist.c chunklist.h
gcc -o test.o test.c chunklist.c
\nonstopmode \input expl3-generic \relax \ExplSyntaxOn % -*- expl3 -*-
\file_input:n { obj }
\obj_new:nn { rectangle }
size: int = 2,
name: tl,