Skip to content

Instantly share code, notes, and snippets.

View meysam81's full-sized avatar
📝
Learning

Meysam meysam81

📝
Learning
View GitHub Profile
@meysam81
meysam81 / domain-checker.sh
Created August 19, 2025 09:11
Check for availability of a given product name and its possible TLD domains using DNS check and WHOIS API call; use at your own discretion!
#!/bin/bash
# Unified Domain Generator & Availability Checker
# Can accept either raw names to generate domains or a list of domains to check
# Usage: ./domain_tool.sh --names names.txt [options]
# ./domain_tool.sh --domains domains.txt [options]
# Color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "Usage: $0 <go_version>"
echo "Example: $0 1.25.0"
exit 1
fi
#!/bin/bash
URL="${1:-https://api.example.com/endpoint}"
OUTPUT_FILE="${2:-}"
CURL_CMD="curl \
--retry 3 \
--retry-delay 2 \
--retry-max-time 30 \
@meysam81
meysam81 / email.jsonnet
Created August 6, 2025 05:09
Ory Kratos JSONNET
function(ctx) {
email: ctx.identity.traits.email,
}
#!/bin/bash
set -eux
cat >> /etc/network/interfaces << 'EOF'
# VLAN interface configuration
auto enp98s0f0.4000
iface enp98s0f0.4000 inet static
vlan-raw-device enp98s0f0
vlan-id 4000
@meysam81
meysam81 / logsql-tutorial.md
Last active May 18, 2025 03:55
VictoriaMetrics LogsQL | Courtesy of Grok

Comprehensive LogQL Commands Tutorial

Introduction

LogQL (LogsQL) is a query language used within VictoriaMetrics to search, filter, and analyze log data. It is designed for efficient log retrieval, enabling users to extract specific log entries based on time, content, metadata, or numeric calculations. This tutorial provides a detailed overview of LogQL commands—primarily filters and mathematical operations—along with examples to help you construct effective queries. The content is structured for both beginners and advanced users, serving as a reference for future use.

Basic Structure of a LogQL Query

A LogQL query consists of:

  • Filters: Criteria to select logs, such as time ranges, words, or field values. At least one filter is required.
  • Optional Actions: Operations like stats, fields, or eval applied to filtered logs, separated by the pipe (|) operator.
#!/bin/bash
# Function to display help message
usage() {
echo "Usage: $0 --email <email> [--name <name>] [--passphrase <passphrase>]"
echo "Generate an Ed25519 GPG private key non-interactively."
echo ""
echo "Options:"
echo " --email Email address for the GPG key (required)"
echo " --name Name for the GPG key (optional, defaults to email)"
#!/bin/bash
set -eou pipefail
if [[ "${DEBUG:-0}" -eq 1 ]]; then
set -x
fi
# Check if Bitwarden CLI is installed
if ! command -v bw &>/dev/null; then

Yes, it is possible to integrate ModSecurity with HAProxy, but it requires using ModSecurity as a standalone service with HAProxy’s Stream Processing Offload Engine (SPOE) and a Stream Processing Offload Agent (SPOA), such as jcmoraisjr/modsecurity-spoa. This approach offloads ModSecurity’s processing to a dedicated agent, allowing HAProxy to filter HTTP traffic through ModSecurity rules without embedding ModSecurity directly into HAProxy. Below, I’ll outline the steps to achieve this integration, focusing on a typical setup using a Linux distribution like CentOS or Ubuntu, and address the feasibility based on your context.


Feasibility

  • ModSecurity v2 Support: HAProxy integrates well with ModSecurity v2 using SPOE and SPOA, as demonstrated in several community projects.
  • ModSecurity v3 Support: Support for ModSecurity v3 is less mature. The core ModSecurity v3 library (libmodsecurity) requi
#!/bin/bash
set -eu
# usage:
if [ $# -lt 1 ]; then
echo "Usage: $0 <directory> [<size>] [<destination>]"
echo " <directory> Directory to search for files"
echo " <size> Size of files to find (default: +512M)"
echo " <destination> Destination directory to move files (default: target-dir)"