This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # vim: syntax=python fileencoding=utf-8 ts=4 sts=4 sw=4 expandtab | |
| def dict_from_list(lst): | |
| """ | |
| Takes a list of objects and returns it as a dict(). Does what dict(lst) is expected to do. | |
| """ | |
| if len(lst) % 2: lst.append(None) | |
| # a short form for: | |
| # i = iter(lst) | |
| # zip(i, i) | |
| return dict(zip(*[iter(lst)]*2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Needed for commit logs | |
| git config --global user.name "$name" | |
| git config --global user.email "$email" | |
| # Aliases | |
| git config --global alias.dc "diff --cached" | |
| # I prefer an shell alias for 'git status' | |
| echo 'alias gst="git status"' >> $HOME/.bashrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Enable file configuration, eg. "# vim: ts=4" | |
| set modeline | |
| " Set statusline and enable it permanently | |
| " Entry format (see :help statusline): %-0{minwid}.{maxwid}{item} | |
| set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P | |
| set laststatus=2 | |
| " create backup file | |
| set backup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| [ -e "$1" ] || exit 1 | |
| [ -e "$1.retouch" ] && ( touch -r "$1.retouch" "$1"; rm -f "$1.retouch"; : ) && exit 0 | |
| touch -r "$1" "$1.retouch" && exit 0 | |
| #EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| set -Cefu | |
| __check_for_help() | |
| { | |
| set +u | |
| if test $(basename -- $0) = 'libtemplate.sh' -a \( '--help' = "$1" -o '-h' = "$1" \); then | |
| exec sed -n '/^#--/ {s/^#--//; p}' $0 | less -+S -FRX && exit 0 | |
| fi | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sed -f | |
| # SED script to concatenate logical lines sepaated by | |
| # backslashes (\) at the end of the "physical" line | |
| # set branch target 't' | |
| :t | |
| # apply the following on all lines ending with an '\' | |
| /\\$/ { | |
| # concatenate actual line with the next in pattern space | |
| N; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| __check_for_help() | |
| { | |
| set +u # disable 'nounset' because positional parameters may be unset | |
| # check $0 against the file name because of scripts sourcing shell libraries | |
| # with inline documentation | |
| test $(basename $0) = 'libUMI.sh' -a \( '--help' = "$1" -o '-h' = "$1" \) \ | |
| && exec sed -n '/^#--/ {s/^#--//; p}' $0 | less -+S -FRX && exit 1 |