Last active
March 8, 2022 20:48
-
-
Save antonkomarev/bd0b980473929f26bb66e8295a60739f to your computer and use it in GitHub Desktop.
Restart docker on MacOS, quick git commands
This file contains hidden or 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
# vi ~/.bash_profile | |
# Docker | |
d () { | |
if [ -f $1 ] ; then | |
echo "Available commands:" | |
echo " \e[32md restart\e[0m - Restart docker service" | |
echo " \e[32md stop\e[0m - Stop all docker containers" | |
return 0 | |
fi | |
if [ $1 = "restart" ]; then | |
echo "Killing docker processes" | |
test -z "$(killall docker 2>/dev/null)" | |
echo "Quitting Docker app" | |
osascript -e 'quit app "Docker"' | |
echo "Launching Docker app" | |
open --background -a Docker | |
return 0 | |
elif [ $1 = "stop" ]; then | |
echo "Stopping all docker containers" | |
docker ps -q | xargs -L1 docker stop | |
else | |
echo "Unknown argument: $1" | |
return 1 | |
fi | |
} | |
# Git | |
g () { | |
if [ -f $1 ] ; then | |
echo "Available commands:" | |
echo " \e[32mg push-all\e[0m - Push all files" | |
return 0 | |
fi | |
if [ $1 = "push-all" ]; then | |
git add . && git commit -m "WIP" && git push | |
fi | |
} |
This file contains hidden or 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
# vi ~/.zshrc | |
if [ -f ~/.bash_profile ]; then | |
. ~/.bash_profile | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment