Skip to content

Instantly share code, notes, and snippets.

Eduardo eduardocl

  • Serpro
  • Brasil
Block or report user

Report or block eduardocl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eduardocl
eduardocl / Log Programatico
Last active Dec 3, 2018
Classe para Criar um Log programaticamente
View Log Programatico
Adicionar no pom:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
View Build local maven repo
mvn install:install-file -Dfile=./lib/axis.jar -DgroupId=local-deps -DartifactId=axis -Dversion=local -Dpackaging=jar -DlocalRepositoryPath=./lib/repo
mvn install:install-file -Dfile=./lib/commons-logging-1.0.2.jar -DgroupId=local-deps -DartifactId=commons-logging -Dversion=local -Dpackaging=jar -DlocalRepositoryPath=./lib/repo
mvn install:install-file -Dfile=./lib/ejb3-persistence.jar -DgroupId=local-deps -DartifactId=ejb3-persistence -Dversion=local -Dpackaging=jar -DlocalRepositoryPath=./lib/repo
View ECLRunner.java
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
public class ECLRunner extends BlockJUnit4ClassRunner {
private Integer testsLeft;
@eduardocl
eduardocl / xml.rb
Last active Apr 20, 2016
Saving documents in xml
View xml.rb
desc "Salva arquivos em xml"
task :export => :environment do
require 'builder'
docs = Document.all
index = 1
docsarray = []
docs.each do |doc|
docsarray.push(doc)
if docsarray.size % 1000 == 0
save_xml("documents-rkb-" + index.to_s, docsarray)
View mavenizer.py
# -*- coding: utf-8 -*-
__author__ = "Eduardo Lopes"
__copyright__ = "Copyright 2014, Planeta Terra"
__license__ = "Use por conta e risco"
__version__ = "0.1-beta-bem-beta"
__status__ = "mais ou menos em Production"
import os
import sys
View parseclasspath.py
from xml.dom import minidom
xmldoc = minidom.parse('.classpath')
itemlist = xmldoc.getElementsByTagName('classpathentry')
for s in itemlist :
print s.attributes['path'].value
View contar.py
import os
import subprocess
def executar(str):
''' Executa um comendo no shell retornando o stdout '''
args = str.split(' ')
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
return out
@eduardocl
eduardocl / gist:7007046
Last active Dec 25, 2015
Executando expressões lógicas criadas dinamicamente em java através da execução de um código javascript dentro do código java.
View gist:7007046
ScriptEngineManager mgr = new ScriptEngineManager();
String expression = "if( (((((4 == 1) && 'USER_ID' != '1') && 'ON_GOING' == 'ON_GOING') || 1381374000000 != 1381374000000)){ resut = true ; } else { result = false; }"
ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");
boolean result = false;
try {
result = (Boolean) jsEngine.eval(expression);
View gist:6131013
describe "#list" do
it "list attribute as ruby object" do
attrs = @controller.list_attributes
attrs.each do |a|
a.should be_an_instance_of Attribute
end
end
it "list attribute in xml format" do
xml = @controller.list_attributes(:xml)
View gist:3034828
capacidade.turma=10
usuario=secretaria
senha=segredo
papel=admin
You can’t perform that action at this time.