Skip to content

Instantly share code, notes, and snippets.

View stefanSchinkel's full-sized avatar

Stefan Schinkel stefanSchinkel

View GitHub Profile
@stefanSchinkel
stefanSchinkel / color.py
Created September 28, 2016 10:20
Enums in Python
# -*- coding: utf-8 -*-
from enum import Enum
import logging
logging.basicConfig(format='Enum: %(message)s', level=logging.DEBUG)
class ColorString(Enum):
""" Simple mapping"""
@stefanSchinkel
stefanSchinkel / prepare-commit-msg
Last active September 22, 2016 18:01
git commit hook for whathecommit.com
#!/bin/sh
# A git hook for including a commit message from
# the brilliant http://whatthecommit.com/ to your commit
#
# Usage:
# Put this script in $PROJECT/.git/hooks/prepare-commit-msg
# and set it to executable (u+x)
MSG=`curl -s http://whatthecommit.com/index.txt`
sed -i "1s/^/$MSG\n/" $1
@stefanSchinkel
stefanSchinkel / fixGitAuthor.sh
Created July 15, 2015 07:27
git fix author/email
# just as a mental note, so I don't have to google it (again)
#
git filter-branch --env-filter '
oldname="(old name)"
oldemail="(old email)"
newname="(new name)"
newemail="(new email)"
[ "$GIT_AUTHOR_EMAIL" = "$oldemail" ] && GIT_AUTHOR_EMAIL="$newemail"
[ "$GIT_COMMITTER_EMAIL" = "$oldemail" ] && GIT_COMMITTER_EMAIL="$newemail"
[ "$GIT_AUTHOR_NAME" = "$oldname" ] && GIT_AUTHOR_NAME="$newname"
@stefanSchinkel
stefanSchinkel / replaceWhitespaces.sh
Created September 19, 2014 18:35
Replace whitespaces in filenames by underscores
#!/usr/bin/env bash
if [ -z $1 ];then
echo "Usage: $0 DIR"
exit
fi
echo "Processing all files in $1"
cd $1
@stefanSchinkel
stefanSchinkel / findRequiredFunctions
Created July 9, 2014 09:24
A simple matlab function to solve the dependencies for a function. Might be useful when deploying a single function from a larger package.
function files = findRequiredFunctions(mainFun)
% FINDREQUIREDFUNCTIONS- solve file dependencies
%
% function files = findRequiredFunctions(mainFun)
%
% Find ALL files that are called by as function
% provided as MAINFUN, which are not part of the
% default Matlab installation.
%
@stefanSchinkel
stefanSchinkel / a2book.sh
Created April 30, 2013 18:50
Convert a/any (ps, pdf, dvi, and plain text) file to a booklet for printing on an A4 duplex printer to save paper. By default the output is sent to the systems standard printer.
#!/bin/bash
#
# DESCRIPTION
#
# Convert a(ny) file to a booklet for printing
# on an A4 duplex printer to save paper.
# By default the output is sent to the systems
# standard printer.
#
# Supports ps, pdf, dvi, and plain text.