Skip to content

Instantly share code, notes, and snippets.

@antonkomarev
Last active March 8, 2022 20:48
Show Gist options
  • Select an option

  • Save antonkomarev/bd0b980473929f26bb66e8295a60739f to your computer and use it in GitHub Desktop.

Select an option

Save antonkomarev/bd0b980473929f26bb66e8295a60739f to your computer and use it in GitHub Desktop.

Revisions

  1. antonkomarev revised this gist Mar 8, 2022. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -30,3 +30,17 @@ d () {
    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
    }
  2. antonkomarev revised this gist Mar 6, 2022. 1 changed file with 9 additions and 5 deletions.
    14 changes: 9 additions & 5 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -3,23 +3,27 @@
    # Docker
    d () {
    if [ -f $1 ] ; then
    echo 'Commands available:'
    echo '\e[32m d restart \e[0m'
    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'
    echo "Killing docker processes"
    test -z "$(killall docker 2>/dev/null)"

    echo 'Quitting Docker app'
    echo "Quitting Docker app"
    osascript -e 'quit app "Docker"'

    echo 'Launching Docker app'
    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"

  3. antonkomarev revised this gist Mar 6, 2022. 1 changed file with 10 additions and 2 deletions.
    12 changes: 10 additions & 2 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -5,16 +5,24 @@ d () {
    if [ -f $1 ] ; then
    echo 'Commands available:'
    echo '\e[32m d restart \e[0m'

    return 0
    fi

    if [ $1 = "restart" ]; then
    test -z "$(killall docker 2>/dev/null)" && osascript -e 'quit app "Docker"'
    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
    else
    echo "Unknown argument: $1"

    return 1
    fi
    }

  4. antonkomarev revised this gist Mar 6, 2022. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,12 @@

    # Docker
    d () {
    if [ -f $1 ] ; then
    echo 'Commands available:'
    echo '\e[32m d restart \e[0m'
    return 0
    fi

    if [ $1 = "restart" ]; then
    test -z "$(killall docker 2>/dev/null)" && osascript -e 'quit app "Docker"'
    open --background -a Docker
    @@ -11,3 +17,4 @@ d () {
    return 1
    fi
    }

  5. antonkomarev created this gist Mar 6, 2022.
    13 changes: 13 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # vi ~/.bash_profile

    # Docker
    d () {
    if [ $1 = "restart" ]; then
    test -z "$(killall docker 2>/dev/null)" && osascript -e 'quit app "Docker"'
    open --background -a Docker
    return 0
    else
    echo "Unknown argument: $1"
    return 1
    fi
    }
    5 changes: 5 additions & 0 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    # vi ~/.zshrc

    if [ -f ~/.bash_profile ]; then
    . ~/.bash_profile
    fi