Skip to content

Instantly share code, notes, and snippets.

View tvwerkhoven's full-sized avatar

Tim van Werkhoven tvwerkhoven

  • ASML
  • Netherlands
View GitHub Profile
@tvwerkhoven
tvwerkhoven / fx33video.sh
Created April 5, 2010 19:50
Convert Panasonic FX33 videos
#!/bin/bash
#
# Simple mencoder call to convert video from the Panasonic Lumix FX33 to xvid
# with mp3 in an avi container and x264 with mp3 in a mkv container. Run as:
#
# ./fx33video <input.mov>
#
# ffmpeg info about FX33 videos:
# Stream #0.0(eng): Video: mjpeg, yuvj420p, 640x480 [PAR 0:1 DAR 0:1], 30.00
# tb(r)
@tvwerkhoven
tvwerkhoven / randmac.sh
Created April 5, 2010 19:59
Generate a random MAC address
#!/bin/bash
#
# Generate a random MAC address with a known vendor prefix from the nmap mac
# prefixes file.
#
# Tim van Werkoven, 20100405 <t.i.m.vanwerkhoven@xs4all.nl>
# This file is licensed under the Creative Commons Attribution-Share Alike
# license versions 3.0 or higher, see
# http://creativecommons.org/licenses/by-sa/3.0/
@tvwerkhoven
tvwerkhoven / renamemp3.sh
Created April 5, 2010 20:02
Recursively rename all files in a directory
#!/bin/bash
#
# Recursively rename all files in a directory with the following rules:
# - Convert letters to lower case
# - Convert whitespace to underscore
# - Remove 'track' in the name
#
# Used to clean up filenaming of mp3s
#
# Tim van Werkoven, 20100405 <t.i.m.vanwerkhoven@xs4all.nl>
@tvwerkhoven
tvwerkhoven / renamemp3.py
Created April 5, 2010 20:04
Recursively rename all files in a directory
#!/usr/bin/env python
# encoding: utf-8
#
# Recursively rename all files in a directory with the following rules:
# - Convert letters to lower case
# - Convert whitespace to underscore
#
# Used to clean up filenaming of mp3s
#
# Tim van Werkoven, 20090426 <t.i.m.vanwerkhoven@xs4all.nl>
@tvwerkhoven
tvwerkhoven / worddistance.pl
Created April 5, 2010 20:07
Find the word distance for each word, and signal words that are close together
#!/usr/bin/perl -w
#
# Find the word distance for each word, and signal words that are close
# together. Can be useful for reviewing written text (papers, essays,
# whatever) to see if you might need a thesaurus somewhere.
#
# Tim van Werkoven, 20090426 <t.i.m.vanwerkhoven@xs4all.nl>
# This file is licensed under the Creative Commons Attribution-Share Alike
# license versions 3.0 or higher, see
# http://creativecommons.org/licenses/by-sa/3.0/
@tvwerkhoven
tvwerkhoven / xelatex-test.tex
Created October 29, 2010 10:57
Adaption of 'Beauty of LaTeX' by Dario Taraborelli (2008)
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% Dario Taraborelli (2008)
% The Beauty of LaTeX
% URL: http://nitens.org/taraborelli/latex
% Some rights reserved: CC-BY-SA
\documentclass[11pt,a4paper]{article}
\usepackage[dvipdfm, colorlinks, breaklinks, pdftitle={The Beauty of LaTeX},pdfauthor={Taraborelli, Dario}]{hyperref}
@tvwerkhoven
tvwerkhoven / newton.tex
Created October 29, 2010 10:59
Render of Newton's Principia in XeLaTeX
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% Tim van Werkhoven (2010)
% newton.tex: Render of Newton's Principia in XeLaTeX
% Some rights reserved: CC-BY-SA
\documentclass[11pt,a4paper]{article}
\usepackage[dvipdfm, colorlinks, breaklinks]{hyperref}
@tvwerkhoven
tvwerkhoven / add_test.c
Created June 23, 2011 11:56
Machine precision test
/* add_test.c -- test machine precision for float and double datatypes
Compile: gcc -lm add_test.c -o add_test
Adapted from: http://virtuallyshocking.com/2008/01/14/float-vs-double/
This code iteratively increments a Real variable with a small amount,
leading to round-off errors. When the round-off error is bigger than
a preset value 'diff', it prints the number of iterations and the round-off
error at that point. Additionally it prints the error at each 100 iterations.
@tvwerkhoven
tvwerkhoven / brew_install_git.log
Created July 21, 2011 12:31
brew install git on OS X 10.7
[tim@saturn] ~/tmp% brew install -v git
==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2
File already downloaded in /Users/tim/Library/Caches/Homebrew
/usr/bin/tar xf /Users/tim/Library/Caches/Homebrew/git-1.7.6.tar.bz2
==> make prefix=/usr/local/Cellar/git/1.7.6 install
make prefix=/usr/local/Cellar/git/1.7.6 install
GIT_VERSION = 1.7.6
* new build flags or prefix
./generate-cmdlist.sh > common-cmds.h+ && mv common-cmds.h+ common-cmds.h
rm -f git-am git-am+ && sed -e '1s|#!.*/sh|#!/bin/sh|' -e 's|@SHELL_PATH@|/bin/sh|' -e 's|@@DIFF@@|diff|' -e 's/@@GIT_VERSION@@/1.7.6/g' -e 's/@@NO_CURL@@//g' -e '/^# @@BROKEN_PATH_FIX@@$/d' git-am.sh >git-am+ && \
@tvwerkhoven
tvwerkhoven / brew_doctor.log
Created July 21, 2011 12:44
brew doctor on OS X 10.7
[tim@saturn] ~/tmp% brew doctor
"Git" was not found in your path.
Homebrew uses Git for several internal functions, and some formulae
use Git checkouts instead of stable tarballs.
You may want to install git:
brew install git