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 / .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+="("
@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 / .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 / .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 / 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
0xA0:
sensorType: 0x02
path: /xyz/openbmc_project/sensors/voltage/vout1
sensorReadingType: 0x01
multiplierM: 51
offsetB: 0
bExp: 0
mutability: Mutability::Read | Mutability::Write
interfaces:
xyz.openbmc_project.Sensor.Value:
@nasamuffin
nasamuffin / grammar-police
Created May 26, 2016 23:21
Grammar-police's logic
import json
import urlparse
import urllib
import re
def lambda_handler(event, context):
text = urlparse.parse_qs(event['postBody'])['text'][0]
username = urlparse.parse_qs(event['postBody'])['user_name'][0]
if username == "slackbot":
print("I don't even listen to myself.")
@nasamuffin
nasamuffin / wewscript.py
Last active March 4, 2016 02:21
WEWLAD
import sys
import string
import unicodedata
def pad(width):
return uni(" ") * width
def uni(stringy):
ascii_to_wide = dict((i, unichr(i + 0xfee0)) for i in range(0x21, 0x7f))
ascii_to_wide.update({0x20: u'\u3000', 0x2D: u'\u2212'}) # space and minus
@nasamuffin
nasamuffin / Stockbroker-slackbot
Last active November 23, 2015 15:29
AWS lambda implementation of a slackbot stockbroker app
import json
import urlparse
import urllib
import re
print('Loading function')
def lambda_handler(event, context):
if not 'text' in urlparse.parse_qs(event['postBody']):
@nasamuffin
nasamuffin / utterances
Last active August 30, 2015 18:01
how to ask for weaknesses list
WeaknessesIntent what is {grass|Type} weak against
WeaknessesIntent what are the weaknesses for {grass|Type}
WeaknessesIntent what does {grass|Type} lose to
WeaknessesIntent what are {grass|Type}'s weaknesses
WeaknessesIntent what is super effective against {grass|Type}
WeaknessesIntent what deals the most damage to {grass|Type}
WeaknessesIntent what hurts {grass|Type} the most
WeaknessesIntent what types are {grass|Type} weak against
WeaknessesIntent what types are {grass|Type} weak to
WeaknessesIntent what should I use against {grass|Type}