Skip to content

Instantly share code, notes, and snippets.

Henning Hraban Ramm fiee

Block or report user

Report or block fiee

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fiee
fiee / class_from_name.py
Created Apr 12, 2016
get a Python class from a class name
View class_from_name.py
import importlib
def class_from_name(name):
"""
Take a class name like `django.db.models.Model` and return the class
"""
parts = name.split('.')
mod = importlib.import_module('.'.join(parts[:-1]))
return getattr(mod, parts[-1])
@fiee
fiee / global_liedvorlage.ly
Last active Apr 3, 2016
lead sheet template
View global_liedvorlage.ly
%\version "2.18.0"
\include "../global.ly"
\include "articulate.ly" % for better MIDI
\header{
title = ""
poet = ""
%composer = "M: "
%arranger = "arr."
%instrument = "2 voc + git"
@fiee
fiee / global.ly
Created Jul 17, 2015
global settings for my LilyPond templates
View global.ly
\version "2.18.0"
%#(ly:set-option (quote no-point-and-click))
#(ly:set-option 'midi-extension "mid") % default is "midi"
\header{
title = ""
poet = ""
composer = ""
instrument = ""
source = ""
@fiee
fiee / .bashrc
Created Nov 7, 2013
Colored bash prompt with git information (tested on OSX 10.9)
View .bashrc
# for ANSI color codes see e.g. http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux
parse_exit_code() {
# check exit code and display a green checkmark on "0" or a red cross with exit code on error
if [ "$?" == "0" ]; then
echo -e "\033[32m✓\033[00m"
else
echo -e "\033[1;31m❌ $?\033[00m"
fi
}
@fiee
fiee / imagecrop.sh
Created Apr 5, 2012
use imagemagick to crop a picture to a fixed size
View imagecrop.sh
#!/bin/bash
# ~/croptest is our work dir, ~/croptest/img contains test images
cd ~/croptest
EXT="_resized"
SIZES="88x88 88x50 300x172 300x233 300x111"
# delete all remains of previous runs and copy test pics over
rm *.jpg
cp img/*.jpg ./
@fiee
fiee / update.sh
Last active Apr 3, 2016
Update script for MacPorts, ConTeXt, Python, LilyPond, Google Fonts and Perl
View update.sh
#!/bin/bash
NO_PORT=0
NO_TEX=0
NO_PYTHON=0
NO_FONTS=0
DO_PERL=0
for PARAM in $*
do
@fiee
fiee / cwpuzzle_beispiel.tex
Created Oct 12, 2011
LaTeX cwpuzzle Beispiel
View cwpuzzle_beispiel.tex
% see the docs for Gerd Neugebauer’s cwpuzzle.sty at http://ctan.org/tex-archive/macros/latex/contrib/gene/crossword
\documentclass[a4paper]{article}
\usepackage{cwpuzzle}
\usepackage[utf8]{inputenc}
\usepackage{german}
\begin{document}
\PuzzleUnsolved
@fiee
fiee / ocerrors.py
Created Sep 30, 2011
run GOCR and clean up afterwards
View ocerrors.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Replace common (G)OCR errors (in German)
Usage: python ocerrors.py inputfile [outputfile]
"""
import locale
import os, sys
@fiee
fiee / admin.py
Created Sep 30, 2011
Generic base classes for my django models, superseded by fiee/fiee-dorsale
View admin.py
# -*- coding: utf-8 -*-
import datetime
from django.contrib import admin
from django.contrib.sites.models import Site
class BaseAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
if not change:
obj.createdby = request.user
obj.createdon = datetime.datetime.now()
@fiee
fiee / choir_template.ly
Created Sep 30, 2011
Lead sheet setup for GNU LilyPond 2.14+
View choir_template.ly
\version "2.14.0"
\include "global.ly"
\include "articulate.ly" % for better MIDI
\header{
title = ""
poet = ""
%composer = ""
%arranger = "arr."
%instrument = "2 voc + git"
You can’t perform that action at this time.