Skip to content

Instantly share code, notes, and snippets.

@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
#

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 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>
Moved to: https://github.com/gauteh/ibcao_py
Moved to: https://github.com/gauteh/ibcao_py
using System;
using System.Collections.Generic;
class Digits {
static int get_digits (decimal d) {
if (d < 1) {
return 0;
} else {
return 1 + get_digits (d / 10);
}
#! /bin/bash
#
# do a quick check if there are new messages in a gmail account
#
# based on: http://cpbl.wordpress.com/2011/11/16/how-to-alpine-maildir-offlineimap/
#
# Gaute Hope / 2013-12-13 / eg@gaute.vetsj.com
#
# requires: curl
#
# /bin/bash
#
# Makes a sparsebundle and set it up
hostname=$(hostname)
# create sparsebundle
hdiutil create -size 300g -library SPUD -fs HFS+J -type SPARSEBUNDLE -volname "Backup-${hostname}" "${hostname}.sparsebundle"
# enable unsupported volumes
@gauteh
gauteh / .gitconfig
Created August 23, 2013 10:49
Command/alias for setting up branches for pull requests for a github repository: In a github cloned repository do ```$ git pullify```. Now pull requests can be accessed through origin/pr/#
[alias]
pullify = config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'
#! /bin/bash
# A module for lbdb (http://www.spinnaker.de/lbdb/) for gmail
# using goobook.
# Copyright (C) 2013 Gaute Hope <eg@gaute.vetsj.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or