-
-
Save austinsonger/03b00e27a9e5c30d4a3546b438b8fa6e to your computer and use it in GitHub Desktop.
Automatic fetch all git repositories. A thing that you might want to add to your cron. Also some nice bash aliases for dockers.
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
#!/bin/bash | |
function aprint() { awk "{print \$${1:-1}}"; } | |
alias dockerstart='docker ps -a --format="{{.ID}}" |xargs -ir docker start {}' | |
alias dockerrmi="docker images | grep none | aprint 3 | xargs -I[] -r docker rmi []" | |
alias dockerrm="docker ps | grep Exited | aprint 1 | xargs -I[] -r docker rm []" | |
alias dockerrmall="docker ps -a | tail -n -1 | grep -v Up | aprint 1 | xargs -I[] -r docker rm []" | |
function ___date() { echo -n "[`date --rfc-3339=seconds `] "; } | |
function dockerkill() { docker ps | grep $1 | aprint 1 | xargs -I[] -r docker stop []; } | |
function dockerdel() { docker images | grep $1 | aprint 3 | xargs -I[] -r docker rmi []; } | |
function untilfail() { while $@; do :; done } | |
function untilsuccess() { while ( ___date && ! $@ ) ; do sleep 1s ; done } | |
function killtests() { jps | grep --perl-regexp "(RemoteTestRunner|surefire)" | aprint 1 | xargs -I[] -r kill -9 [];} | |
function buildnow() { git merge develop && mvn validate && mvn clean install -o -DskipTests=true -Dmaven.javadoc.skip=true -Ddockerfile.skip=true && git push; } |
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
export GPG_TTY=$(tty) | |
source <(kubectl completion bash) | |
export GIT_PROMPT_THEME=Single_line_Ubuntu | |
source ~/git/.bash-git-prompt/gitprompt.sh |
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
[push] | |
default = simple | |
[core] | |
editor = vim | |
[commit] | |
gpgsign = true |
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
#!/bin/bash | |
pushd ~/git | |
. ~/.bash_aliases | |
function gitprune() { | |
git remote update --prune | |
git fetch -p --all | |
git fetch origin develop:develop | |
git fetch origin master:master | |
git branch -vv | grep -v "*" | grep ": gone]" | aprint 1 | xargs -r -i git branch -d {} | |
merged=$(git branch --merged | grep -v "*" | grep -v "master" ) | |
if [ ! -z "$merged" ]; then | |
echo "$merged" | tee /tmp/merged-branches_$(basename `pwd`) | |
fi | |
git gc --auto | |
} | |
for f in *; do | |
if [[ -d $f ]]; then | |
# $f is a directory | |
pushd $f | |
gitprune & | |
popd | |
fi | |
done | |
popd | |
dockerrmi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment