Last active
January 20, 2020 07:47
-
-
Save ajitbohra/d768a3629a18fcceea351c0c807cc90b to your computer and use it in GitHub Desktop.
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
# π WP CLI Auto Completion | |
autoload bashcompinit | |
bashcompinit | |
source ~/wp-completion.bash | |
# π·οΈ System Paths | |
export PATH="$PATH:$HOME/.composer/vendor/bin" | |
export PATH="$PATH:$HOME/.config/composer/vendor/bin" | |
# ZSH Customization | |
prompt_context() {} | |
prompt_dir() { | |
prompt_segment blue black '%c' | |
} | |
# π Helpers | |
alias reload_alias="source ~/.zshrc" | |
alias edit_zsh="code ~/.zshrc" | |
alias edit_alias="code ~/.aliases" | |
alias edit_hosts="code /etc/hosts" | |
# π’ Docker | |
alias docker_up="docker-compose up -d" | |
alias docker_stop="docker-compose stop" | |
alias docker_down="docker-compose down -v" | |
docker_stop_all() { docker stop $(docker ps -a -q) 1 } | |
# π Git - Sync Fork With Upstream | |
git_sync_fork() { | |
echo "\nπ€ You are in ..." | |
pwd | |
echo "\nπ Fetching Upstream ...\n" | |
git fetch upstream | |
echo "\nπ Switching to origin master branch ...\n" | |
git checkout master | |
echo "\nπ Merging upstream master into fork ...\n" | |
git merge upstream/master | |
echo "\nπ Fork updated.\n" | |
} | |
#Git Empty branch | |
# @param branchname | |
git_empty_branch() { | |
echo "\nπ€ You are in ..." | |
pwd | |
echo "\nπ Checking our empty branch ...\n" | |
git checkout --orphan $1 | |
echo "\nπ Cleaning cache ...\n" | |
git rm --cached -r . | |
git clean -f -d -x | |
echo "\nπ Empty branch $1 created.\n" | |
} | |
# π MySQL - Create database, user and assign privileges | |
# @param database/user used for database and user name | |
# @param password used for database password | |
mysql_create_db() { | |
echo "\nπ Creating database ...\n" | |
sudo mysql -e "CREATE DATABASE $1" | |
echo "\nπ Creating user ...\n" | |
sudo mysql -e "CREATE USER '$1'@'localhost' IDENTIFIED BY '$2'" | |
echo "\nπ Granting privileges ...\n" | |
sudo mysql -e "GRANT ALL PRIVILEGES on $1.* TO '$1'@'localhost'" | |
echo "\nπ Database Created.\n" | |
} | |
# List Users | |
mysql_list_users(){ | |
echo "\nπ Listing Users ...\n" | |
sudo mysql -e "SELECT user FROM mysql.user"; | |
} | |
# Drop database with user | |
# @param database/user | |
mysql_drop_db() { | |
echo "\nπ Droppping database ...\n" | |
sudo mysql -e "DROP DATABASE $1" | |
echo "\nπ Dropping user ...\n" | |
sudo mysql -e "DROP USER '$1'@'localhost'" | |
echo "\nπ Database Dropped.\n" | |
} | |
# π‘ SSH Connections to servers | |
alias connect_servername="ssh root@websitedomain_or_ip" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment