Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
pesterhazy / mit-kindern-in-berlin.md
Last active June 5, 2025 09:28
Mit kleinen Kindern in Berlin / Berlin with kids
@pesterhazy
pesterhazy / async-post-commit
Last active January 14, 2023 11:05
Run git post-commit hook asynchronously
#!/usr/bin/env bb
;; This script is written in babashka
;; brew install babashka
;; brew install terminal-notifier
(require '[babashka.process :refer [shell process]])
;; assuming that the linter is called my-linter
@pesterhazy
pesterhazy / open-in-emacs.sh
Created January 13, 2023 10:06
Open file in emacsclient with optional line number. Start emacs if it's not running yet
#!/bin/bash
result=0
if [[ $# == 1 ]]; then
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n "$1" || result=$?
elif [[ $# == 2 ]]; then
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n +"$2" "$1" || result=$?
else
echo Unexpected args
exit 1
@pesterhazy
pesterhazy / emacs-backtrace.txt
Created November 30, 2022 13:43
(wrong-type-argument stringp (require . package))
Debugger entered--Lisp error: (wrong-type-argument stringp (require . package))
string-match("\\(\\`\\|/\\)ffap\\(\\.so\\|\\.dylib\\|\\.elc\\|\\.el\\)?\\(\\.gz..." (require . package))
load-history-filename-element("\\(\\`\\|/\\)ffap\\(\\.so\\|\\.dylib\\|\\.elc\\|\\.el\\)?\\(\\.gz...")
eval-after-load("ffap" #f(compiled-function () #<bytecode -0x1d7b6acf0da24a99>))
byte-code("\300\301\302\"\210\303\304\305\306\307DD\310\311\312\313\314&\7\210\303\315\305\306\316DD\317\311\312\313\314&\7\207" [eval-after-load "ffap" #f(compiled-function () #<bytecode -0x1d7b6acf0da24a99>) custom-declare-variable python-check-command funcall function #f(compiled-function () #<bytecode 0x142936da65c0a642>) "Command used to check a Python file." :type string :group python python-check-buffer-name #f(compiled-function () #<bytecode 0x1c554684a9cc8f92>) "Buffer name used for check commands."] 8)
autoload-do-load((autoload "python" "Major mode for editing Python files.\n\n\\{python-mod..." t nil) python-mode)
command-exe
@pesterhazy
pesterhazy / yikes
Last active November 29, 2022 19:25
Yikes! A safer git push
#!/usr/bin/env bash
#
# When using "git push", I frequently find myself overlooking git's
# dreaded 'Updates were rejected because the remote contains work that
# you do not have locally' error message.
#
# After I push, I don't typically wait around for the command to
# complete. So while I _think_ that my changes have been pushed to
# remote branch, in fact the push wasn't successful. Because the
# branch has changed in the meantime, I need to `git pull --merge` to
@pesterhazy
pesterhazy / chromium-mac-arm.md
Last active May 31, 2023 08:12
Download Chromium on Mac

Google doesn't make it easy for users to download a stable build of Chromium. If you just download the latest version, fine, but you might be getting an unstable version in between releases. I want a stable Chromium!

After years of trying, this is the process I've settled on - on macOS ARM:

@pesterhazy
pesterhazy / wrong-dictionary.md
Last active December 21, 2022 09:20
You're using the wrong dictionary!

John McPhee famously considered a dictionary his secret weapon. What's your secret weapon?

If like me you're not a native speaker of English, you've probably used bilingual dictionaries to learn about English words. But at a certain level of proficiency, you almost certainly want to use a monolingual dictionary instead. You want to look up words the way a native speaker would.

Here are some of my favorites:

@pesterhazy
pesterhazy / unit-testing-tdd.md
Last active January 30, 2024 08:40
Automated Tests and Test Driven Development: A Reading List

This is the best material I know out there on Automated Testing with Microtests (aka Unit Tests aka TDD style tests).

Monographs

Test Driven Development By Example (Kent Beck)

Unit Testing: Principles, Practices, and Patterns (Vladimir Khorikov)

The Art of Unit Testing 2nd ed (Roy Osherove)

@pesterhazy
pesterhazy / eglot-monorepos.md
Last active May 13, 2024 12:14
Emacs, Monorepos, Eglot, Clojure-lsp and Project.el

This gist is for anyone who's trying to use emacs + eglot + monorepo (with Clojure or any other language).

When you open a file in a buffer, eglot needs to determine the scope or folder to run the language server in. By default, the folder eglot will pick as the assumed project root is the repo root (the ancestory directory containing .git).

But in a monorepo, that's rarely what you want. In a large repo, analyzing all the *.clj files with clojure-lsp could take a minute or longer. As a limiting case, imagine Google with its gargantuan monorepo. Analyzing all the source files would take an indefinite period of time.

@pesterhazy
pesterhazy / building-sync-systems.md
Last active August 31, 2025 17:20
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles