Skip to content

Instantly share code, notes, and snippets.

View erikw's full-sized avatar

Erik Westrup erikw

View GitHub Profile
erikw / ..git-commit-status - Generate git commit message from
Last active March 13, 2024 07:44
Generate git commit message from git-status. Will generate a commit message like "Added: Modified: Deleted: Renamed: test.txt-> test2.txt". Put this in your .gitconfig.

git commit-status alias

An alias that will generate a git commit message staged changes as shown in git-status. Put this alias (section below) in your .gitconfig.

The message generated will be in the format of:

$ git status --porcelain
erikw / znp
Last active March 2, 2024 17:43
znp: Wrap shell command in ZFS pre-post snapshots and log outputs.
#!/usr/bin/env bash
# Runs a command wrapped in ZFS pre-post snapshots. The whole data pool is recursively snapshotted.
# Analogous to my snp script for BTRFS:
# Usage: $ znp <commands>
# e.g.: $ znp pgk upgrade
# e.g.: $ znp portmaster -aG
# e.g.: $ znp freebsd-upgrade install
erikw / snp
Last active December 24, 2023 06:11
snp: Wrap shell command in BTRFS snapper pre-post snapshots and log outputs.
#!/usr/bin/env bash
# Runs a command wrapped in btrfs snapper pre-post snapshots.
# Usage: $ snp <commands>
# e.g.: $ snp pacman -Syyu
# Requirements: snapper (
# The latest version of this script is hosted at
date=$(date "+%Y-%m-%d-%H%M%S")
erikw /
Last active May 12, 2022 21:54
A log of how I configured FreeBSD spring 2018 on my Intel NUC Dawson Canyon NUC7i3DNH2
#!/usr/bin/env bash
# A log of how I configured FreeBSD spring 2018 on my Intel NUC Dawson Canyon NUC7i3DNH2E (NUC7i3DNH).
# Modeline {
# vi: foldmarker={,} foldmethod=marker foldlevel=0 tabstop=4
# }
# Links {
# FreeBSD vs Linux:
erikw /
Last active January 18, 2022 19:48
sed inline -s compatible with both Linux and BSD/macOS
# To be compatiable with both GNU sed and the old BSD sed that macOS uses, need to set and inplace backup extension and then remove the file.
# $(sed -i -e '...' file) works with GNU sed and modern BSD. However on macOS a backup file "file-e" will be created
# Reference:
sed -i.bak -e 'expr...' file && rm file.bak
# Maintainer: Erik Westrup
# Reference on git checkout:
pkgdesc="Scrot and imgur/s3 upload zenity gui"
erikw / ncmpcpp-vim-keybindings
Created December 7, 2021 19:56
NPCPP Vim keybindings
# How to configure NCMPCPP to get Vim-like keybindings
def_key "j"
def_key "k"
def_key "h"
erikw / .vim-startify-startify_custom_header
Last active November 29, 2021 18:34
vim-statify neovim/vim version in fortune
erikw /
Last active November 29, 2021 18:33 — forked from jamesmacfie/
iTerm 2 - script to change theme depending on Mac OS dark mode
#!/usr/bin/env python3
import asyncio
import iterm2
async def main(connection):
async with iterm2.VariableMonitor(connection, iterm2.VariableScopes.APP, "effectiveTheme", None) as mon:
while True:
# Block until theme changes
theme = await mon.async_get()