Skip to content

Instantly share code, notes, and snippets.

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

Yann ROBERT YannRobert

🏠
Working from home
  • Paris, France
View GitHub Profile
@YannRobert
YannRobert / sendsoap.sh
Last active August 29, 2015 13:56
poor man's soap client for sepamail webservice
#!/bin/sh
export WS_SERVER=skemqxqxxxx.test.sepamail.eu
#export WS_SERVER=sogefrp0.test.sepamail.eu
#export WS_SERVER=bpcefrppxxx.test.sepamail.eu
#export WS_SERVER=bnpafrppxxx.test.sepamail.eu
#export WS_SERVER=cmcifrpaxxx.test.sepamail.eu
## you should provide a file containing a valid SOAP request
@YannRobert
YannRobert / RxJavaBufferWithTimespanBugTest.java
Last active August 29, 2015 14:09
shows that the usage of 2 RxJava buffers with both a timespan and a count will eventually make the events be emitted at a very slow rate to the subscriber
package rxjava.issue;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
import rx.functions.Func1;
@YannRobert
YannRobert / BufferMayProduceDuplicatesTest.java
Created November 19, 2014 18:22
RxJava Test demonstrating an issue (duplicate emitions) when using delay(duration) in combination with buffer(count, duration)
package rxjava.issue;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;
import rx.functions.Action1;
import java.util.List;
@YannRobert
YannRobert / LoggregatorLoadTestController.java
Last active August 29, 2015 14:13
LGR "Log message output too high. We've dropped 100 messages" investigation
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.annotation.Nullable;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.nio.charset.Charset;
/**
* <p>Provides Base32 encoding and decoding as defined by <a href="http://www.ietf.org/rfc/rfc4648.txt">RFC 4648</a>.
* However it uses a custom alphabet first coined by Douglas Crockford. Only addition to the alphabet is that 'u' and
* 'U' characters decode as if they were 'V' to improve mistakes by human input.<p/>
* <p>
* This class operates directly on byte streams, and not character streams.
* </p>
*
import java.nio.charset.Charset;
/**
* <p>Provides Base32 encoding and decoding as defined by <a href="http://www.ietf.org/rfc/rfc4648.txt">RFC 4648</a>.
* However it uses a custom alphabet first coined by Douglas Crockford. Only addition to the alphabet is that 'u' and
* 'U' characters decode as if they were 'V' to improve mistakes by human input.<p/>
* <p>
* This class operates directly on byte streams, and not character streams.
* </p>
*
@YannRobert
YannRobert / IssueInRxJavaDefensiveCodeTest.java
Created March 30, 2015 13:06
Does the defensive code in RxJava "merge" operator could be improved?
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import rx.Observable;
import rx.Observer;
import rx.subjects.PublishSubject;
import rx.subjects.Subject;
import java.util.concurrent.CountDownLatch;
@YannRobert
YannRobert / named.conf
Created July 3, 2015 13:05
named.conf for a forwarding only naming server (to be used as the nameserver by localhost, in order to cache queries)
//
// named.conf
//
options {
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
#!/bin/sh
set -e
set -x
dnf install -y fail2ban
curl -O https://get.docker.com/rpm/1.7.1/fedora-22/RPMS/x86_64/docker-engine-1.7.1-1.fc22.x86_64.rpm
rpm -i ./docker-engine-1.7.1-1.fc22.x86_64.rpm
import com.rabbitmq.client.ConnectionFactory;
import org.junit.Test;
public class ConnectionFactorySettersTest {
// considering the default value for handshakeTimeout is 10000 and the default value for connectionTimeout is 0
// this test is failing
// if we set the connectionTimeout to a higher value than the default value of handshakeTimeout, the test will fail