Blog

3/5

02. 01. 2013

Das Rezept für Wilmas leckere Tomatensuppe:

Zutaten für 8 Liter

  • 10 große Dosen geschälte Tomaten (800g)
  • 5 Bund Frühlingszwiebeln
  • 10 Knoblauchzehen
  • 5 TL Oregano
  • 10 TL Edelsüßer Paprika
  • 10 Spritzer Tabasco
  • Worchestersauce
  • Olivenöl oder Butter
  • Crème fraîche
  • Gin
  • Salz, Pfeffer

Zubereitung

  1. Frühlingszwiebeln in Öl ca. 10 min andünsten. Danach mit Paprika bestreuen und gepressten Knoblauch zugeben. Tomaten erst pürieren und dann zu den Zwiebeln dazugeben.
  2. Oregano, Tabasco, Worchestersauce dazugeben und 10 min leicht kochen lassen. Mit Pfeffer, Salz und Tabasco abschmecken.
  3. Zusammen mit Crème fraîche und einem Spritzer Gin servieren.

02. 01. 2013

I always forget that one line …

convert foo.jpg -resample 150 eps3:foo.eps

The option resample gives the resolution in DPI.

09. 12. 2012

Very simple, but very handy: a script which sets the permissions of all files and directories inside a folder to the right values.

#!/usr/bin/env python
import os,sys

file_permissions = 0644
dir_permissions = 0755

def change_permissions(path):
    if not os.path.isdir(path):
        os.chmod(path,file_permissions)
    else:
        os.chmod(path,dir_permissions)
        for p in os.listdir(path):
            change_permissions(path + '/' + p)

try:
    directory = sys.argv[1]
except IndexError:
    sys.exit('A DIRECTORY must be provided.')

change_permissions(directory)

Update

Actually, this is much easier:

#!/bin/bash
find $1 -type d -exec chmod 755 {} \;
find $1 -type f -exec chmod 644 {} \;

09. 12. 2012

openmpi

./configure F77=gfortran F90=gfortran

fftw

./configure --enable-mpi F77=gfortran

gnuplot (from svn)

./prepare ; ./configure --with-readline=gnu -with-gd

08. 12. 2012

This script uses ghostsript to convert eps figures into png.

#! /usr/bin/env python

import os,sys,optparse

# parse the command line with optparse
usestr = '%prog [-g WIDTHxHEIGHT] INPUTFILE OUTPUTFILE'
parser = optparse.OptionParser(usage=usestr)
parser.add_option('-g','--geometry',action="store",dest='geometry',
                  help='specify geometry [default from bounding box]')
parser.add_option('--debug',action="store_true",help='verbose output')
arg = parser.parse_args()
opt = arg[0]

try:
    inputfile = str(arg[1][0])
    outputfile = str(arg[1][1])
except (IndexError,ValueError):
    parser.error('give INPUTFILE and OUTPUTFILE')

if opt.geometry:
    try:
        split = opt.geometry.strip().split('x')
        width = int(split[0])
        height = int(split[1])
    except (IndexError,AttributeError):
        parser.error('geometry must be in the format WIDTHxHEIGHT')
else:
    # open epsfile and look for bounding box
    f = open(inputfile,'r')
    for line in f:
        if line.startswith('%%BoundingBox'):
            split = line.split()
            try:
                width = int(split[3])-int(split[1])
                height = int(split[4])-int(split[2])
            except IndexError:
                raise RuntimeError('could not find bounding box in eps file')
            break
    f.close()

# invoking gs
call = 'gs -dNOPAUSE -sDEVICE=png16m -q -dBATCH -dEPSFitPage -sOutputFile=%s ' \
    '-g%ix%i %s' % (outputfile,width,height,inputfile)
if opt.debug: print call
    os.system(call)
3/5
1