Skip to content

Instantly share code, notes, and snippets.

pesterhazy / headers-wat.js
Last active July 6, 2023 19:15
JS Headers iteration wat
View headers-wat.js
headers = new Headers([["a","A"],["b","B"]]);
headers.forEach((_,k) => headers.delete(k));
// expected: 0
// actual: 1 (Chrome 114)
// actual: 1 (Bun.js v0.6.13)
// actual: 1 (Safari 16.4)
// actual: 0 (Node v18.12.1)
pesterhazy /
Last active April 20, 2023 07:24
Ausflüge rund um Berlin
  • Liebnitzsee (Spazieren um den See, Strandbad, Fähre zur Insel mit Gasthof)
  • Bernsteinsee (See mit Karibikflair)
  • Chorin (Wandern, Seen, Kloster)
  • Buckow (Wandern)
  • Harz-Berlin-Express: Direktzug in 3h vom Alex nach Wernigerode
View core.clj
(ns bb-test-runner.core
"Wrap cognitect.test-runner but expands stackframes to show
file and line number of the babshka sources"
(:require [babashka.fs :as fs]
[clojure.stacktrace :as stacktrace]
[clojure.string :as str]
[clojure.test :as test]
[sci.core :as sci]))
pesterhazy /
Last active February 21, 2023 10:52
Messaging on Slack — some pitfalls

These days a lot of communication in organizations takes place on Slack. Because it's such an intuitive tool, it's easy to forget that, like any other communication medium, Slack has its own set of (often implicit) rules.

In fact, even with the best intentions, it's surprisingly easy to cause offense with an innocuous-seeming Slack message. So before you hit send, consider the following:

  • Take the size of the forum into account

    If you're sending a message to a channel with 50 participants, you're addressing a crowd. True, the very same channel may have been a place for unguarded, unfiltered communication years ago, when the organization was smaller. But as the channel grew, the environment changed - you're now in an large conference room, not a small, intimate team room.

    In other words, a message to #dev or #general is an announcement or public statement. So put as much care and attention into the message as you would with any kind of announcement to a large group of people.

pesterhazy /
Last active February 2, 2023 10:45
(wrong-type-argument stringp (require . package))
package--with-response-buffer-1: Wrong type argument: stringp, (require . package)
Debugger entered--Lisp error: (wrong-type-argument stringp (require . package))
  signal(wrong-type-argument (stringp (require . package)))
  package--with-response-buffer-1("" #f(compiled-function () #<bytecode 0xc88c9f08cc83354>) :file "0xc-20201025.2105.tar" :async nil :error-function #f(compiled-function () #<bytecode 0x1f4000153e91>) :noerror nil)
  package-install-from-archive(#s(package-desc :name 0xc :version (20201025 2105) :summary "Base conversion made easy" :reqs ((emacs (24 4)) (s (1 11 0))) :kind tar :archive "melpa" :dir nil :extras ((:commit . "5bd6c0c901d03d1f24a3ddcf3a62d3b6d2428c80") (:authors ("Adam Niederer" . "")) (:maintainer "Adam Niederer" . "") (:keywords "base" "conversion") (:url . "")) :signed nil))
  mapc(package-install-from-archive (#s(package-desc :name 0xc :version (20201025 2
pesterhazy /
Last active May 23, 2023 12:07
Mit kleinen Kindern in Berlin / Berlin with kids
pesterhazy / async-post-commit
Last active January 14, 2023 11:05
Run git post-commit hook asynchronously
View async-post-commit
#!/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 /
Created January 13, 2023 10:06
Open file in emacsclient with optional line number. Start emacs if it's not running yet
if [[ $# == 1 ]]; then
/Applications/ -n "$1" || result=$?
elif [[ $# == 2 ]]; then
/Applications/ -n +"$2" "$1" || result=$?
echo Unexpected args
exit 1
pesterhazy / emacs-backtrace.txt
Created November 30, 2022 13:43
(wrong-type-argument stringp (require . package))
View emacs-backtrace.txt
Debugger entered--Lisp error: (wrong-type-argument stringp (require . package))
string-match("\\(\\`\\|/\\)ffap\\(\\.so\\|\\.dylib\\|\\.elc\\|\\.el\\)?\\(\\.gz..." (require . package))
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)
pesterhazy / yikes
Last active November 29, 2022 19:25
Yikes! A safer git push
View yikes
#!/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