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
#/bin/bash | |
for i in {0..70} | |
do | |
TARGET_DATE=$(date -d "-$i week" +"%Y-%m-%d") | |
git log -1 --before=$(git log -1 --before=$TARGET_DATE | grep commit | tr -d 'commit ' | cut -c 1-6) | |
# Example: Checkout first commit of each week backwards and evaluate the code and metrics with phpqs | |
# cd $PROJECT_PATH | |
# COMMIT=$(git log -1 --before=$TARGET_DATE | grep commit | tr -d 'commit ' | cut -c 1-6) |
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
# source: http://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-opening-br/10325316#10325316 | |
curl -u 'USER' https://api.github.com/user/repos -d '{"name":"REPO"}' | |
# Remember replace USER with your username and REPO with your repository/application name! | |
git remote add origin git@github.com:USER/REPO.git | |
git push origin master |
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
#!/bin/bash | |
# Pass as first and only argument the container name or id. | |
# This assumes the container as bash and also that you want to login as root. | |
# ./docker_ssh.sh container_name | |
docker exec -i -t -u 0 $1 /bin/bash |
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
#!/bin/bash | |
# Useful if you are executing this script | |
# and including files by relative location | |
# or working and interacting with another scripts and folders. | |
SCRIPT_ABS_DIR=$(dirname $(realpath $0)) |
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
#/bin/bash | |
dos2unix $(grep -r 'bin/bash' | cut -d':' -f1) |
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
#!/bin/bash | |
# Say a b c | |
# man read | |
echo "===== Say 'A'" | |
read a | |
echo "===== Say 'B'" | |
read b |
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
#!/bin/bash | |
# http://stackoverflow.com/a/32074098 | |
docker rm $(docker stop $(docker ps -a -q --filter ancestor=<IMAGE_NAME> --format="{{.ID}}")) |
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
#!/bin/bash | |
# remove exited containers: | |
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v | |
# remove unused images: | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi | |
# remove unused volumes: | |
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <( |
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
jQuery('.sidebar a').each(function(){ window.open($(this).attr('href'), '_blank'); }) |
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
# Move found files modified the 5 minutes before, depth level 1, to "DIR" directory ... | |
mv $(find ./ -maxdepth 1 -mmin -5) DIR/ |