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 / spotify-kodi
Last active November 9, 2018 21:44
spotify kodi startup script
#!/bin/bash
# spotify-kodi startup script
#
# Start spotify, wait for display, start kodi, bring kodi window into focus (again)
#
# # USAGE
# 1. Install somewhere (e.g. /snap/bin/)
# 2. Run as startup item on Linux
#
# # ABOUT
@tvwerkhoven
tvwerkhoven / whatsapp.pm
Last active November 8, 2017 01:50
Whatsapp chat log parser for pisg
# Whatsapp log parser for pisg, made by Tim van Werkhoven
# Features: parses logs, detects subject changes
# Known issues: only works without images, does not filter out 'image omitted' texts
# Use Charset = "utf-8" in config file to enable emoji
package Pisg::Parser::Format::whatsapp;
use strict;
$^W = 1;
sub new
@tvwerkhoven
tvwerkhoven / milieudata_januari.json
Last active December 10, 2015 13:48
Produce energy label for Albert Heijn recipes
{"Framboos": [["C", "Spanje"], ["E", "Mexico"]], "Nectarine": [["B", "Chili"]], "Limoen": [["A", "Brazili\u00eb"]], "Avocado": [["B", "Isra\u00ebl"], ["C", "Chili"], ["C", "Spanje"]], "Wortelen (breekpeen/waspeen)": [["A", "Nederland"]], "Carambola": [["D", "Isra\u00ebl"], ["E", "Maleisi\u00eb"]], "Radijs (los)": [["B", "Nederland"]], "Sperzieboon": [["B", "Marokko"], ["B", "Spanje"], ["C", "Senegal"], ["D", "Egypte"], ["E", "Kenia"]], "Kokosnoot": [["C", "Ivoorkust"], ["C", "Sri Lanka"], ["D", "Algerije"]], "Broccoli": [["B", "Frankrijk"], ["B", "Spanje"]], "Witte kool": [["A", "Nederland"]], "Lychee": [["C", "Madagaskar"], ["C", "Zuid-Afrika"]], "Rabarber": [["C", "Nederland"]], "Asperge (groen)": [["E", "Peru"]], "Courgette": [["A", "Spanje"]], "Rode biet": [["A", "Nederland"]], "Andijvie (gewoon)": [["A", "Spanje"], ["E", "Nederland"]], "Spitskool": [["A", "Nederland"], ["A", "Spanje"], ["B", "Portugal"]], "Ananas": [["B", "Costa Rica"], ["B", "Ecuador"]], "Kersen": [["E", "Chili"]], "Artisjok": [["B", "S
@tvwerkhoven
tvwerkhoven / coconut_plot.py
Last active December 10, 2015 01:58
Plot coconutBattery.app output
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file coconut_plot.py -- plot Macbook battery data
@author Tim van Werkhoven
@date 20121223
@copyright Copyright (c) 2012 Tim van Werkhoven <timvanwerkhoven@gmail.com>
This scripts plots data exported from [CoconutBattery.app][1] as CSV. This
can be useful to graphically investigate your battery performance.
@tvwerkhoven
tvwerkhoven / mac-dict.py
Created December 20, 2011 17:09
look up phonetic spelling Apple's Dictionary.app through DictionaryServices
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""
@file mac-dict.py -- lookup entries in the Mac dictionary
@author Tim van Werkhoven
@date 20111220
@copyright Copyright (c) 2011 Tim van Werkhoven
Use DictionaryServices to look up words in Apple's Dictionary.app.
@tvwerkhoven
tvwerkhoven / README
Created November 6, 2011 22:29
iPhone 3GS battery life analysis & plots
These files can be used to analyse the battery usage of an iPhone 3GS under real-life usage.
iphone_battery.csv: measurement data
proc_iphone_batt.py: process & plot data
@tvwerkhoven
tvwerkhoven / README
Created September 20, 2011 10:57
pyglyph -- identify unicode glyphs
pyglyph -- identify unicode glyphs
* About
pyglyph.py can be used to decode unicode strings and identify the glyphs.
This can be useful if you want to know what exact glyph was used somewhere,
simply copy it and use it as input for pyglyph.
Pyglyph works best with python2.7 (because of argparse), but is compatible
with earlier versions.
@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
@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 / 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.