Skip to content

Instantly share code, notes, and snippets.

View barata0's full-sized avatar

Daniel Ribeiro barata0

  • Rio de Janeiro
View GitHub Profile
@barata0
barata0 / docker-rm
Created June 7, 2014 07:11
Remove all running dockers and delete host entries for docker IP on known_hosts - on Ubuntu 14.04
#!/bin/bash
RUNNING_CONTAINERS=`sudo docker ps --no-trunc -a -q`
if [[ -n "$RUNNING_CONTAINERS" ]]; then
echo "containers running"
echo "$RUNNING_CONTAINERS"
echo "killing containers"
sudo docker kill `sudo docker ps --no-trunc -a -q`
echo "stopping containers"
@barata0
barata0 / log4j.properties
Created August 13, 2015 21:26
console and rolling file appender for a log4j.properties file
log4j.debug=true
# Set root category priority to INFO and its only appender to CONSOLE.
log4j.rootCategory=TRACE, CONSOLE, ROLLINGFILE
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%6.6r]%m%n
@barata0
barata0 / gist:5357749
Created April 10, 2013 19:36
List all Domain Classes without a Controller in GRAILS
import static groovy.io.FileType.FILES
def appFolderName = 'C:/Users/me/grails-base-folder/'
def appFolder = new File(appFolderName)
def domainFolder = new File(appFolder, "grails-app/domain")
def controllersFolder = new File(appFolder, "grails-app/controllers")
def listAllGroovyFiles(folder) {
@barata0
barata0 / .hgignore
Created April 24, 2013 02:26
hgignore for grails project
syntax: glob
*.bat
*tmp
*~
*\#
*ori
data/*
target/*
devDb
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@barata0
barata0 / Dockerfile
Created November 5, 2013 20:17
lxc-docker ubuntu oracle-java7-jdk
#
#Oracle JDK installation
#
FROM ubuntu:precise
MAINTAINER Daniel Ribeiro <danieltribeiro@gmail.com>
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update && apt-get -y install python-software-properties
@barata0
barata0 / Dockerfile
Created November 6, 2013 16:49
lxc-docker ubuntu tomcat7 apt-get install with oracle-java7-jdk
#
# Apache Tomcat7 installation
#
FROM danieltribeiro/oracle-java7-jdk
MAINTAINER Daniel Ribeiro <danieltribeiro@gmail.com>
RUN apt-get update
RUN apt-get -y install tomcat7
@barata0
barata0 / sha256base64.groovy
Created April 5, 2016 22:41
generate a SHA256 encoded as Base64
@Grapes(
@Grab(group='commons-codec', module='commons-codec', version='1.10')
)
import java.security.*
import java.util.Base64;
def file = new File('c:/users/danielr/Downloads/mortalkombat.mp4')
FileInputStream fis = new FileInputStream(file);
def md5 = org.apache.commons.codec.digest.DigestUtils.sha256(fis);
fis.close()
println md5
@barata0
barata0 / sub-directories-size-linux
Created April 11, 2016 14:42
sub directories size in linux
du -h --max-depth=1
@barata0
barata0 / elasticsearch-reindex.groovy
Created June 15, 2016 17:51
Elasticsearch reindex groovy script. Read from oldServer/oldIndex/oldType/ and saves it on newServer/newIndex/newType
/*
* Reindex elasticsearch
* Read all documents from oldServer/oldIndex/oldType and put them into newServer/newIndex/newtype
* If the newIndex raises an error script will print and stop
*/
/* Configuration START */
// OLD Server config - READ_ONLY
def oldServer = "http://localhost:9200"