Skip to content

Instantly share code, notes, and snippets.

@reinout
reinout / addlabels.py
Created September 20, 2016 06:48
Script to add descriptions underneath eifelbahn.de DVD photos
# -*- coding: utf-8 -*-
import codecs
import os
# Directory with the hi-res images from the DVD
SOURCE_DIR = '../hg-eqb1-a'
# Directory where you want to place the files '.' is the current dir.
TARGET_DIR = '.'
# Export the .rtf with the image descriptions as plain text. The output should
import glob
import os
import zipfile
from ConfigParser import ConfigParser # TODO python 3
START = '''<?xml version="1.0"?>
<plugins>
'''
"""Script to report on geoserver layer usage.
I've run it on p-web-map-d9 like this::
cd /var/log/nginx
mkdir /tmp/logs
cp access.log* /tmp/logs/
cd /tmp/logs
gunzip *.gz
cat access.log* |grep -v ^127.0.0.1 > alles.txt
# Hopefully temporary fix for
# https://bitbucket.org/pypa/setuptools/issues/450/egg_info-command-is-very-slow-if-there-are
import os
TO_OMIT = ['var', '.git', 'parts', 'bower_components', 'node_modules', 'eggs',
'bin', 'develop-eggs']
orig_os_walk = os.walk
@reinout
reinout / keybase.md
Created September 18, 2014 08:33
Keybase verification

Keybase proof

I hereby claim:

  • I am reinout on github.
  • I am reinoutvanrees (https://keybase.io/reinoutvanrees) on keybase.
  • I have a public key whose fingerprint is F529 E418 37C0 7BBB 8699 E644 E62A 0F25 646A 99EE

To claim this, I am signing this object:

from collections import defaultdict
import plistlib
# I copied files locally.
# NEW is what gets written.
# CURRENT is the current "iTunes Library.xml" file (or rather, my copy).
# OLD is an old backup with lots of good ratings.
OLD = 'itunes.xml'
CURRENT = 'itunes_2012.xml'
NEW = 'updated.xml'
@reinout
reinout / fabfile.py
Created November 1, 2012 14:55
Fabfile I use for http://reinout.vanrees.org/weblog/2012/10/30/vagrant-osx-how.html, pretty unfiltered work in progress.
from fabric.context_managers import cd
from fabric.contrib.files import exists
from fabric.decorators import hosts
from fabric.decorators import task
from fabric.operations import run
from fabric.operations import sudo
PACKAGES = [
# 'python-mapnik',
'binutils',
@reinout
reinout / default.cfg
Created June 7, 2012 18:29
Buildout config file to get a cache running
# This file should go into ~/.buildout/default.cfg
# Also create the three directories in here.
[buildout]
eggs-directory = /Users/reinout/.buildout/eggs
download-cache = /Users/reinout/.buildout/downloads
extends-cache = /Users/reinout/.buildout/configs