Skip to content

Instantly share code, notes, and snippets.

View andrefabbro's full-sized avatar
🏠
Working from home

André Fabbro andrefabbro

🏠
Working from home
View GitHub Profile
{
init: function(elevators, floors) {
var availables = [];
var callingFloorsUp = [];
var callingFloorsDown = [];
elevators.forEach(function(elevator) {
elevator.goingUpIndicator(false);
elevator.goingDownIndicator(false);
@andrefabbro
andrefabbro / Ruby - Execute SQL
Last active June 12, 2017 16:46
Scripts Liferay Control Panel
QUERY = "select * from Role_ where roleid IN (17,18)"
MAX_ROWS = 100
# Implementation
java_import java.io.PrintStream
java_import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayOutputStream
java_import com.liferay.portal.kernel.dao.jdbc.DataAccess
if $out.class == UnsyncByteArrayOutputStream # Fix for Liferay version < 6.0.11
@andrefabbro
andrefabbro / thread-dump.sh
Created November 28, 2017 13:12
Extrai 10 thread dumps a cada 5 segundos
#!/bin/bash
# executar enviando o codigo do processo,
# exemplo: ps aux | grep java
# chamada: ./thread-dump.sh <pid>
# deve ser executado com o mesmo usuario dono do processo,
# su -p -s /bin/sh jboss -c ./thread-dump.sh <pid>
[ -z $pid ] && echo "Informe o pid do processo java" && exit 1
@andrefabbro
andrefabbro / rebuild-dl-from-filelist.sh
Created December 12, 2018 17:08
Generate Document Library From Text File
#!/bin/bash
#
# Generate the Source file using: find -type f > filelist.txt
#
if [ $# -lt 1 ];
then
echo "Usage: $0 dl-filelist.txt [placeholder]"
else