2016-07-12 16:39:02 +02:00
|
|
|
alias c="clear"
|
|
|
|
alias dir='find . -maxdepth 1 -type d -regex "\.\/[^.].+"'
|
|
|
|
|
|
|
|
|
2017-06-25 21:42:58 +02:00
|
|
|
# aliases with dependencies
|
2017-07-02 05:09:25 +02:00
|
|
|
command -v nvim >/dev/null && alias vim=nvim || \
|
2017-09-15 17:55:45 +02:00
|
|
|
echo 'Missing dependency (nvim). Failed to alias vim -> nvim'
|
2017-07-02 05:09:25 +02:00
|
|
|
command -v find >/dev/null && alias find='find -E' || \
|
2017-09-15 17:55:45 +02:00
|
|
|
echo 'Missing dependency (find -E). Failed to alias find -> find -E'
|
2017-07-02 05:09:25 +02:00
|
|
|
command -v egrep >/dev/null && alias grep=egrep || \
|
2017-09-15 17:55:45 +02:00
|
|
|
echo 'Missing dependency (egrep). Failed to alias grep -> egrep'
|
2017-07-02 05:09:25 +02:00
|
|
|
command -v pygmentize >/dev/null && alias ccat='pygmentize -g' >/dev/null || \
|
2017-09-15 17:55:45 +02:00
|
|
|
echo 'Missing dependency (pygmentize -g). Failed to alias ccat -> pygmentize -g'
|
2017-07-02 05:09:25 +02:00
|
|
|
command -v hub >/dev/null && alias git=hub || \
|
2017-09-15 17:55:45 +02:00
|
|
|
echo 'Missing dependency (hub). Failed to alias git -> hub'
|
2017-07-02 05:09:25 +02:00
|
|
|
command -v tmux >/dev/null && alias tls='tmux list-sessions' || \
|
2017-09-15 17:55:45 +02:00
|
|
|
echo 'Missing dependency (tmux). Failed to alias tls -> tmux list-sessions'
|
2017-09-26 21:30:07 +02:00
|
|
|
command -v gpg2 >/dev/null && alias gpg=gpg2 || \
|
|
|
|
echo 'Missing dependency (gpg2). Failed to alias gpg -> gpg2'
|
2017-01-24 23:57:25 +01:00
|
|
|
|
2017-02-13 17:21:23 +01:00
|
|
|
|
2017-09-15 17:53:26 +02:00
|
|
|
# exa-specific aliases
|
2018-01-08 21:14:36 +01:00
|
|
|
if command -v exa >/dev/null || echo 'Missing dependency (exa). Failed to create dependent aliases.'; then
|
|
|
|
alias ls='exa'
|
|
|
|
alias ll='exa -l'
|
|
|
|
alias ll='ls -l'
|
|
|
|
alias la='exa -la'
|
|
|
|
alias la='ls -la'
|
|
|
|
|
|
|
|
# tree-views of dirs and subdirs
|
|
|
|
function lt {
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
exa --tree
|
|
|
|
else
|
|
|
|
depth=$1
|
|
|
|
exa --tree --level ${depth}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
fi
|
2017-09-15 17:53:26 +02:00
|
|
|
|
|
|
|
|
2017-09-15 17:52:42 +02:00
|
|
|
if command -v kubectl >/dev/null; then
|
|
|
|
# kubernetes aliases
|
|
|
|
alias kpods='kubectl get pods'
|
|
|
|
alias kdeploys='kubectl get deployments'
|
|
|
|
|
|
|
|
# the following functions rely on gcloud being installed
|
|
|
|
if command -v gcloud >/dev/null; then
|
|
|
|
function kswitch {
|
2018-01-08 21:14:36 +01:00
|
|
|
# environment should be "staging" or "public"
|
2017-09-15 17:52:42 +02:00
|
|
|
environment=$1
|
|
|
|
gcloud container clusters get-credentials $environment
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# kubernetes functions
|
2018-01-08 21:14:36 +01:00
|
|
|
function kedit {
|
|
|
|
deployment=$1
|
|
|
|
kubectl edit deployments $deployment
|
|
|
|
}
|
|
|
|
|
|
|
|
function kdns {
|
|
|
|
# Returns the domain names of the ingress points
|
|
|
|
kubectl get ing
|
|
|
|
}
|
|
|
|
|
2017-09-15 17:52:42 +02:00
|
|
|
function kush {
|
|
|
|
name=$1
|
|
|
|
cmd=${2-/bin/bash}
|
|
|
|
kubectl exec -it $name -- $cmd
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2017-06-25 21:42:58 +02:00
|
|
|
# git-specific aliases
|
2017-05-26 17:24:18 +02:00
|
|
|
git config --global alias.recent 'for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"'
|
2017-09-15 17:54:47 +02:00
|
|
|
git config --global alias.yday '! git log --name-only --since=yesterday.midnight --until=today.midnight --author="$(git config --get user.email)"'
|
2017-08-01 23:51:06 +02:00
|
|
|
git config --global alias.conflicts 'diff --name-only --diff-filter=U'
|
2017-09-26 21:30:07 +02:00
|
|
|
git config --global alias.patch-grep 'log -p -S'
|
2017-05-26 17:29:03 +02:00
|
|
|
|
2017-09-15 17:54:47 +02:00
|
|
|
alias gyday='git log --name-only --since=yesterday.midnight --until=today.midnight --author="$(git config --get user.email)"'
|
|
|
|
|
2017-06-25 21:42:58 +02:00
|
|
|
alias glp="git log --graph --pretty=format:'%Cred%h%Creset -%Cblue %an %Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
|
|
|
|
alias gprom="git pull --rebase origin master"
|
2017-05-26 17:29:03 +02:00
|
|
|
alias gcan='git commit --amend --no-edit'
|
|
|
|
alias gpf='git push --force'
|
2018-01-08 21:14:36 +01:00
|
|
|
alias gpff='git push --force --no-verify' # aka git push fucking force
|
2017-06-15 22:44:30 +02:00
|
|
|
alias gds='git diff --staged'
|
2017-09-15 17:54:47 +02:00
|
|
|
alias gfx='git commit --fixup'
|
2018-01-08 21:14:36 +01:00
|
|
|
alias gsh='git show'
|
2017-07-30 03:30:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
# elixir-specific aliases
|
2017-09-15 17:55:13 +02:00
|
|
|
alias m=mix
|
2017-07-30 03:30:34 +02:00
|
|
|
alias ism='iex -S mix'
|
|
|
|
alias tism='MIX_ENV=test iex -S mix'
|
|
|
|
alias mdg='mix deps.get'
|
2017-09-15 17:55:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
# docker-specific aliases
|
2017-09-26 21:30:07 +02:00
|
|
|
if command -v docker >/dev/null; then
|
|
|
|
# personal aliases
|
|
|
|
alias d=docker
|
|
|
|
alias dps='docker ps'
|
|
|
|
alias drm='docker rm'
|
|
|
|
alias drmi='docker rmi'
|
|
|
|
alias drit='docker run -it'
|
|
|
|
alias drd='docker run -d'
|
|
|
|
alias di='docker images'
|
|
|
|
|
|
|
|
function dsh {
|
|
|
|
container=$1
|
|
|
|
docker exec -it "${container}" /bin/bash
|
|
|
|
}
|
|
|
|
fi
|