Skip to content

Instantly share code, notes, and snippets.

@ecoologic
Last active July 12, 2023 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecoologic/b4b2cb3b06bf9f15c6b9c5299ae1c3bd to your computer and use it in GitHub Desktop.
Save ecoologic/b4b2cb3b06bf9f15c6b9c5299ae1c3bd to your computer and use it in GitHub Desktop.
Bash aliases
# Read File System
# alias ag='ag -C' # -C 5 # Context
alias aglog='ag "\>\>\>"'
alias agdeb='ag binding\.pry app/ lib/ vendor/ config/ spec/ && ag debugger app/javascript/ app/assets/javascripts/'
alias agig="ag --ignore-dir={vendor,vendir,node_modules,cache,tmp,test}"
# alias agit='ag --ignore="*_test\.*"'
alias agl='ag -l' # file only
alias agq='ag -Q' # no regex
alias agw='ag --width=300'
alias bigfiles="find . -type f -printf '%s %p\n' | sort -nr | head -30"
alias dfh='df -h | head'
alias dusch='du -csh' # c total, s 'apparent size', h human
alias f='find . -iname '
alias ghpr="gh pr checkout"
alias grep='grep --color=auto'
alias grepi='grep --ignore-case'
alias hist='history |tail -n 33'
alias hpg='history | cut -c 8- | grep'
alias keep1='awk "{if(NR>1)print}"' # eg: tail x.csv |grep mine |keep1
alias myips='ifconfig |grep "inet.*255"'
alias openports='lsof -n -i'
alias tailf='tail -f'
alias treei='tree -I "node_modules|tmp|test|spec|vendor|vendir|.*"'
# Write File System
alias allmine='chown ecoologic:staff -R .'
alias sallmine='sudo chown ecoologic:staff -R .'
alias cpr='cp -r'
alias mkdirp='mkdir -p'
alias s='sudo'
alias rmf='rm -rf'
# replaceDir() { find ./ -type f -exec sed -i "s/$1/$2/g" {} \; ; };
touchp() { mkdir -p $(dirname $1) && touch $1; }
# Git
alias g='git'
alias ga='git add -A'
alias glfh="git log --full-history -- "
alias gcurrentbranch='git symbolic-ref --short -q HEAD'
alias gl1='git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --date=short'
alias glc='git log --oneline |head -n 1'
alias gmm='git fetch && git merge origin/main'
alias gs='git status'
alias gst='git status'
alias gstash='git add . && git add . -u && git stash && git status'
alias gpou='git push origin "$(gcurrentbranch)" -u'
alias gacane='git add . && git commit --amend --no-edit'
alias gsta1="git stash apply stash@{1}"
alias gsta2="git stash apply stash@{2}"
# Docker
alias d='docker'
alias dc='docker-compose'
alias dcub='docker-compose up --build'
alias deit='docker exec -it'
alias dls='docker image ls'
alias dps='docker container ps'
# Ruby
alias b='bundle'
alias be='bundle exec'
alias update-rbenv='brew update && brew upgrade ruby-build'
# JS
alias y='yarn'
# Misc
alias v='vim'
alias c='code'
alias m8='microk8s'
alias py=python3
alias py3=python3 # /Applications/Python 2.7
# alias ll='ls -la' # Moved down so it works
alias llp='ls -lrt -d -1 $PWD/*'
alias ls='ls -G'
alias lo='ls -lrth' # or -halt # ordered by modified
# Uppercase
alias BE=be
alias C=c
alias G=g
alias V=v
alias Z=z
alias Y=y
alias K=k
alias EXIT=exit
#####################################################
# ~/.vimrc
" Clear filetype flags before changing runtimepath to force Vim to reload them.
filetype off
filetype plugin indent off
set runtimepath+=$GOROOT/misc/vim
filetype plugin indent on
filetype plugin on
syntax on
set backspace=indent,eol,start
set ve+=onemore
set tabstop=2
set shiftwidth=2
set wildignore=.git/**,tmp/**
set laststatus=2
" set expandtab
" set number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment