Skip to content

Instantly share code, notes, and snippets.

View diffrev.vim
" ----------------------------------------------------------------------------
" DiffRev
" ----------------------------------------------------------------------------
let s:git_status_dictionary = {
\ "A": "Added",
\ "B": "Broken",
\ "C": "Copied",
\ "D": "Deleted",
\ "M": "Modified",
\ "R": "Renamed",
@gauteh
gauteh / github-thread.py
Last active Oct 17, 2017
Open GitHub issue from Notmuch thread or Message ID
View github-thread.py
#! /usr/bin/env python
#
# Author: Gaute Hope <eg@gaute.vetsj.com> / 2017-10-08
import os, sys, os.path
import subprocess
import notmuch
import email
import email.parser
import email.policy
@gauteh
gauteh / onchange.sh
Created Jun 7, 2017 — forked from senko/onchange.sh
Watch current directory and execute a command if anything in it changes
View onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
View find_match_prime.py
#! /usr/bin/python
#
# Author: Gaute Hope <eg@gaute.vetsj.com> / 2016-08-12
#
# Find all substrings in a string with the number of occurences of a set of
# characters pre-defined.
#
# A prime number is assigned to each character in the key set, all other
# characters are assigned 1. The product of the key set will match the product
# of the substring. Search the string with a running product to find substring
@gauteh
gauteh / startify-favex.vim
Last active Aug 8, 2016
show favex entries in startify
View startify-favex.vim
" Bookmarks and FavEx: combining startify and FavEx
let g:startify_bookmarks = []
" \ '~/.vim/vimrc',
" \ ]
for line in readfile (expand('~/.vim/bundle/FavEx/favlist'))
if line !~ '\"' && line != ""
call add (g:startify_bookmarks, line)
endif
endfor
View sincconv.py
#! /usr/bin/python
#
# Gaute Hope (gaute.hope@nersc.no) / 2015
#
# Uses a sinc-kernel to interpolate a discretely sampled signal by convolution.
#
import numpy as np
def conv_upsample (x, k, wn = None):
View sincinterpol.py
#! /usr/bin/python
#
# Author: Gaute Hope (gaute.hope@nersc.no) / 2015
#
# based on example from matlab sinc function and
# interpolate.m by H. Hobæk (1994).
#
# this implementation is similar to the matlab sinc-example, but
# calculates the values sequentially and not as a single matrix
# matrix operation for all the values.
@gauteh
gauteh / 01-run-paths.py
Last active Aug 29, 2015
add %mrun and %addpath magics that searches pythonpath and allows adding custom paths to an %run like command (%mrun)
View 01-run-paths.py
# based on ipython issue #101
#
# author: Gaute Hope <gaute.hope@nersc.no> / 2015
#
# references:
#
# https://github.com/ipython/ipython/issues/101
# http://ipython.org/ipython-doc/dev/config/custommagics.html
#
View keybase.md

Keybase proof

I hereby claim:

  • I am gauteh on github.
  • I am gauteh (https://keybase.io/gauteh) on keybase.
  • I have a public key whose fingerprint is C138 2FA5 1FB3 93D0 AD28 4BAF 9827 A7E8 A074 9023

To claim this, I am signing this object:

@gauteh
gauteh / no-1802.c
Created Oct 22, 2014
no more 1802 error for thinkpad x31 (cross compiled)
View no-1802.c
// from: http://www.thinkwiki.org/wiki/Problem_with_unauthorized_MiniPCI_network_card
// cross compile using (install gcc-multilib):
// $ linux32
// $ gcc -m32 -static -o no-1802 no-1802.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>