Skip to content

Instantly share code, notes, and snippets.

@federkamm
federkamm / god-mode-single-shot.el
Last active May 10, 2020 20:36
Single shot god-mode for Emacs: Activate god-mode for just one command
(use-package god-mode
:ensure t
:config
(defun god-mode-deactivate-and-remove-hook ()
(god-local-mode -1)
(remove-hook 'post-command-hook #'god-mode-deactivate-and-remove-hook))
(defun god-mode-single-shot ()
(interactive)
@federkamm
federkamm / unlock.sh
Created May 18, 2020 22:13
Unlock password-store
# create a password for 'unlock' with password 'password-store unlocked':
pass insert unlock
# Enter password for unlock: password-store unlocked
# unlock password-store GPG keychain:
pass unlock
# pinentry asks for GPG password
# pass acknowledges nicely with:
# password-store unlocked
@federkamm
federkamm / debian-build-emacs-lucid-with-modules.sh
Created September 26, 2020 19:25
Compile emacs-lucid --with-modules on WSL Debian (buster)
# install Debian emacs-lucid (will be replaced later)
sudo apt install emacs-lucid
# install all build dependencies
sudo apt-get build-dep emacs-lucid
sudo apt install build-essential devscripts ed
# make a temporary directory and dowload debian source (+ patches)
mkdir TEMPDIR
cd TEMPDIR
@federkamm
federkamm / setup-inverse-search.sh
Created January 18, 2021 16:36
SumatraPDF and WSL Emacs: inverse search
# NOTE: Don't know if this persists after reboot:
sudo ln -s /mnt/c /C:
# SumatraPDF -> Settings -> Options -> Set inverse search command-line:
# C:\Windows\System32\wsl.exe emacsclient -n +%l "/$(echo '%f' | tr \\\\ /)"
@federkamm
federkamm / c-utf8-locale.scm
Created May 15, 2022 03:04
makes the C.UTF-8 locale from Debian system available within GUIX
;; guix package -f c-utf8-locale.scm
(define-module (c-utf8-locale)
#:use-module (gnu packages base)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module (guix build-system copy))
(define-public c-utf8-locale
@federkamm
federkamm / nvidiarun.sh
Created August 4, 2023 14:11
optirun/primusrun for WSL2
#!/bin/sh
export MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA # see: https://github.com/microsoft/wslg/wiki/GPU-selection-in-WSLg
exec "$@"
@federkamm
federkamm / geotag.sh
Created May 17, 2024 01:03
GNU parallel header line with comment character
#!/usr/bin/env bash
# metadata file in the format
cat >meta.tmp <<EOF
# filename lat lon alt
file.jpg 1.0 2.0 3.0
EOF
# where the title line starts with a comment character (#) and there are some additional
# fields actually even before the relevant ones (lat lon alt) in the file