Skip to content

Instantly share code, notes, and snippets.

View mhf-ir's full-sized avatar

Mohammad Hossein Fattahizadeh mhf-ir

View GitHub Profile
fs.file-max = 2097152
kernel.core_uses_pid = 1
kernel.msgmax = 65536
kernel.msgmnb = 65536
kernel.panic = 10
kernel.printk = 4 4 1 7
kernel.shmall = 4194304
kernel.shmmax = 4294967296
kernel.sysrq = 0
net.core.netdev_max_backlog = 262144
@mhf-ir
mhf-ir / namespace.py
Last active May 31, 2023 07:56
Namespace generator base on URL
import argparse
import string
import re
import random
from urllib.parse import urlparse
def main():
parser = argparse.ArgumentParser(description='Namespace Generator')
@mhf-ir
mhf-ir / nginx_error.vrl
Last active January 13, 2023 09:41
VRL helpers
nginx_error , err = parse_nginx_log(.message, "error")
if err == null {
if is_string(nginx_error.request) {
method_path, err = parse_regex(nginx_error.request, r'^(?P<method>[A-Z]+) (?P<path>[^\s]+)')
if err == null {
nginx_error.method = method_path.method
nginx_error.path = method_path.path
}
}
@mhf-ir
mhf-ir / sample-event.js
Last active December 22, 2022 06:57
Send sample event
// you must add analytics script into your project first
// put this script any where you like into your js of project, in callback, on load, on click or etc you want
aai.event({
// requirement fields
c: "news", // must be regex: /^[a-z0-9_]{1,31}$/ ... All lowercase include number and `_` min 1 character until 31 character
a: "viewed", // must be regex: /^[a-z0-9_]{1,31}$/ ... All lowercase include number and `_` min 1 character until 31 character
// optional fiedlds
l: "Any thing yo like", // any string you like
@mhf-ir
mhf-ir / hetzner-cloud.yml
Created November 25, 2022 18:59
netplan samples
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
routes:
- to: 0.0.0.0/0
via: 172.31.1.1
on-link: true
addresses: [ 5.5.5.5/32 ]
@mhf-ir
mhf-ir / mime.types.conf
Created October 28, 2022 09:10
nginx mimetype
default_type application/octet-stream;
types {
# essentials
application/xhtml+xml xhtml;
application/xml xml;
application/xslt+xml xsl;
text/calendar ics;
text/css css;
text/csv csv;
@mhf-ir
mhf-ir / ipmi_log.py
Created July 6, 2022 10:03
IPMI Log to json
#!/usr/bin/env python3
import csv
import subprocess
import re
import json
from datetime import datetime
def map_entry(s: str) -> str:
@mhf-ir
mhf-ir / main.go
Created February 8, 2022 15:06
ldap cli test
package main
import (
"crypto/tls"
"errors"
"fmt"
"log"
"os"
"strings"
@mhf-ir
mhf-ir / mimetype-extension-map.tsv
Last active January 6, 2022 14:06
mimetype extension map
MIMETYPE extension
application/andrew-inset ez
application/applixware aw
application/atom+xml atom
application/atomcat+xml atomcat
application/atomsvc+xml atomsvc
application/ccxml+xml ccxml
application/cdmi-capability cdmia
application/cdmi-container cdmic
application/cdmi-domain cdmid
@mhf-ir
mhf-ir / compare.md
Last active January 6, 2022 13:49
Compare different mimetype detector
Path Valid Reference File Perl Go
3mf.3mf 🔎 application/vnd.ms-package.3dmanufacturing-3dmodel+xml https://en.wikipedia.org/wiki/3D_Manufacturing_Format text/xml application/xml application/vnd.ms-package.3dmanufacturing-3dmodel+xml
aac.aac 🔎 audio/aac https://en.wikipedia.org/wiki/Advanced_Audio_Coding audio/x-hx-aac-adts audio/aac audio/aac
aaf.aaf 🔎 application/cdfv2 application/x-ole-storage application/octet-stream
accdb.accdb 🔎 application/x-msaccess application/octet-stream application/x-msaccess
aiff.aiff 🔎 audio/x-aiff audio/x-aiff audio/aiff
amf.amf [🔎