Skip to content

Instantly share code, notes, and snippets.

View tmhpfnr's full-sized avatar

Tim Hoepfner tmhpfnr

  • Cologne, Germany
View GitHub Profile
@tmhpfnr
tmhpfnr / class.tx_webkitpdf_pi1.php
Created July 10, 2012 10:12
TYPO3: WebKit PDF: Undefined second argument for sanitizeURL
// line 143
$url = tx_webkitpdf_utils::sanitizeURL($url, $allowedHosts);
@tmhpfnr
tmhpfnr / gist:3201845
Created July 29, 2012 21:09
OS X: ZSH: Additional configuration
# configure date/time and locale
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
pip install mitmproxy
# start mitmproxy on default port 8080
mitmproxy
emulator-arm -avd NAME_OF_AVD -http-proxy 127.0.0.1:8080
@tmhpfnr
tmhpfnr / glossaries_create.engine
Last active August 29, 2015 13:56
Creating Glossaries TeXShop on Mac: 1) create glossaries_create.engine in Users/.../Library/TexShop/Engines 2) chmod a+x glossaries_create.engine 3) restart TS 4) select glossaries_create in dropdown next to Typeset
#!/bin/sh
bfname=$(dirname "$1")/"`basename "$1" .tex`"
makeindex -s "$bfname".ist -t "$bfname".alg -o "$bfname".acr "$bfname".acn
makeindex -s "$bfname".ist -t "$bfname".glg -o "$bfname".gls "$bfname".glo
@tmhpfnr
tmhpfnr / compress
Last active August 29, 2015 14:06
(lossless) image/sound compression
#
# png
#
optipng -c 4 -o7 *.png && advpng -z4 *png && advdef -z4 *.png
#
# jpeg
#
jpegoptim *.jpg --strip-all
@tmhpfnr
tmhpfnr / shrink.sh
Created March 21, 2015 23:12
Shrink PDF file size with simple postscript conversion
#!/bin/bash
LC_NUMERIC=C LC_COLLATE=C
start_time=`date +%s`
err ()
{
echo $1
exit $code
}
@tmhpfnr
tmhpfnr / .gitconfig
Last active September 1, 2016 16:12
[alias]
# tidy = "!git fetch --prune && git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d"
# pretty format git log
hist = log --decorate --oneline --graph --all --date=format:\"%Y-%b-%d %H:%M:%S\" --pretty=format:\"%C(auto)%d%Creset %C(auto)%h%Creset - %C(cyan)%an%Creset %Cgreen(%ad)%Creset : %s\"
[tag]
# sort git tags by semver
sort = version:refname
#!/bin/sh
# --------------------------------------------------------
# Installation
# $ git config --global init.templatedir '~/.git-templates' # setup global templatedir
# $ mkdir -p ~/.git-templates/hooks # create hooks direcotry
# $ touch ~/.git-templates/hooks/pre-commit # copy & paste this content into ~/.git-templates/hooks/pre-commit
# $ chmod a+x ~/.git-templates/hooks/pre-commit
# $ git init # reinitialized existing git repositories
# --------------------------------------------------------
@tmhpfnr
tmhpfnr / ng-debug (reactive) forms field names
Last active November 8, 2018 17:01
Show angular (reactive) forms field name for debugging purpose
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = [ // credits https://www.w3schools.com/css/css_tooltip.asp
'.debug-tooltip {',
'position: relative;',
'display: inline-block;',
'border-bottom: 1px dotted black;',
'}',
'.debug-tooltiptext {',
'visibility: visible;',