Skip to content

Instantly share code, notes, and snippets.

Moved to: https://github.com/gauteh/ibcao_py
@gauteh
gauteh / no-1802.c
Created October 22, 2014 08:14
no more 1802 error for thinkpad x31 (cross compiled)
// 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>

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 / 01-run-paths.py
Last active August 29, 2015 14:13
add %mrun and %addpath magics that searches pythonpath and allows adding custom paths to an %run like command (%mrun)
# 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
#
#! /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.
#! /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):
@gauteh
gauteh / startify-favex.vim
Last active August 8, 2016 08:30
show favex entries in startify
" 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
#! /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 / onchange.sh
Created June 7, 2017 08:34 — forked from senko/onchange.sh
Watch current directory and execute a command if anything in it changes
#!/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
@gauteh
gauteh / github-thread.py
Last active October 17, 2017 10:53
Open GitHub issue from Notmuch thread or Message ID
#! /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