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 / battery_logger.sh
Last active April 6, 2022 02:56
Log Macbook battery status with system_profiler(8) and ioreg(8), see http://home.strw.leidenuniv.nl/~werkhoven/etc/battlog.html
#!/bin/bash
#
# About
# =====
#
# Log battery info from command-line with SYSTEM_PROFILER(8) and IOREG(8) to a
# user-configurable directory.
#
# Run with -h to see usage options.
#
@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 / .gitignore
Created August 2, 2011 08:59
XeTeX cheatsheet
*.aux
*.log
*.out
*.pdf
*.synctex.gz*
@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.
@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}