Skip to content

Instantly share code, notes, and snippets.

@whot
whot / .vimrc
Last active September 3, 2019 21:34
" function to insert a printf statement at the current line when typing "mm" in normal (not insert) mode
" useful for sprinkling debugging statements across files quickly
function! InsertMarker()
let string = "printf(\"::::::::: %s:%d:%s() - \\n\", __FILE__, __LINE__, __func__);"
call append(line('.'), string)
endfunction
command Marker call InsertMarker()
map mm :Marker<enter>
@whot
whot / libwacom-test.sh
Created July 2, 2019 04:54
libwacom ABI symbol testing script
src_old=$HOME/libwacom-0.33
src_new=$HOME/libwacom-0.34
dst_old=$HOME/libwacom-inst-0.33
dst_new=$HOME/libwacom-inst-0.34
build() {
src=$1
dst=$2
@whot
whot / libwacom stylus groups.csv
Created June 24, 2019 22:53
libwacom stylus groups
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2. in line 1.
CSV file with all stylus ids and the tablet files they're associated with.
Generated with a throwaway python script, but manually sorted after that to show the grouping better.
Import into a spreadsheet, zoom out a bit and the groups are nicely visible.
@whot
whot / run-test.sh
Created April 6, 2018 02:31
run-test.sh
#!/bin/bash
#
# Script that runs sudo make check and on success adds a git note, if
# possible.
#
# If $CWD isn't a git directory or there are local changes, no note is
# added.
# If tellme/espeak is available, it is used to notify the user about
# required passwords
#
#!/usr/bin/gnuplot
# soften_delta function from libinput/src/filter.c.
#
# static double
# soften_delta(double last_delta, double delta)
# {
# if (delta < -1.0 || delta > 1.0) {
# if (delta > last_delta)
# return delta - 0.5;
# else if (delta < last_delta)
@whot
whot / gist:11234893
Created April 23, 2014 22:36
script to print error numbers
#!/usr/bin/env python
import os
import sys
if len(sys.argv) > 1:
sig = int(sys.argv[1])
print "%d: %s" % (sig, os.strerror(sig))
else:
for err, strerrno in os.errno.errorcode.items():
@whot
whot / replydiff.vim
Created April 10, 2014 05:36
vim syntax file for replying to patches/diffs
" Vim syntas file for diffs in an email reply:
" Unmodified diff.vim, all the matches simply have a "> " prepended.
"
" Vim syntax file
" Language: Diff (context or unified)
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2005 Jun 20
" Quit when a (custom) syntax file was already loaded
@whot
whot / _xinput
Created December 2, 2013 01:27
zsh completion for xinput
#compdef xinput
# ZSH completion for `xinput`
# Copyright © 2013 Red Hat, Inc.
# Author: Peter Hutterer
# License: http://opensource.org/licenses/MIT
_xinput()
{