Skip to content

Instantly share code, notes, and snippets.

@hunzo
hunzo / create-certificates.sh
Last active September 8, 2025 03:13
extract certificate from pfx
#!/bin/bash
read -p "Certificates file name: " filename
read -p "Certificates expires (days): " expires
echo $filename
openssl genrsa -out "$filename-key.pem" 2048
openssl req -new -key "$filename-key.pem" -out "$filename-csr.pem"
openssl x509 -req -days $expires -in "$filename-csr.pem" -signkey "$filename-key.pem" -out "$filename-certs.crt"
openssl pkcs12 -export -out "$filename-pfx.pfx" -inkey "$filename-key.pem" -in "$filename-certs.crt"
@hunzo
hunzo / simple_kong_acme.md
Last active January 16, 2024 07:56
simple kong acme

Kong ACME example

Create Network

docker network create kong-net

Start DB (Postgres)

docker run --detach --name kong-db \
    --network kong-net \
    -e "POSTGRES_DB=kong" \
@hunzo
hunzo / git_cache_config.sh
Created December 14, 2021 01:54
Git Cache example
#!/bin/bash
git config --global user.name "your_account"
git config --global user.email "your_account@email.local"
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=604800'
git config -l
# 1 day 86400 second
# 7 day 604800 second
@hunzo
hunzo / docker-compose-wordpress-example.yml
Created December 14, 2021 03:05
docker-compose wordpress example
version: '3.7'
services:
wp-db:
image: mariadb
volumes:
- ./wp-db:/var/lib/mysql
- /etc/localtime:/etc/localtime:ro-
- /etc/timezone:/etc/timezone:ro
networks:
@hunzo
hunzo / live_event.ps1
Last active January 28, 2022 05:14
example ps script
# login as Global Admin Account
$User = "global_admin_account@domain.com"
$PWord = ConvertTo-SecureString -String "global_admin_password" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
$teamsurl = "https://link_to_event" # Link to event
# $cred = Get-Credential
Connect-AzureAD -Credential $cred
Connect-MsolService -Credential $cred
$User = "global_admin_account@domain.com"
$PWord = ConvertTo-SecureString -String "global_admin_password" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
$exosession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $exosession
Get-Mailbox -Identity "email_users@domain.com" | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward
@hunzo
hunzo / iscsi.md
Last active April 20, 2022 09:22

iSCSI config example

ref.

https://www.server-world.info/en/note?os=Ubuntu_21.04&p=iscsi&f=3
https://linoxide.com/how-to-backup-lvm-configuration-on-linux/

Config iSCSI

esxcli system snmp get
esxcli system snmp set --communities PUBLIC
esxcli system snmp set --syslocation "LOCATION"
esxcli system snmp set --syscontact email@domain.local
esxcli system snmp set --enable true
esxcli system snmp get
@hunzo
hunzo / opencv_re-streaming.py
Last active April 23, 2022 18:23
Simple MQTT Clients
import subprocess
import cv2
# re-stream rtmp url
rtmp_url = "rtmp://xxx.xxx.xxx.xxx:1935/stream/publish"
# source rtmp url
source_path = "rtmp://xxx.xxx.xxx.xxx:1935/stream/test"
cap = cv2.VideoCapture(source_path)
# gather video info to ffmpeg
fps = int(cap.get(cv2.CAP_PROP_FPS))
@hunzo
hunzo / app-face-detection.py
Last active April 29, 2022 07:18
POC Object Detection
import cv2
cap = cv2.VideoCapture(0)
# gather video info to ffmpeg
fps = int(cap.get(cv2.CAP_PROP_FPS))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
# face detection