Last active
December 25, 2020 15:50
-
-
Save devlifeX/0ff910138aa4af20b591d43eb651eb9d to your computer and use it in GitHub Desktop.
Append These code to your .bashrc and make your life easier!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker section ################################################ | |
# - Stop all running docker containers | |
function stopAll { | |
containers=$(docker ps -qa) | |
if [ ! -z "$containers" ] | |
then | |
echo $containers | xargs docker container rm -f $1 | |
else | |
echo "No Containers for remove!" | grep -e "." | |
fi | |
} | |
alias stopall='stopAll'; | |
# - Up/Down docker compose | |
alias up='docker-compose up -d' | |
alias down='docker-compose down' | |
# Git Section ################################################ | |
# - Some aliases for git | |
alias l='git log --oneline' | |
alias s='git status' | |
alias d='git diff .' | |
alias b='git branch' | |
alias push='git push origin master' | |
alias pull='git pull origin master' | |
alias c='git commit -m ' | |
alias ac='git commit -am ' | |
alias a='git add ' | |
alias p='git push origin ' | |
# IP Section ################################################ | |
# - Show your Internet IP | |
function showip() { | |
curl ifconfig.me | |
} | |
# Network manager Section ################################################ | |
# - Connect/ DisConnect To Connections like VPN etc... | |
# Usage: | |
# 1) Run: nmcli connection | |
# 2) Pick Your Connection NAME and use below | |
function toggleVPN() { | |
nmcli -f GENERAL.STATE connection show $1 && | |
nmcli connection up $1 || | |
nmcli connection down $1 | |
} | |
alias vpn="toggleVPN OpenVPN" # You Should Use like this: toggleVPN <Connection you want toggle> | |
# Use wpcli on the fly! | |
function wpclireset() { | |
unset NETWORK | |
unset OVERRIDE_NAME | |
unset NAME | |
} | |
function wpcli() { | |
if [ -z "$NAME" ] ; then | |
NAME=`basename $(pwd) | awk '{print tolower($0)}'` | |
OVERRIDE_NAME="${NAME}_wordpress_1" | |
echo "We set $OVERRIDE_NAME to NAME If you want change it, Set NAME Like: NAME=test && wpcli" | |
fi | |
if [ -z "$NETWORK" ] ; then | |
NETWORK="${NAME}_default" | |
echo "We set $NETWORK to NETWORK If you want change it, Set NETWORK Like: NANETWORKME=test_default && wpcli" | |
fi | |
if [ -z "$OVERRIDE_NAME" ]; then | |
OVERRIDE_NAME=$NAME | |
fi | |
echo "We Use this NAME: $OVERRIDE_NAME, If you want change it, Set NAME Like: NAME=test" | |
docker run -it --rm --network "$NETWORK" --volumes-from "$OVERRIDE_NAME" wordpress:cli wp --skip-plugins "$@" | |
} | |
function pluginlist() { | |
wpcli plugin list | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment