Skip to content

Instantly share code, notes, and snippets.

View goors's full-sized avatar

Nikola goors

  • Zlatibor
  • 02:59 (UTC +01:00)
View GitHub Profile
--- PostgreSQL: Row Count for All Tables in a Schema
DO $$
DECLARE
r RECORD;
cnt BIGINT;
BEGIN
FOR r IN
SELECT tablename
FROM pg_tables
WHERE schemaname = 'table_name'
--- PGSQL Script: Bulk Update Schema, Table & Sequence Owners
DO $$
DECLARE
sch RECORD;
obj RECORD;
owner_name TEXT := 'dolphin'; -- <-- declare your owner variable here
BEGIN
-- Loop over all your target schemas
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
voyage_from_logabstract_final.py
End-to-end pipeline:
- Read LOG_ABSTRACT.csv and BUNKER_SUMMARY.csv
- Segment voyages from event log
- Compute energy (MJ), gCO2e, compliance balance vs FuelEU target
- Determine EU scope from alpha-2 prefixes of from/to UNLOCODEs
#!/bin/bash
while getopts ":v:" opt; do
case ${opt} in
v )
vault_name=$OPTARG
;;
\? )
sudo mkdir -p /mnt/data
sudo mount /dev/disk/azure/scsi1/lun$1 /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
sudo mkdir -p /mnt/data
sudo mount /dev/disk/azure/scsi1/lun$1 /mnt/data
echo "/dev/disk/azure/scsi1/lun$1 /mnt/data ext4 defaults 0 0" | sudo tee -a /etc/fstab
sudo sed -i 's|/var/lib/postgresql/16/main|/mnt/data/main|g' /etc/postgresql/16/main/postgresql.conf
sudo chown postgres.postgres /mnt/data -R
sudo /etc/init.d/postgresql restart
@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