Skip to content

Instantly share code, notes, and snippets.

View ebuildy's full-sized avatar
🌴
A Montréal - hey bière ??

Thomas Decaux ebuildy

🌴
A Montréal - hey bière ??
View GitHub Profile
import com.zaxxer.hikari.HikariDataSource;
import org.apache.hadoop.hbase.thrift.generated.BatchMutation;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
public class Test
@ebuildy
ebuildy / Dockerfile
Created January 25, 2016 10:25
Install Php 7 with MongoDB driver on Docker from Ubuntu trusty base image.
FROM ubuntu:trusty
ENV HOME /root
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
RUN add-apt-repository ppa:ondrej/php && \
apt-get update
$connection = new AMQPConnection([
'host' => 'queue',
'port' => 5672,
'login' => 'guest',
'password' => 'guest'
]);
$connection->connect();
$channel = new AMQPChannel($connection);
@ebuildy
ebuildy / gist:72fade2e26dea91256d6
Last active February 29, 2016 13:48
Bug elasticsearch: "match uses the wrong field"
#!/usr/bin/env bash
docker run -tid -p 9200:9200 elasticsearch:1.7.3
sleep 5
ES_URI="http://192.168.99.100:9200"
curl -XDELETE ${ES_URI}/test
logstash_1 | {:timestamp=>"2016-03-29T19:24:36.994000+0000", :message=>"Connecting to RabbitMQ. Settings: {:vhost=>\"/\", :host=>\"rabbit\", :port=>5672, :user=>\"guest\", :automatic_recovery=>true, :pass=>\"guest\", :timeout=>0, :heartbeat=>0}", :level=>:debug, :file=>"logstash/plugin_mixins/rabbitmq_connection.rb", :line=>"138", :method=>"connect"}
rabbit |
rabbit | =INFO REPORT==== 29-Mar-2016::19:24:37 ===
rabbit | accepting AMQP connection <0.402.0> (172.17.0.3:57646 -> 172.17.0.2:5672)
logstash_1 | {:timestamp=>"2016-03-29T19:24:37.089000+0000", :message=>"Connected to RabbitMQ at rabbit", :level=>:info, :file=>"logstash/plugin_mixins/rabbitmq_connection.rb", :line=>"145", :method=>"connect"}
logstash_1 | {:timestamp=>"2016-03-29T19:24:37.129000+0000", :message=>"Declaring exchange 'amq.fanout' with type fanout", :level=>:info, :file=>"logstash/inputs/rabbitmq.rb", :line=>"196", :method=>"bind_exchange!"}
logstash_1 | {:timestamp=>"2016-03-29T19:24:37.130000+0000", :message=>"Declaring an ex
@ebuildy
ebuildy / "name" differences
Last active April 21, 2016 19:06
Logstash useragent filter, difference between old and new implementation.
# Apache Drill SQL query:
SELECT DISTINCT t1.name || t2.name, t1.name, t2.name,t2.type FROM dfs.tmp.`output1.json` t1 JOIN dfs.tmp.`output2.json` t2 ON t1.id = t2.id WHERE t1.name <> t2.name;
# Results
+-----------------------------+--------------------+--------------------+-------------------+
| EXPR$0 | name | name0 | type |
+-----------------------------+--------------------+--------------------+-------------------+
| OtherUnknown | Other | Unknown | unknown |
@ebuildy
ebuildy / MyContainerPass.php
Created July 28, 2016 10:18
Manipulate container with Reflection
class MyContainerPass implements CompilerPassInterface
{
/**
* @see Symfony\Component\DependencyInjection\Compiler.CompilerPassInterface::process()
*/
public function process(ContainerBuilder $container)
{
foreach($container->getServiceIds() as $id)
{
// Filter services by ID starting by "report."
{
"date" : "12:15:30 10/10/2026",
"program" : "api",
"hash" : "4OF4OFJ34OFJ34OFJ3LJ",
"file" : "./toto.php",
"line" : 56,
"version" : "v2"
}
{
"size": 0,
"query": {
"query_string": {
"query": "name:error"
}
},
"aggs": {
"dup": {
"terms": {
<?php
/**
* A simple Php script to remove duplicates content from elasticsearch (> 2.0)
* Usage:
* php remove_dup.php HOST INDEX(/TYPE) QUERY_STRING FIELD REFRESH_TIMEOUT
*
* This script uses terms aggregation > top_hits to retrieve duplicates then bulk delete document by id.
*
* <!> Very long because we have to wait refresh_interval seconds before new search <!>