Skip to content

Instantly share code, notes, and snippets.

View gelysis's full-sized avatar
🎯
Focusing

A Gerhards gelysis

🎯
Focusing
  • RD - ITV
  • Mitteleuropa / Central Europe
View GitHub Profile
cd "$(dirname "$(realpath -- "$0")")";
alias ll="ls -hails"
alias branches="git for-each-ref --sort='authordate:iso8601' --format='%(authordate:relative)%09%(refname:lstrip=1)' refs | grep -v 'stash\|tags\|HEAD' | sed -e 's-heads/\|remotes/\|tags/--'"
alias locals="git for-each-ref --sort='authordate:iso8601' --format='%(authordate:relative)%09%(refname:short)' refs/heads | sed -e 's-refs/heads/--'"
alias localsonly="git branch --sort='authordate:iso8601' --format '%(authordate:relative) %(refname:short) %(upstream:track) %(upstream)' | awk -v weg='[entfernt]' -v gone='[gone]' -v tab='\t' '{if ($5==weg || $5==gone || length($5)==0) print $1,$2,$3,tab,$4;}'"
alias tags="git log --decorate --no-walk --oneline --tags"

Keybase proof

I hereby claim:

  • I am gelysis on github.
  • I am gelysis (https://keybase.io/gelysis) on keybase.
  • I have a public key ASCaNvZeX32KIJ5TVui-FBuYZ8JxKALOofBzu-YGQC23kQo

To claim this, I am signing this object:

$snake_case = strtolower(
preg_replace(
[
'#([A-Z][a-z]*)(\d+[A-Z][a-z]*\d+)#',
'#([A-Z]+\d*)([A-Z])#',
'#([a-z]+\d*)([A-Z])#',
'#([^_\d])([A-Z][a-z])#'
],
'$1_$2',
$camelCase
@gelysis
gelysis / Shell: Get current git branch
Last active October 26, 2022 12:16
Short git prompt alternative + coloured prompt
current_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' ; }
PS1='${debian_chroot:+($debian_chroot)}\[\033[1;30m\]\u@\h:\[\033[1;31m\]\w\[\033[1;33m\]$(current_branch)\$ \[\033[00m\]'
pwd | awk -F/ '{print $NF}'
find -name \*.js | while read f; do tail -n1 $f | read -r _ || echo >> $f; done
# Rewrite URL for robots.txt
RewriteRule ^robots\.txt$ robots/%{HTTP_HOST}.txt [L]
git filter-branch --commit-filter ' \
if [ "$GIT_COMMITTER_EMAIL" = "<old email>" ] || [ "$GIT_COMMITTER_NAME" = "<old name>" ]; \
then \
GIT_COMMITTER_NAME="<new name>"; \
GIT_AUTHOR_NAME="<new name>"; \
GIT_COMMITTER_EMAIL="<new email>"; \
GIT_AUTHOR_EMAIL="<new email>"; \
# (re) commit with the updated information \
git commit-tree "$@"; \
else \
$silverStripeVersion = Deprecation::dump_settings()['version'];