Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
for i in {1..100}; do
echo $i
done
@szydan
szydan / bash-debug.md
Created March 4, 2024 10:05
bash debug
Screenshot 2024-03-04 at 10 04 24
@szydan
szydan / docker-compose.yml
Created December 11, 2023 16:57 — forked from fpompermaier/docker-compose.yml
Federate plugin on standalone ES docker-compose.yml
services:
federate:
image: "docker.elastic.co/elasticsearch/elasticsearch:8.11.1"
user: elasticsearch
ports:
- "5005:5005"
- "9200:9200"
volumes:
# - ./plugin.zip:/tmp/plugin.zip
# - /home/flavio/git/siren-platform/core/target/releases/siren-federate-8.11.1-34.0-SNAPSHOT-plugin.zip:/tmp/plugin.zip
To connect to a service on a remote server that does not have its port exposed to the network.
For example, to connect to an elasticsearch back end to an investigate demo, incant the following:
ssh -L 9200:localhost:9200 -Nf username@remote.host
You can then connect to localhost:9200 and it will be forwarded to localhost:9200 on the remote machine.
In general, the argument to -L is of the form:
@szydan
szydan / gist:b70dcd91221f9d92ed2c1dedee89c84c
Last active February 23, 2024 17:27
How to clone es index
curl -H 'Content-Type: application/json' -XPUT http://localhost:9220/.siren/_settings -d'
{
"settings": {
"index.blocks.write": true
}
}'
curl -H 'Content-Type: application/json' -X POST http://localhost:9220/.siren/_clone/.siren-simon?wait_for_active_shards=all
curl -H 'Content-Type: application/json' -XPUT http://localhost:9220/.siren/_settings -d'
@szydan
szydan / gist:7c553d18be04577ed13568a35d4b6fc8
Created June 12, 2023 10:18
limit memory and cpu from command line ubuntu
systemd-run --user --scope -p AllowedCPUs=1 -p MemoryMax=1G -p CPUQuota=10% yarn start
const fs = require("fs");
const inPath = process.argv[2];
const outPath = process.argv[3];
const content = fs.readFileSync(inPath);
const json = JSON.parse(content);
const hits = json.hits.hits;
const res = [];
@szydan
szydan / gist:ea1de57bc346272092dba9fe8ecaca7a
Created January 18, 2023 12:23
list dependencies yarn2
yarn info
@szydan
szydan / gist:26189ab8bff0d3a873b2d8a1d4a96007
Created January 7, 2023 13:00
record voice with ffmpeg and blackhole audio driver
# Get input channel number for BlackHole device
ffmpeg -f avfoundation -list_devices true -i ""
# Record 2 seconds from i.e. input channel 0
ffmpeg -loglevel debug -f avfoundation -i :0 -t 2 test.mp3
https://github.com/ExistentialAudio/BlackHole