1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-24 20:41:31 +01:00
dotfiles/aliases.zsh
2022-02-07 20:49:25 +01:00

91 lines
2.5 KiB
Bash
Executable File

###########################
#### ALIAS #
###########################
####
#### Easier life (MAC SPECIFIC)
####
if [[ "$(uname)" == "Darwin" ]]; then
alias o="open"
alias ls="ls -G"
## Colorize system.log contents (with grc), and inspect with less.
alias console="grc cat /var/log/system.log | sort -r | less -R"
## Quicklook shortcut
alias quicklook='qlmanage -px 2>/dev/null'
alias ql='quicklook'
## Airport command line interface
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport'
## Flush dns cache
#alias dnsflushcache='sudo discoveryutil mdnsflushcache' # used to work until 10.6
alias dnsflushcache='sudo killall -HUP mDNSResponder' # Works up until 10.9 and after 10.10.4
alias lsrt='ls -G -lrt | tail -5'
else
alias ls='ls --color'
fi
####
#### Easier life (everything)
alias dot="cd $DOTFILES"
#### Audible bell
alias bell='echo -en "\007"'
alias grep="grep --colour=auto"
##############
## ls aliases
############
# ls -al, only show files that start with a dot
alias lsdot="ls -al | awk '\$9 ~ /^\./ {print \$0}'"
alias lt='ls -lrt | tail -10'
alias ll='ls -lhL' #long ls output
alias ka="killall"
alias ipy='ipython'
alias ipyl='ipython --pylab'
## Show the last 10 modified files
if [[ ! "$(uname)" == "Darwin" ]]; then
alias lsrt="ls -lrt | tail -10"
fi
## Stress one CPU core
alias stress='yes >> /dev/null'
# define ssh without controlmaster
alias ssh1="ssh -o ControlMaster=no"
# git: useful_stuff
alias git_sort_branches_by_date="git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'"
alias gl5='git log -n 5'
alias pvim='poetry run vim'
alias gs='git status'
alias gcfx='git-fixup'
alias gls="git log --pretty=oneline --abbrev-commit" # gls: Git Log Short
alias watcha='watch ' # note the space after watch. This makes watch work with aliases
# A short version of docker ps
alias dps='docker ps --format "table {{.Image}}\t{{.RunningFor}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}"'
# Get ip for a docker container, usage: `docker inspect <container> | dockerip`
alias dockerip="jq -r '.[].NetworkSettings.Networks.bridge.IPAddress'"
alias pvim='poetry run vim'
alias pshell='poetry shell'
alias venv='source .venv/bin/activate'
# Run fzf with file preview
alias pf="fzf --preview='BAT_STYLE='header,changes' bat --color=always {}' --bind shift-up:preview-page-up,shift-down:preview-page-down"
# dvc
alias dst='dvc status'
alias dstc='dvc status --cloud'
alias drp='dvc repro'
alias drps='dvc repro -s'