Skip to content

Instantly share code, notes, and snippets.

View nasamuffin's full-sized avatar
💭
probably hanging out with dog

Emily Shaffer nasamuffin

💭
probably hanging out with dog
View GitHub Profile
@nasamuffin
nasamuffin / vim-regexp-verymagic-cheatsheet.txt
Created April 26, 2019 01:02
Cheatsheet for vim regex with \v specified.
Special matching strings
====
^ Start of line
$ End of line
. Any character
~ Match last given substitute string
[...] Match range
[^...] Not range
< Beginning of a word
> End of a word
@nasamuffin
nasamuffin / .midam.pl
Created May 8, 2019 22:04
midam - "Message-Id git am"
#!/usr/bin/perl
# midam: Message-Id git am
# Author: Emily Shaffer (@nasamuffin)
#
# Applies patches based on a Message-Id.
# If the Message-Id provided is a cover letter ([PATCH 0/]), apply all
# messages with In-Reply-To: <ID> instead.
use autodie;
@nasamuffin
nasamuffin / .vimdef.sh
Last active January 7, 2020 22:13
vimdef: find function/macro definitions and open them in vim
#!/bin/bash
#
# Author: Emily Shaffer (2020)
# usage: vimdef <full-fn-name> [<git grep arg>...]"
# opens vim to the definiton of the provided function name using fuzzy regex magic
# Opens vim to a given file and line number.
# $1 = file
# $2 = line number
@nasamuffin
nasamuffin / .mutt-message-id-to-lore.pl
Created March 5, 2020 06:31
Message-Id -> Lore with mutt display_filter
!/usr/bin/perl
my @message;
my $isGit = 0;
while (<>) {
push @message, "$_";
$isGit |= m|git\@vger.kernel.org|;
}
if ($isGit) {
@nasamuffin
nasamuffin / .wat.sh
Last active April 22, 2021 22:09
`type` but leveled up - cat the contents of aliases which point to scripts
#!/bin/bash
#
# Usage: 'source /path/to/wat.sh <cmd>'
#
# Outputs 'type <cmd>' or, if it's an alias, cats the script it's aliased to.
# Needs to be sourced, not run, because it needs access to all current shell
# aliases/variables.
WAT_ALIAS_PAT=
WAT_ALIAS_PAT+="("