Skip to content

Instantly share code, notes, and snippets.

View goors's full-sized avatar

Nikola goors

  • Zlatibor
  • 22:19 (UTC +02:00)
View GitHub Profile
import sys
from base64 import b64encode
from nacl import encoding, public
def encrypt(public_key: str, secret_value: str) -> str:
"""Encrypt a Unicode string using the public key."""
public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder())
sealed_box = public.SealedBox(public_key)
encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
return b64encode(encrypted).decode("utf-8")
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install -y python3-pip python3-venv
python3 -m venv myenv
source myenv/bin/activate && pip install pynacl
# GitHub Repository
repo_owner="readydataAG"
repo_name="immoledo-rewrite"
sudo apt-get install -y rsync
sudo mkfs.ext4 /dev/disk/azure/scsi1/lun$1
sudo mkdir -p /mnt/data
sudo mount /dev/disk/azure/scsi1/lun$1 /mnt/data
sudo rsync -av /var/lib/elasticsearch/ /mnt/data/
echo "/dev/disk/azure/scsi1/lun$1 /mnt/data ext4 defaults 0 0" | sudo tee -a /etc/fstab
sudo sed -i 's|path.data: /var/lib/elasticsearch|path.data: /mnt/data|g' /etc/elasticsearch/elasticsearch.yml
sudo systemctl restart elasticsearch
public string HashSecret(string secret) {
using var sha256 = SHA256.Create();
// Compute hash of the password
var hashBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(secret));
// Convert byte array to a hexadecimal string
var builder = new StringBuilder();
foreach (var t in hashBytes) {
builder.Append(t.ToString("x2"));
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body, html {
min-height: 100vh;
padding: 0;
margin: 0;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
#!/bin/bash
while getopts ":c:t:s:v:i:" opt; do
case ${opt} in
c )
client_id=$OPTARG
;;
t )
tenant_id=$OPTARG
;;
#!/bin/bash
sudo apt-get update
sudo apt-get install gnupg -y
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --yes --dearmor -o /usr/share/keyrings/elasticsearch.gpg
echo "deb [signed-by=/usr/share/keyrings/elasticsearch.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
sudo apt update
sudo apt install elasticsearch -y
sudo systemctl daemon-reload
@goors
goors / elasticsearch-bulk-index-from-json-hits.md
Created March 4, 2024 13:23 — forked from renshuki/elasticsearch-bulk-index-from-json-hits.md
Elasticsearch - Bulk index from a JSON file hits (with jq)
cat file.json | jq -c '.hits.hits[] | { index: {_index:._index, _type:._type, _id:._id}}, ._source' | curl -XPOST -H "Content-Type: application/x-ndjson" localhost:9200/_bulk --data-binary @- | jq .