Skip to content

Instantly share code, notes, and snippets.

View kyob's full-sized avatar

Łukasz Kopiszka kyob

View GitHub Profile
@kyob
kyob / monitor-queue-avg-rate.rsc
Created January 23, 2025 08:08
MikroTik RouterOS script to monitor queue usage and log warnings when average rate exceeds a specified threshold.
# MikroTik RouterOS Script: Monitor Queue Average Rate
# Author: Łukasz Kopiszka
# Description: Monitors queue usage in /queue tree and logs warning if average rate exceeds a specified threshold.
# Units converted to Mb/s for readability.
# Usage: Add the script to RouterOS, and optionally schedule it for periodic execution.
# Example:
# /system scheduler add name=monitor-queue-avg-rate interval=1m on-event=monitor-queue-avg-rate
:local threshold 60
:foreach qId in=[/queue tree find] do={
:local qName [/queue tree get $qId name]
@kyob
kyob / ipoe-ne8k
Created December 19, 2024 08:30 — forked from marcossocram06/ipoe-ne8k
Configuração IPoE - Huawei Ne8k
#
dhcpv6 duid 00010001b6eb2b6c28a6dbeb0029
radius-server group isp
radius-server shared-key-cipher %^%#EGiA1wr#mTZwG!ZJAI`Tpk<jJ[%S+YAas!R_O-B=%^%#
radius-server authentication ip_radius_A 1812 weight 100
radius-server authentication ip_radius_B 1812 weight 0
radius-server accounting ip_radius_B 1813 weight 0
@kyob
kyob / nginx-reverse-proxy.txt
Created January 8, 2024 11:26
NGINX reverse proxy example
server {
listen 80;
server_name example.com;
location / {
return 301 https://$server_name$request_uri;
}
location /.well-known/acme-challenge/ {
@kyob
kyob / dkim.sh
Created January 8, 2024 11:20
DKIM bash script
#!/bin/bash
# This script generates a DKIM key pair using Rspamd's dkim_keygen tool
# and follows best practices for key generation.
# Set the domain for which the DKIM key is being generated
domain="example-domain.com"
# Generate a random selector of 10 characters using /dev/urandom
selector=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10)
@kyob
kyob / gist:6891157a1f7a8332f9f034a570211037
Created September 7, 2023 06:57
remove comments and empty lines
grep -v '^[[:space:]]*#' file.conf | grep -v '^[[:space:]]*$'
@kyob
kyob / ddos.txt
Created September 1, 2023 12:40 — forked from bom-d-van/ddos.txt
Detecting and Mitigating DDOS Attacks
Detecting and Mitigating DDOS Attacks
#List all Finish (FIN) packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 1 != 0'
#List all SYN and SYN-ACK packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 2 != 0'
@kyob
kyob / ddosDetection.sh
Created September 1, 2023 12:24 — forked from Masu-Baumgartner/ddosDetection.sh
DDoS Detection Script ready to use for a integration in third party software using the "DATA" output. Should work on every linux system
#! /bin/bash
echo "DDos Detect by masusniper#0666";
interface=$(ip -o -4 route show to default | awk '{print $5}')
dumpdir=/root/dumps
echo -e "Using interface ${interface}"
mkdir $dumpdir
#/bin/bash
history | awk '{print $2}' | sort | uniq -c | sort -nr | head -n 10
@kyob
kyob / cto_line.pine
Created September 27, 2021 06:34
CTO Line indicator for TradingView
//@version=4
study(title="CTO Line", shorttitle="CTO", overlay=true, resolution="")
smma(src, length) =>
smma = 0.0
smma := na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length
smma
v1 = smma(hl2, 15)
m1 = smma(hl2, 19)
m2 = smma(hl2, 25)
v2 = smma(hl2, 29)