Skip to content

Instantly share code, notes, and snippets.

@Pnoexz
Last active June 13, 2022 06:44
Show Gist options
  • Save Pnoexz/e9a75e2fe0e2a5cdff92b6b8d5258049 to your computer and use it in GitHub Desktop.
Save Pnoexz/e9a75e2fe0e2a5cdff92b6b8d5258049 to your computer and use it in GitHub Desktop.
################################################################################
# Docker
################################################################################
# Compose
alias dcu='docker-compose up'
alias dc='docker-compose up --build'
alias dcdu='docker-compose down && docker-compose up'
alias dcd='docker-compose down && docker-compose up --build'
unset -f dce
function dce {
docker-compose exec $1 /bin/ash;
}
export -f dce;
unset -f dcebash
function dcebash {
docker-compose exec $1 bash;
}
export -f dcebash;
# Raw
alias dps='docker ps'
alias dpsa='docker ps -a'
alias dkillall='docker kill $(docker ps -qa)'
alias dstopall='docker stop $(docker ps -qa)'
alias ddeletestopped='docker rm $(docker ps -aq)'
alias ddeleteall='docker rm -f $(docker ps -aq); docker rmi -f $(docker images -aq)'
alias dalpine="docker run -it alpine /bin/ash"
alias dfpm81="docker run -it php:8.1-fpm-alpine /bin/ash"
unset -f dexeclatest
function dexeclatest {
CID=$(docker ps -l -q);
docker exec -ti $CID /bin/ash;
}
export -f dexeclatest;
unset -f dexeclatest-bash
function dexeclatest-bash {
CID=$(docker ps -l -q);
docker exec -ti $CID /bin/bash;
}
export -f dexeclatest;
################################################################################
# Terraform
################################################################################
alias tplan="terraform plan -out plan"
alias tapply="terraform apply 'plan'"
alias tdestroy="terraform destroy"
unset -f t
function t {
ACTION=${1-plan}
terraform plan -out plan;
PLAN_EC=$?
if [[ "${PLAN_EC}" -ne "0" ]]; then
printf '\n'
else
read -p "Apply changes? [y|N] " -n 1 -r
printf '\n'
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
printf 'Removing plan\n'
rm plan;
printf 'Done.\n'
else
printf 'Applying plan\n'
terraform apply "plan";
fi
fi
}
export -f t
################################################################################
# GIT
################################################################################
alias gs="git status"
alias gco="git checkout"
alias ga="git add"
alias gd="git diff -w"
alias gdc="git diff -w --cached"
alias gl="git log"
alias glo="git log --oneline --abbrev-commit --decorate"
alias glop="git log --graph --pretty=format:'%C(auto)%h%d (%cr) %cn: %s'"
alias gaa="git add ."
alias gamend="git commit --amend --no-edit"
alias gpokewillfail="git commit -a --no-verify -m 'This pipeline will fail by design'; git push;"
alias gpokemightfail="git commit -a --no-verify -m 'This pipeline might fail and its not a big deal'; git push;"
alias gpuocb='git push -u origin $(git_branch_name)'
alias gitassumedchanged='git ls-files -v | grep ^h | cut -c 3-'
unset -f gdcommit
function gdcommit {
git diff $1~ $1
}
export -f gdcommit;
unset -f authors
function authors {
git blame --line-porcelain $1 | grep "^author " | sort | uniq -c | sort -nr
}
export -f authors;
unset -f git-authors
function git-authors {
git ls-tree -r -z --name-only HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain HEAD |grep "^author "|sort|uniq -c|sort -nr
}
export -f git-authors;
################################################################################
# Apps and Bash
################################################################################
alias r="reset"
alias rga="rg -S --trim --no-ignore --hidden --max-columns=512"
alias rg="rg -S --trim --ignore --max-columns=512"
alias rrga="reset; rg -S --trim --no-ignore --hidden --max-columns=512"
alias rrg="reset; rg -S --trim --ignore --max-columns=512"
alias c="code"
alias cn="code -n"
alias fn="firefox --new-window"
alias fnp="firefox --new-window --private-window"
alias chn="chromium-browser --new-window"
alias s="source ~/.bashrc"
alias m="make"
alias ea="code -wn ~/.bash_aliases; source ~/.bashrc"
alias n="nemo . 2>&1 > /dev/null"
alias cputemp="watch -n 1 sensors"
alias co="composer"
alias coi="composer install"
alias cou="composer update"
alias cor="composer require"
alias cord="composer require --dev"
alias cov="composer validate --strict"
alias codumpautoload="composer dumpautoload"
alias r20="redshift -O 2000"
alias r25="redshift -O 2500"
alias r30="redshift -O 3000"
alias r35="redshift -O 3500"
alias r40="redshift -O 4000"
alias r45="redshift -O 4500"
alias r50="redshift -O 5000"
alias r55="redshift -O 5500"
alias cd..="cd .."
source ~/.other_aliases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment