Skip to content

Instantly share code, notes, and snippets.

View HelioCampos's full-sized avatar

Helio Campos Mello de Andrade HelioCampos

View GitHub Profile
@HelioCampos
HelioCampos / pre-push.sh
Created January 10, 2016 11:19 — forked from textarcana/pre-push.sh
Git Hook PrePush protection for force pushing
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. git config --global init.templatedir '~/.git-templates'
# 2. mkdir -p ~/.git-templates/hooks
@HelioCampos
HelioCampos / pre-commit
Created January 10, 2016 11:17 — forked from textarcana/pre-commit
Pre-commit hook that prevents debugging code and merge artifacts from being committed.
#!/bin/bash
# Pre-commit hook that prevents debugging code and merge artifacts from being committed.
FILES_PATTERN='\.(php|ctp|ctpm|css|rb|erb|haml|js|coffee)(\..+)?$'
FORBIDDEN=( "binding\.pry" "save_and_open_page" "debugger" "it\.only" "describe\.only" ">>>>>>" "<<<<<<" "======" )
# the exit code from `grep -E $FILES_PATTERN` gets swallowed unless the pipefail option is set
set -o pipefail
@HelioCampos
HelioCampos / gist:e789edbf2d7a79a17889
Last active April 5, 2016 13:57 — forked from jcmartins/Docker utils
Cleanup Docker Images
Delete all containers
docker rm $(docker ps -a -q)
Delete all images
docker rmi $(docker images -q)
Removes all containers running under Docker, so use with caution.
docker ps -a | awk '{print $1}' | xargs docker kill
Removing all Containers that are not running: