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 / mime.types
Created November 1, 2019 13:24
up to date mime types
http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
@tmhpfnr
tmhpfnr / ng-debug (reactive) forms field validation
Last active November 8, 2018 17:01
Log angular (reactive) forms field validation status to console
debugFormValidations(form: FormGroup) {
Object.keys(form.controls).forEach(k => {
const control = form.controls[k];
// see https://angular.io/api/forms/AbstractControl#status
const log = control.invalid ? console['warn'] : console['log'];
log(k, 'invalid', control.invalid, 'value', control.value);
});
}
@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;',
#!/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 / .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
@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 / 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 / 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
pip install mitmproxy
# start mitmproxy on default port 8080
mitmproxy
emulator-arm -avd NAME_OF_AVD -http-proxy 127.0.0.1:8080