Skip to content

Instantly share code, notes, and snippets.

/* Based on: http://stackoverflow.com/questions/8571089/how-can-i-find-endian-ness-of-my-pc-programmatically-using-c
*
* Build: gcc -o whatendianness whatendianness.c
*
*/
# include <stdio.h>
int main (int argc, char **argv) {
int num = 1;
@gauteh
gauteh / m_sup
Last active December 12, 2015 03:08
lbdb module for the sup contact list
#! /bin/bash
# A module for lbdb (http://www.spinnaker.de/lbdb/) for the sup address
# book (http://sup.rubyforge.org)
# Copyright (C) 2009 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
@gauteh
gauteh / utf7.py
Created April 17, 2013 09:06
UTF8 to IMAP4-UTF-7 for OfflineIMAP
# -*- coding: utf-8- -*-
# from: http://piao-tech.blogspot.no/2010/03/get-offlineimap-working-with-non-ascii.html#resources
import binascii
import codecs
# encoding
def modified_base64 (s):
@gauteh
gauteh / authordate4-url.bst
Last active December 17, 2015 20:39
BibTex style for natbib (author year) based on authordate4.bst with support for URL and date accessed.
% Based on: authordate4.bst, plainnat.bst and opcit.bst
%
%
% This BibTeX 0.99 style file is intended for documents that use the
% author-date citation system. It should be used in conjunction with the
% authordate1-4.sty (or equivalent) LaTeX style-option.
%
% In deciding on the bibliography layout to be implemented, the following
% works have been consulted:
% 1. British Standard 5605: "Citing publications by bibliographic
#! /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
@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
#
# 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
#! /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
#
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