Skip to content

Instantly share code, notes, and snippets.

@szydan
szydan / gist:9433821ec855d055a0460557e87edb9b
Created May 19, 2024 23:11
When copying large number of small files
better
zip -0r A.zip A
copy A.zip ...
unzip A.zip
@szydan
szydan / rosetta-mac-m3.md
Last active May 23, 2024 12:52
Run shell mac m1 m2 m3

Install roseta

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

Create following aliase in .zshrc

alias arm="env /usr/bin/arch -arm64 /bin/zsh --login"
@szydan
szydan / gist:700466d44254b41a578ea170ed855c5e
Created May 13, 2024 13:09
zip not including hidden files
When packing a folder which has some hidden top level folders inside like
A+
+.yarn
+.rc
zip -rqq A.zip A
will pack those hidden top level folders while
#!/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 = [];