Skip to content

Instantly share code, notes, and snippets.

kevin :: Coffee → Code

Kevin Brubeck Unhammer unhammer

View GitHub Profile
unhammer / apertium-desdupe.hs
Created Mar 12, 2019
put every line in a superblank before the (escaped) line itself
View apertium-desdupe.hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Applicative
import Data.Attoparsec.ByteString
import qualified Data.ByteString as S
import Data.Char (ord)
import GHC.Word (Word8)
import Prelude hiding (takeWhile)
unhammer / with-focus
Created Feb 28, 2019
Run a program with focus_new set to on, then turn focus_new off again
View with-focus
# Usage:
# chmod +x with-focus
# ./with-focus CMD ARG1 ARG2
# e.g.
# ./with-focus xfce4-terminal
# ./with-focus mousepad file.txt
# When this script exits, turn focus_new back to false
unhammer / flycheck-gawk.el
Last active Oct 6, 2018
emacs flycheck linting for gawk, using built-in gawk --lint
View flycheck-gawk.el
(defun my-flycheck-gawk-fix-message (err)
"Remove the repeated file-name/line from the error message of ERR."
(setf (flycheck-error-message err)
"^\\([ \t]*\\)\\(.*\n\\)\\1"
"\ngawk: [^ ]*:"
unhammer / xsv.bash
Created Oct 4, 2018
~/.bash_completion.d/xsv.bash bash completion for xsv
View xsv.bash
cmds=$(xsv --list|awk '/Installed/{next}/./{print $1}')
while read -r cmd; do
if [[ "${prev}" = "${cmd}" ]]; then
unhammer / my-bbdb-notmuch.el
Created May 27, 2018
search notmuch mail from bbdb
View my-bbdb-notmuch.el
(require 'bbdb)
(defun my-bbdb-notmuch-search (&optional record)
"Search for emails to/from RECORD (or current record if interactive)."
(let* ((record (or record (bbdb-current-record)))
(mails (bbdb-record-field record 'mail))
(query (combine-and-quote-strings mails " OR ")))
(notmuch-search query)))
(define-key bbdb-mode-map (kbd "F") 'my-bbdb-notmuch-search)
unhammer /
Last active Mar 22, 2018
Multilingual word vectors for SpaCy (based on )
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# A SpaCy implementation of
# heavily based on
import numpy as np
unhammer / erc-join.el
Last active Feb 21, 2018
patched to have networks as symbols in erc-autojoin-channels-alist
View erc-join.el
;;; erc-join.el --- autojoin channels on connect and reconnects
;; Copyright (C) 2002-2004, 2006-2016 Free Software Foundation, Inc.
;; Author: Alex Schroeder <>
;; Maintainer:
;; Keywords: irc
;; URL:
;; This file is part of GNU Emacs.
unhammer /
Last active Feb 1, 2018
grep '[A-Z]' vs locale
$ echo aðc | LANG=C.UTF-8 grep -o '[[:lower:]]'
$ echo aðc | LANG=C.UTF-8 grep -o '[[:upper:]]'
$ echo aðc | LANG=C.UTF-8 grep -o '[A-Z]'
$ # so far so good
$ echo aðc | LANG=nn_NO.UTF-8 grep -o '[[:lower:]]'
View .flowconfig
View kbu-ediff.el
;;; See
(setq ediff-window-setup-function ; I hate having multiple frames
(setq ediff-split-window-function (lambda (&optional arg)
(if (> (frame-width) 156)
(split-window-horizontally arg)
(split-window-vertically arg))))
(defun ediff--regions-samebuffer (ediff-regions &optional startup-hooks)
(let ((cloned-buffer (clone-indirect-buffer-other-window nil t)))
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.