Skip to content

Instantly share code, notes, and snippets.

View reduardo7's full-sized avatar
💭
🤔

Eduardo Daniel Cuomo reduardo7

💭
🤔
View GitHub Profile
@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"
@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

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 / user-creation-function.sh
Last active November 1, 2017 21:08
Create multiple Unix users with permissions
# Run as ROOT: $ sudo su
#########
# Utils #
#########
@log() {
echo "# $*"
}
@reduardo7
reduardo7 / user-creation.sh
Created November 1, 2017 21:08
Create Unix user with permissions
# Run as ROOT: $ sudo su
(
##########
# Config #
##########
# Required
PTECH_SETUP_USER_NAME=username
# Optional
@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)
@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 / keybase.md
Created August 21, 2018 19:03
keybase.md

Keybase proof

I hereby claim:

  • I am reduardo7 on github.
  • I am reduardo7 (https://keybase.io/reduardo7) on keybase.
  • I have a public key ASBPF9vxn6uoQaQD06IGZB1aCw7qQiLb4_htndVfHfn0mQo

To claim this, I am signing this object:

@reduardo7
reduardo7 / list-files.ps1
Created September 24, 2018 23:31
Windows PowerShell - Files Details
Get-Item g:\* | Foreach { "Nombre: " + $_.Name + ", Creado: " + $_.CreationTime + "; Modificado: " + $_.LastWriteTime + ", Tamaño: " + $_.Length + " k
b" }
@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