Skip to content

Instantly share code, notes, and snippets.

Rafael Rocha rafarocha

View GitHub Profile
@rafarocha
rafarocha / .log
Created May 22, 2018
lnav crash strftime function
View .log
2018-05-22T09:33:21.834 D logfile.cc:220 /home/rocha/logs/log_dmz/access_log-20180503:526759: out-of-time-order line detected 1525293281.000 < 1525293286.000
2018-05-22T09:33:21.834 D logfile.cc:220 /home/rocha/logs/log_dmz/access_log-20180503:526765: out-of-time-order line detected 1525293289.000 < 1525293290.000
2018-05-22T09:33:21.834 D logfile.cc:220 /home/rocha/logs/log_dmz/access_log-20180503:526766: out-of-time-order line detected 1525293281.000 < 1525293290.000
2018-05-22T09:33:21.834 D logfile.cc:220 /home/rocha/logs/log_dmz/access_log-20180503:526774: out-of-time-order line detected 1525293257.000 < 1525293292.000
2018-05-22T09:33:21.834 D logfile.cc:220 /home/rocha/logs/log_dmz/access_log-20180503:526776: out-of-time-order line detected 1525293245.000 < 1525293292.000
2018-05-22T09:33:21.834 D logfile.cc:220 /home/rocha/logs/log_dmz/access_log-20180503:526782: out-of-time-order line detected 1525293293.000 < 1525293294.000
2018-05-22T09:33:21.834 D logfile.cc:220 /home/rocha/logs/log_dmz/access_lo
@rafarocha
rafarocha / Main.java
Last active Aug 19, 2016
Testando indicadores de ponto de pedido
View Main.java
package indicadores;
public class Main {
public static double PesoCurvaA = 0.8, PesoCurvaB = 0.15, PesoCurvaC = 0.05;
public static double PesoNivelR = 1, PesoNivelM = 3, PesoNivelZ = 5;
/*
* problemas
@rafarocha
rafarocha / npm-debug.log
Created Jun 2, 2016
ionic project 2 conference app - npm install on linux ubuntu
View npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'install' ]
2 info using npm@1.3.10
3 info using node@v0.10.25
4 verbose readDependencies using package.json deps
5 verbose install where, deps [ '/home/rocha/projects/bitbucket/ionic-conference-app',
5 verbose install [ '@angular/common',
5 verbose install '@angular/compiler',
5 verbose install '@angular/core',
5 verbose install '@angular/http',
@rafarocha
rafarocha / docker-log.md
Last active May 20, 2016
docker build problem apt-get update
View docker-log.md

Problema

  • Não consigo fazer um build de um Dockerfile por conta do apt-get update, mesmo configurando o proxy
  • Proxy local configurado e arquivo /etc/default/docker

Realizar os seguintes passos

  1. git clone https://github.com/camptocamp/docker-puppet-agent.git
  2. cd docker-puppet-agent
  3. docker build -t puppet-agent .
View gist:a4092ff59636df4e0443114895dc8c2a
package sample.titan;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
View TitanGraphTest.java
import org.junit.Before;
import org.junit.Test;
import com.thinkaurelius.titan.core.TitanGraph;
import com.tinkerpop.frames.FramedGraph;
import com.tinkerpop.frames.FramedGraphFactory;
import com.tinkerpop.frames.domain.classes.Person;
import com.tinkerpop.frames.modules.gremlingroovy.GremlinGroovyModule;
public class TitanGraphTest {
@rafarocha
rafarocha / es-docker-fail
Created Feb 15, 2016
fail elasticsearch with docker
View es-docker-fail
nobody@7efd564ba694:/elasticsearch/bin$ ./elasticsearch -d
nobody@7efd564ba694:/elasticsearch/bin$ log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /data/log/elasticsearch.log (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
View git_tips.md

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo
@rafarocha
rafarocha / TemplatePostSemanticError.java
Last active Aug 29, 2015
Como tratar erro semântico com inclusão de informações adicionais. Caso em que o cliente deseja retornar a pessoa com campos adicionais
View TemplatePostSemanticError.java
public PessoaFisica salvar(PessoaFisica pessoa) {
PessoaFisicaId id = null;
try{
// em caso status code 201, o core preenche o nit e digio
id = broker.salvar( pessoa );
} catch(ClientBusinessException e ) {
ErroSemantico erro = e.get("PESSOA_JA_EXISTE");
if ( erro == null ) {
throw new ExcecaoNegocio(); // por exemplo nacionalidade invalida
}
@rafarocha
rafarocha / RestfullClient.java
Last active Aug 29, 2015
Rascunho de desenho para evolução na usabilidade do cliente
View RestfullClient.java
// isso é apenas uma idéia para discussão aberta e democrática
Configuration conf = new PropertyConfiguration( properties );
Request request = RequestModel.get( "produtos", Parameters.of(offset(5), limit(10)) );
Future<PaginationList<Produto>> future = Restfull .define( conf ) .at( request ). execute( new Callback() {
onSucess(PaginationList<Produtos> produtos) {
}
onFailure(ClientException e) {
You can’t perform that action at this time.