Skip to content

Instantly share code, notes, and snippets.

package com.hopwork.hopsearch;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan(value = {"com.hopwork", "com.lateralthoughts"})
public class HopSearchEnabledCondition implements Condition {
@Override
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
PropertyResolver resolver = conditionContext.getEnvironment();
// renvoie toujours null, les propriétés ne sont jamais résolus
return "true".equalsIgnoreCase(resolver.getProperty("hopsearch.enabled"));
}
}
@hlassiege
hlassiege / gist:179866de70c3d8d992ab
Created June 1, 2014 16:55
Nginx configuration for kibana
server {
listen 80;
server_name A.com;
root /var/www/kibana;
# Set image format types to expire in a very long time
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires max;
}
@hlassiege
hlassiege / Blob.java
Created November 20, 2013 14:59
Store image in database instead of disk with Play Framework
package database;
import java.io.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.UUID;
import org.apache.commons.io.IOUtils;
@hlassiege
hlassiege / gist:5383739
Last active December 16, 2015 05:19
nGram test
curl -X DELETE localhost:9200/test
curl -X PUT localhost:9200/test -d '
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"myanalyzer" : {
"type" : "custom",
"tokenizer" : "lowercase",