Instantly share code, notes, and snippets.

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)
(replace-regexp-in-string
"^\\([ \t]*\\)\\(.*\n\\)\\1"
"\\2"
(replace-regexp-in-string
"\ngawk: [^ ]*:"
"\n"
View xsv.bash
#!/bin/bash
_xsv()
{
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
cmds=$(xsv --list|awk '/Installed/{next}/./{print $1}')
while read -r cmd; do
if [[ "${prev}" = "${cmd}" ]]; then
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)."
(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)
View intervec.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# A SpaCy implementation of
# https://github.com/Babylonpartners/fastText_multilingual
#
# heavily based on
# https://github.com/Babylonpartners/fastText_multilingual/blob/master/align_your_own.ipynb
import numpy as np
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 <alex@gnu.org>
;; Maintainer: emacs-devel@gnu.org
;; Keywords: irc
;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcAutoJoin
;; This file is part of GNU Emacs.
View grep-locales.sh
$ echo aðc | LANG=C.UTF-8 grep -o '[[:lower:]]'
a
ð
c
$ 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:]]'
a
ð
View .flowconfig
[ignore]
[include]
[libs]
[options]
View kbu-ediff.el
;;; See http://www.emacswiki.org/emacs/EdiffMode#toc2
(setq ediff-window-setup-function ; I hate having multiple frames
'ediff-setup-windows-plain)
(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)))
View .gitattributes
l20n.js -text
View signal
#!/bin/bash
run () {
signal-desktop &
disown
}
show () {
local -r id="$1"
idx="$(printf "0x%08x" "${id}")"