Skip to content

Instantly share code, notes, and snippets.

View msterhuj's full-sized avatar
💾
findings

Gabin L msterhuj

💾
findings
View GitHub Profile
@msterhuj
msterhuj / Laboinfra_Root_CA_2024.pem
Created November 15, 2024 17:39
LaboInfra CA Pub
-----BEGIN CERTIFICATE-----
MIIGYzCCBEugAwIBAgIUaLkxUZlr4d5eJNWR/Go/FWTjoXgwDQYJKoZIhvcNAQEL
BQAwYDELMAkGA1UEBhMCRlIxDDAKBgNVBAgTA0lERjEOMAwGA1UEBxMFUGFyaXMx
EjAQBgNVBAoTCUxhYm9pbmZyYTEfMB0GA1UEAxMWTGFib2luZnJhIFJvb3QgQ0Eg
MjAyNDAeFw0yNDA0MjExODE1MzhaFw0zNDA0MTkxODE1NTlaMGAxCzAJBgNVBAYT
AkZSMQwwCgYDVQQIEwNJREYxDjAMBgNVBAcTBVBhcmlzMRIwEAYDVQQKEwlMYWJv
aW5mcmExHzAdBgNVBAMTFkxhYm9pbmZyYSBSb290IENBIDIwMjQwggIiMA0GCSqG
SIb3DQEBAQUAA4ICDwAwggIKAoICAQDAKlTOA2UDbyfAtU+LEElJThKzsQ2MZYN8
00efjWwtWn5FFDgd8o/mGIrK+jWsINOPQfW7Dhrr1NGqtOl3GYdwC65d3GtHU19R
AwWEESHevkX5Dd65620u3XrHZUjKa6qlNFj/QIex9IXT2ce4iv+f4I+hXxjPlmUw
@msterhuj
msterhuj / install_openstack_exporter.sh
Created November 13, 2024 22:09
easy install openstack exporter
cd /tmp
wget https://github.com/openstack-exporter/openstack-exporter/releases/download/v1.7.0/openstack-exporter_1.7.0_linux_amd64.tar.gz
tar -xvf openstack-exporter_1.7.0_linux_amd64.tar.gz
mv openstack-exporter /usr/bin/
mkdir -p /etc/openstack-exporter
groupadd openstack-exporter
useradd -r -g openstack-exporter -d /etc/openstack-exporter -s /sbin/nologin openstack-exporter
chown -Rv openstack-exporter:openstack-exporter /etc/openstack-exporter
@msterhuj
msterhuj / grok_mikrotik_firewall_topic.md
Last active November 8, 2024 14:16
GROK MikroTik topic Firewall syslog

Befor add a prefix to your firewall filter

/ip firewall filter add chain=forward action=drop log=yes log-prefix="DROP"

And create a pipline with this grok on the field message

%{WORD:firewall.network.action} %{WORD:firewall.network.chain}: in:%{DATA:firewall.network.in_interface} out:%{DATA:firewall.network.out_interface}, connection-state:%{DATA:firewall.network.connection_state} src-mac %{MAC:firewall.source.mac}, proto %{DATA:firewall.network.protocol}, %{IPV4:firewall.source.ip}(?::%{NUMBER:firewall.source.port})?->%{IPV4:firewall.destination.ip}(?::%{NUMBER:firewall.destination.port})?, len %{NUMBER:firewall.network.bytes}
@msterhuj
msterhuj / radius_calculation.py
Created January 23, 2024 16:23
calculate the number of block to reduce based on days and required size
start_day = 5
finish_day = 10
start_radius = 6100
finish_radius = 250
def calculate_radius(day):
blocks_to_reduce_per_day = (start_radius - finish_radius) / (finish_day - start_day)
if day < start_day:
return start_radius
reduse = start_radius - blocks_to_reduce_per_day * (day - start_day)
- name: "Config Router"
hosts: all
gather_facts: false
vars:
ansible_user:
ansible_ssh_pass:
ansible_become_pass:
ansible_network_os: ios
ansible_connection: network_cli
ansible_become_method: enable
@msterhuj
msterhuj / create_debian_template.sh
Created December 23, 2022 21:22
function for createing template from cloud image on pve
#!/bin/bash
function create_template() {
if [ $# -ne 6 ]; then
echo "Usage: $0 URL TEMPLATE_ID TEMPLATE_NAME DATASTORE BRIDGE VLAN_ID"
echo "Cannot init creation if not all args are set, exiting..."
return 1
fi
URL=$1
TM_ID=$2
@msterhuj
msterhuj / reset_cert_pve.sh
Created November 21, 2022 09:42
Reset Cert PVE
#!/bin/bash
# SRC https://forum.proxmox.com/threads/broken-proxmox-by-trying-to-add-ssl-certificates.59166/
rm /etc/pve/priv/pve-root-ca.key
rm /etc/pve/pve-root-ca.pem
rm /etc/pve/local/pve-ssl.pem /etc/pve/local/pve-ssl.key /etc/pve/local/pveproxy-ssl.pem /etc/pve/local/pveproxy-ssl.key
pvecm updatecerts
systemctl restart pveproxy
@msterhuj
msterhuj / django_hot_reload.py
Created July 10, 2022 21:03
Hot reload for django when using gunicorn
from os import kill, getppid
from signal import SIGHUP
from django.http import JsonResponse
def reload(request):
"""
Restart all worker and master of gunicorn app
https://docs.gunicorn.org/en/stable/signals.html#reload-the-configuration
"""
@msterhuj
msterhuj / main.go
Created July 1, 2022 10:56
simple go api call
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type Brand struct {
Id int `json:"brand_id"`
@msterhuj
msterhuj / starulm.md
Last active May 28, 2022 13:33
Patch staruml 5.0.x

StarUML 5.0.x 🚀

Tested on 5.0.1

Install

  • Install starUML : starUML.io
  • Install nodejs : nodejs.org
  • After install nodejs install asar npm install -g asar