Skip to content

Instantly share code, notes, and snippets.

View reduardo7's full-sized avatar
💭
🤔

Eduardo Daniel Cuomo reduardo7

💭
🤔
View GitHub Profile
@reduardo7
reduardo7 / install-redis.sh
Last active September 27, 2018 17:07 — forked from khelll/install-redis.sh
Installing Redis on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=4.0.11
set -e
@reduardo7
reduardo7 / slack-file-killer.js
Created March 14, 2018 14:05 — forked from iamstuartwilson/slack-file-killer.js
Kill multiple slack files from your browser console. Simply paste this code when on the "https://[space].slack.com/files/[me]" page.
(function(){
$('#files_list > [data-file-id]').each(function(i) {
killIt($(this).attr('data-file-id'));
function killIt(id) {
console.log(id);
$.post('/api/files.delete', {
file: id,
token: boot_data.api_token
@reduardo7
reduardo7 / docker-destroy-all.sh
Created November 28, 2017 16:51 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)

External configuration in Grails 3


Working on Grails 3 I realized that I no longer can specify external configuration using the standard grails.config.locations property in Config.groovy file.

Reason is obvious! There is no Config.groovy now in Grails 3. Instead we now use application.yml to configure the properties. However, you can't specify the external configuration using this file too!

What the hack?

Now Grails 3 uses Spring's property source concept. To enable external config file to work we need to do something extra now.

@reduardo7
reduardo7 / require-clean-work-tree
Created November 24, 2015 19:21 — forked from ssbarnea/require-clean-work-tree
require-clean-work-tree is a bash script that will prevent you from doing things if your working tree is dirty. It will detect your scm and return false if detection fails or the tree is dirty. Currently it supports only git and mercurial but we can add other scm later like svn or perforce.
#!/bin/bash
# version: 1.0
# author: Sorin Sbarnea
require_clean_work_tree_git () {
git rev-parse --verify HEAD >/dev/null || exit 1
git update-index -q --ignore-submodules --refresh
err=0
if ! git diff-files --quiet --ignore-submodules
@reduardo7
reduardo7 / post-merge
Created November 9, 2015 12:52 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"