Skip to content

Instantly share code, notes, and snippets.

View jettro's full-sized avatar

Jettro Coenradie jettro

View GitHub Profile
@jettro
jettro / TryHyphenation.java
Last active November 3, 2019 21:13
Class to play around with Lucene HyphenationCompoundWordTokenFilter without booting an elasticsearch cluster. Want to see what happens to the hyphens and the found tokens with different setups and strings.
package com.klm.mysearch;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.compound.HyphenationCompoundWordTokenFilter;
import org.apache.lucene.analysis.compound.hyphenation.Hyphenation;
import org.apache.lucene.analysis.compound.hyphenation.HyphenationTree;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.junit.Ignore;
import org.slf4j.Logger;
@jettro
jettro / conda.zsh
Last active September 25, 2020 00:49
custom plugins for oh-my-zsh
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/jettrocoenradie/Development/anaconda/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/jettrocoenradie/Development/anaconda/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/jettrocoenradie/Development/anaconda/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
@jettro
jettro / import signal media news into logstash
Last active October 31, 2017 07:57
Example configs to import the Signal Media News dataset into elasticsearch using logstash
curl -XGET "http://localhost:9200/signalmedia/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"match": {
"content": "rain"
}
},
"aggs": {
"my_sampler": {
"sampler": {
#!/usr/bin/env bash
curl "localhost:9200/crowdcontrol/_search?pretty&search_type=count" -d '{
"query": {
"term": {"roomId":"foyer"}
},
"aggs": {
"byRoom": {
"terms": {
"field":"roomId"
@jettro
jettro / all commands
Created March 13, 2014 10:41
Checking filtered query
curl -XDELETE "http://localhost:9200/test_max_expansions"
curl -XPUT 'http://localhost:9200/test_max_expansions' -d '
{
"settings": {
"number_of_replicas": 0,
"number_of_shards": 1
},
"mappings": {
"posts" : {
@jettro
jettro / ChatMessageInbound.java
Created July 14, 2013 17:38
This gist describes a web project that makes use of Tomcat features to create a WebSocket sample
package wsapp;
import org.apache.catalina.websocket.MessageInbound;
import org.apache.catalina.websocket.WsOutbound;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
/**