Skip to content

Instantly share code, notes, and snippets.

View jettro's full-sized avatar

Jettro Coenradie jettro

View GitHub Profile
@jettro
jettro / access_log
Created November 27, 2024 09:19
Play around with ES|QL in Elasticsearch
127.0.0.1 - frank [10/Oct/2024:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
127.0.0.1 - john [10/Oct/2024:14:00:10 -0700] "POST /login HTTP/1.1" 302 512
192.168.0.1 - mary [10/Oct/2024:14:01:55 -0700] "GET /dashboard HTTP/1.1" 200 1034
203.0.113.1 - jane [10/Oct/2024:14:03:22 -0700] "GET /products HTTP/1.1" 200 2048
127.0.0.1 - frank [10/Oct/2024:14:04:45 -0700] "GET /logout HTTP/1.0" 200 324
203.0.113.3 - mary [10/Oct/2024:14:10:13 -0700] "POST /cart/add HTTP/1.1" 201 256
192.168.0.2 - sam [10/Oct/2024:14:15:40 -0700] "GET /profile HTTP/1.1" 200 875
127.0.0.1 - frank [10/Oct/2024:14:18:10 -0700] "GET / HTTP/1.0" 200 1280
198.51.100.4 - john [10/Oct/2024:14:20:04 -0700] "POST /checkout HTTP/1.1" 500 132
127.0.0.1 - jane [10/Oct/2024:14:25:55 -0700] "GET /images/logo.png HTTP/1.0" 200 1502
@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;
/**