Skip to content

Instantly share code, notes, and snippets.

View goors's full-sized avatar

Nikola goors

  • Zlatibor
  • 07:45 (UTC +01:00)
View GitHub Profile
@goors
goors / ory_reset_password.txt
Last active November 7, 2024 17:53
Ory.sh, how to reset user password via api?
POST `https://PROJECT_URL/admin/recovery/code`
```
--header 'Content-Type: application/json'
--header 'Authorization: YOUR_ORI_ADMIN_ACCESS_TOKEN'
body=
{
"expires_in": "5m",
"identity_id": "SOME_USER_ID_GUID",
"flow_type": "api"
}
# ======================== Elasticsearch Configuration =========================imm
#
# 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.
#
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
$TTL 604800
@ IN SOA ns1.postgres.database.azure.com. admin.postgres.database.azure.com. (
2023101601 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.postgres.database.azure.com.
ns1 IN A 10.7.5.4
zone "postgres.database.azure.com" {
type master;
file "/etc/bind/db.postgres.database.azure.com";
};
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")
@goors
goors / github.sh
Last active October 17, 2024 14:31
#!/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;