Skip to content

Instantly share code, notes, and snippets.

Avatar
💻

Alexander Reelsen spinscale

💻
View GitHub Profile
@spinscale
spinscale / kibana.snippets
Created Jun 4, 2020
Elasticsearch - Hands-on Introduction (2020-06, DevClash)
View kibana.snippets
###################################
## Introduction to Elasticsearch ##
###################################
#########################
## If you do not want to run Elasticsearch yourself
## Test a free 14 day trial at
## https://www.elastic.co/cloud/
#########################
@spinscale
spinscale / sample.json
Created Mar 4, 2020
Percolator example (training MUC)
View sample.json
DELETE back_in_stock_notifications
DELETE test
PUT test/_bulk?refresh
{ "index" : { "_id" : "1"}}
{ "id": "1", "title" : "T-Shirt", "size" : "XL", "color": "red", "stock" : 0 }
{ "index" : { "_id" : 2}}
{ "id": "2", "title" : "T-Shirt", "size" : "XL", "color": "green", "stock" : 1 }
{ "index" : { "_id" : 3}}
{ "id": "3", "title" : "T-Shirt", "size" : "XL", "color": "yellow", "stock" : 2 }
@spinscale
spinscale / test.sh
Created Feb 28, 2020
Crystal webserver dumping all HTTP requests headers/bodies
View test.sh
crystal eval 'port = 8080 ; require "http/server"; server = HTTP::Server.new do |ctx| req = ctx.request; req.to_io STDOUT ; STDOUT.print "\n\n" if req.body end ; server.listen 8080'
@spinscale
spinscale / sample.json
Created Feb 18, 2020
Inference processor with language identification
View sample.json
POST _ingest/pipeline/_simulate?filter_path=**.predicted_value
{
"pipeline": {
"processors": [
{
"inference": {
"model_id": "lang_ident_model_1",
"inference_config": { "classification": {}},
"field_mappings": {}
}
@spinscale
spinscale / filebeat.yml
Created Feb 14, 2020
Use filebeat to read CSV data
View filebeat.yml
# Data is from https://www.sciencedirect.com/science/article/pii/S2352340918315191
filebeat.inputs:
- type: stdin
setup.template.overwrite: true
setup.template.append_fields:
- name: arrival_date
type: date
@spinscale
spinscale / snippets.kibana
Last active Mar 31, 2020
The hidden gems of Elasticsearch - Kibana Snippets
View snippets.kibana
# date_range datatype
PUT range_index
{
"mappings": {
"properties": {
"time_frame": { "type": "date_range" }
}
}
}
@spinscale
spinscale / logstash-meetup.conf
Created Jun 20, 2018
logstash meetup.com stream
View logstash-meetup.conf
# curl -s http://stream.meetup.com/2/rsvps | ./bin/logstash -f logstash-meetup.conf
input {
stdin {
codec => json_lines
}
}
# the lonlat array is needed for the map widget in kibana to work
# so we have to work a bit around the supplied data
filter {
@spinscale
spinscale / init.lua
Created May 16, 2018
hammerspoon - german umlauts on us keyboard
View init.lua
-- Umlaute without the hassle, hell yeah
hs.hotkey.bind({'alt'}, 'u', function ()
hs.eventtap.keyStrokes('ü')
end)
hs.hotkey.bind({'shift', 'alt'}, 'u', function ()
hs.eventtap.keyStrokes('Ü')
end)
hs.hotkey.bind({'alt'}, 'a', function ()
@spinscale
spinscale / training-examples.json
Created Dec 14, 2017
Training Examples (Zurich)
View training-examples.json
##### decompounder example
DELETE decompound
PUT decompound
{
"settings": {
"analysis": {
"analyzer": {
"my_decompound_analyzer" : {
"type" : "custom",
@spinscale
spinscale / example.json
Created Oct 12, 2017
Training Copenhagen: Stored fields example
View example.json
DELETE sample
PUT sample
{
"mappings": {
"foo" : {
"_source": { "enabled": false },
"properties": {
"my_field" : {
"type": "text",
You can’t perform that action at this time.