This file contains 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
const memoryCronJob = new CronJob("* * * * * *", async () => { | |
const formatMemoryUsage = (data : number) => `${Math.round(data / 1024 / 1024 * 100) / 100} MB`; | |
const memoryData = process.memoryUsage(); | |
const memoryUsage = { | |
rss: `${formatMemoryUsage(memoryData.rss)} -> Resident Set Size - total memory allocated for the process execution`, | |
heapTotal: `${formatMemoryUsage(memoryData.heapTotal)} -> total size of the allocated heap`, | |
heapUsed: `${formatMemoryUsage(memoryData.heapUsed)} -> actual memory used during the execution`, | |
external: `${formatMemoryUsage(memoryData.external)} -> V8 external memory`, |
This file contains 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 kubens() { | |
ns=$(kubectl get ns | awk '{ print $1 }' | grep -v '^NAME$' | fzf) | |
kubectl config set-context --current --namespace=$ns | |
} |
This file contains 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
# autobahn-api-to-es | |
# | |
# Indexes autobahn API metadata into Elasticsearch to use it with Kibana Maps | |
# | |
# Original API description https://gist.github.com/LilithWittmann/06bd153317b635e7b622651f5cfd95ea | |
# | |
# | |
# MIT License | |
# | |
# Copyright (c) [2021] |
This file contains 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
exec: /app/openpixel-sqlite-tracker/bin/openpixel-sqlite-tracker | |
dbs: | |
- path: /tmp/sqlite.db | |
replicas: | |
- type: s3 | |
region: eu-central-1 | |
bucket: THE_BUCKET | |
path: /db | |
access-key-id: AWS_ACCESS_KEY_ID |
This file contains 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 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
################## | |
# Runtime fields # | |
################## | |
GET / | |
DELETE orders | |
PUT orders | |
{ |
This file contains 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
# 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 |
This file contains 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
package de.spinscale.prt; | |
import org.apache.lucene.analysis.custom.CustomAnalyzer; | |
import org.apache.lucene.analysis.phonetic.PhoneticFilterFactory; | |
import org.apache.lucene.search.suggest.FileDictionary; | |
import org.apache.lucene.search.suggest.Lookup; | |
import org.apache.lucene.search.suggest.analyzing.AnalyzingSuggester; | |
import org.apache.lucene.store.Directory; | |
import org.apache.lucene.store.NIOFSDirectory; | |
import org.junit.jupiter.api.Test; |
This file contains 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
################################################### | |
## Boosting scores based on numeric field values ## | |
################################################### | |
# Existing solution: function_score query | |
# Problem: Performance penalty | |
# Solution: Rescoring, only rescoring top-n documents | |
# Lucene optimization in Elasticsearch 7: Block MAX WAND | |
# New query: distance_feature, efficiently skips non-competitive hits |
This file contains 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 |
NewerOlder