Skip to content

Instantly share code, notes, and snippets.

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);
}
Moved to: https://github.com/gauteh/ibcao_py
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
#
@gauteh
gauteh / countcats.sh
Created May 24, 2009 14:03
Counts resulting categories for Exherbo repositories using the namingschemes; first two chars, last two chars and first and last char.
#! /bin/bash
# Copyright 2009 Gaute Hope <eg@gaute.vetsj.com>
# Distributed under the GNU General Public Licence v2
#
# Counts resulting categories for Exherbo repositories
# using the namingschemes; first two chars, last two chars
# and first and last char.
repos=$(paludis --list-repositories | tr -d '*\n')
@gauteh
gauteh / changeofplan.cpp
Created July 7, 2009 11:18
Detects change of ~/.plan
/*
* Copyright (c) 2009 Gaute Hope <eg@gaute.vetsj.com>
* Distributed under the terms of the GNU General Public Licence v2
*
* Waits for change of ~/.plan
*
*/
# include <iostream>
# include <sys/inotify.h>
# -*- coding: utf-8
# This syncs/gets the latest photos from your flickr photostream and saves them in
# a Django model (FlickrPhoto)
# Gaute Hope <eg@gaute.vetsj.com> (c) 2010
# Licenced under Creative Commons v3.0
# http://creativecommons.org/licenses/by/3.0/
# this goes in models.py:
from django.db import models
function [rtable, nr, nl, nj] = routhtable (T)
% Lagar og analyserer Routh-Hurwitz tabell.
% Author: Gaute Hope <eg@gaute.vetsj.com>
% Created: 2010-04-16
%
% Usage: [rtable, nr, nl, nj] = routhtable (T)
%
% T = Symbolsk transferfunksjon
%