Skip to content

Instantly share code, notes, and snippets.

Thomas Decaux ebuildy

Block or report user

Report or block ebuildy

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
@ebuildy
ebuildy / setupTest.js
Created Feb 27, 2019
Async React component testing with jest & enzyme
View setupTest.js
import { shallow, mount, configure, render } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import waitUntil from 'async-wait-until';
configure({ adapter: new Adapter() });
global.exceptRenderFine = async (component) => {
// full mount the component (shallow can work and will be faster)
const root = mount(component)
@ebuildy
ebuildy / build.gradle
Last active Jan 23, 2019
Gradle task to create release note
View build.gradle
plugins {
...
id "org.ajoberstar.grgit" version "3.0.0"
}
task createReleaseReportFile() {
doLast {
file("$projectDir/src/main/resources/release_note.properties").text = """## Automated generated by Gradle ##
@ebuildy
ebuildy / README.md
Last active Jan 22, 2019
Simple & pure JS sticky
View README.md

Will stick vertically element with class "sticky-item".

Usage is for Table > sticky cells, so this code check element left to create sticky groups.

View StringBuffer.java
public void setLength(int newLength) {
if (newLength < 0)
throw new StringIndexOutOfBoundsException(newLength);
ensureCapacityInternal(newLength);
if (count < newLength) {
Arrays.fill(value, count, newLength, '\0');
}
count = newLength;
@ebuildy
ebuildy / kafka.feature
Created Oct 29, 2018
Python Behave steps to func test Apache Kafka
View kafka.feature
Scenario: send JSON to Kafka with Spark
Given kafka topic
When I run pipeline "output_kafka_spark.yml"
Then I must see 3 messages from kafka
@ebuildy
ebuildy / ElasticsearchMockClient.java
Last active Oct 1, 2018
elasticsearch mockup server
View ElasticsearchMockClient.java
package com.qwant.datahub.djobi.test;
import org.json.JSONArray;
import org.json.JSONObject;
import org.mockserver.client.server.MockServerClient;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
import org.mockserver.verify.VerificationTimes;
import java.util.ArrayList;
@ebuildy
ebuildy / 1st try
Last active Sep 17, 2018
strace of couchbase moxi proxy - 3 nodes cluster - "GET test_1" operation
View 1st try
[pid 219] accept(41, {sa_family=AF_INET, sin_port=htons(45182), sin_addr=inet_addr("192.168.160.1")}, [16]) = 43
[pid 219] sendto(32, "\0", 1, 0, NULL, 0) = 1
[pid 273] recvfrom(31, "\0", 1, 0, NULL, NULL) = 1
[pid 273] recvfrom(43, "\200\r\0\6\0\0\0\0\0\0\0\6\0\1\0\0\0\0\0\0\0\0\0\0test_1\200\n\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0", 2048, 0, NULL, NULL) = 54
[pid 273] socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 51
[pid 273] connect(51, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.11")}, 16) = 0
[pid 273] sendmmsg(51, {{{msg_name(0)=NULL, msg_iov(1)=[{"\240o\1\0\0\1\0\0\0\0\0\0\7server3\3poc\0\0\1\0\1", 29}], msg_controllen=0, msg_flags=0}, 29}, {{msg_name(0)=NULL, msg_iov(1)=[{"\274\345\1\0\0\1\0\0\0\0\0\0\7server3\3poc\0\0\34\0\1", 29}], msg_controllen=0, msg_flags=0}, 29}}, 2, MSG_NOSIGNAL) = 2
[pid 273] recvfrom(51, "\274\345\201\200\0\1\0\0\0\0\0\0\7server3\3poc\0\0\34\0\1", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.
@ebuildy
ebuildy / search.json
Last active Apr 16, 2018
Calcul cumulative sum metric (such as elasticearch node stat query_total) difference between 2 timestamps.
View search.json
{
"source" : {
"size": 0,
"query": {
"query_string": {
"query": "@timestamp:[{{start_date}}:00+02:00 TO {{end_date}}:59+02:00] AND data.attributes.master:false"
}
},
"aggs": {
"nodes": {
@ebuildy
ebuildy / README.md
Created Feb 6, 2018
Use Socat to support multiple backend with jwilder/nginx-proxy
View README.md

Problem from https://github.com/jwilder/nginx-proxy/issues/59, you cannot setup multiple backend for one container.

The solution here, is to use socat as an HTTP proxy.

My use case is "I setup a Apache Spark cluster, I want to access to web UI of master and worker".

@ebuildy
ebuildy / DateTimeType.php
Created Jan 22, 2018
Symfony DateTime form type, with 2 text input widgets
View DateTimeType.php
<?php
namespace App\Core\Form\Type;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\Extension\Core\Type\TextType;
You can’t perform that action at this time.