This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changeVolume(diff) | |
return function() | |
local current = hs.audiodevice.defaultOutputDevice():volume() | |
local new = math.min(100, math.max(0, math.floor(current + diff))) | |
if new > 0 then | |
hs.audiodevice.defaultOutputDevice():setMuted(false) | |
end | |
hs.alert.closeAll(0.0) | |
hs.alert.show("Volume " .. new .. "%", {}, 0.5) | |
hs.audiodevice.defaultOutputDevice():setVolume(new) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE nutrition | |
PUT nutrition/foo/_bulk | |
{ "index" : {} } | |
{ "calories" : 100, "name" : "Chips", "category" : "a" } | |
{ "index" : {} } | |
{ "calories" : 200, "name" : "Thick Chip", "category" : "a" } | |
{ "index" : {} } | |
{ "calories" : 300, "name" : "Marzipan", "category" : "b" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE foo | |
PUT /foo/bar/_bulk | |
{ "index" : { "_id" : "alex" } } | |
{ "name" : "Alex" } | |
{ "index" : { "_id" : "bert" } } | |
{ "name" : "Bert" } | |
{ "index" : {"_id" : "caesar" } } | |
{ "name" : "Caesar" } | |
{ "index" : {"_id" : "dagobert" } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE _all | |
PUT _ingest/pipeline/rename_hostname | |
{ | |
"processors": [ | |
{ | |
"rename": { | |
"field": "hostname", | |
"target_field": "host", | |
"ignore_missing": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE _all | |
GET index/_mapping | |
PUT index | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"my_analyzer": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST _ingest/pipeline/_simulate | |
{ | |
"pipeline" : { | |
"description": "A pipeline to do named entity extraction", | |
"processors": [ | |
{ | |
"script": { | |
"lang": "painless", | |
"inline": "ctx.params = [:] ; /&/.splitAsStream(ctx.x).forEach(pair -> { def x = /=/.split(pair); ctx.params[x[0]] = x[1]; })" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Colorful output, if you are on the console only | |
#appender.console.layout.pattern = %highlight{[%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n} | |
appender.console.layout.pattern = %style{[%d{ISO8601}]}{cyan}%style{[%-5p]}{magenta}%style{[%-25c{1.}]}{green} %marker%m%n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE /hotels | |
POST /hotels/hotel/_bulk | |
{ "index" : { "_id" : 1 }} | |
{ "features": [ "wifi", "parking" ], "stars" : 1 } | |
{ "index" : { "_id" : 2 }} | |
{ "features": [ "pool", "parking" ], "stars" : 4 } | |
{ "index" : { "_id" : 3 }} | |
{ "features": [ "wifi", "pool" ], "stars" : 5 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var _ = require('lodash') | |
var request = require('request') | |
var cheerio = require('cheerio') | |
var ProgressBar = require('progress'); | |
var printf = require('printf'); | |
var presentations = [] | |
var data = fs.readFileSync('urls.txt', { encoding: 'UTF-8' }).split("\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# log levels | |
elasticsearch rule /\[INFO(\s*)]/ --> green match | |
elasticsearch rule /\[ERROR(\s*)]/ --> red match | |
elasticsearch rule /\[DEBUG(\s*)]/ --> yellow match | |
elasticsearch rule /\[TRACE(\s*)]/ --> yellow match | |
elasticsearch rule /\[WARN(\s*)]/ --> yellow match | |
# events | |
elasticsearch rule " new_master " --> bold cyan match | |
elasticsearch rule " added " --> bold cyan match |