Skip to content

Instantly share code, notes, and snippets.

View mahmoud-eskandari's full-sized avatar
🪲
What the bug? WTB?

Mahmoud Eskandari mahmoud-eskandari

🪲
What the bug? WTB?
View GitHub Profile
@mahmoud-eskandari
mahmoud-eskandari / README.md
Last active June 29, 2025 23:45
Install v2ray on Bridge:(Ubuntu +18 via systemd) - Upstream (Ubuntu +18/CentOS +7 via docker)

پنل x-ui

پنل تحت وب مدیریت V2ray و ساخت کاربر و مدیریت سرور

mkdir x-ui && cd x-ui
docker run -itd --network=host \
    -v $PWD/db/:/etc/x-ui/ \
 -v $PWD/cert/:/root/cert/ \
@mahmoud-eskandari
mahmoud-eskandari / README.md
Last active March 11, 2025 16:59
SSH Tunnel as systemd service

${LOCAL_ADDR IP:PORT}

یعنی سرور ایرانتون و پورت داخلی که میخواهید روش ساکس داشته باشید و باید با این جایگزین بشود.

مثال:

10.10.10.10:9090

و قسمت پایین هم یوزر سرور خارجتون و آدرس IP سرور خارجیتونه که باید جایگزین کنید تو خط 7 فایل ssh-tunnel-as-systemd.sh

@mahmoud-eskandari
mahmoud-eskandari / docker-compose.yml
Created February 8, 2022 09:31
squid-authenticated Docker / Telegram mtproto
version: '3.8'
services:
sq:
image: robhaswell/squid-authenticated
restart: always
ports:
- "3128:3128"
environment:
- "SQUID_USERNAME=user"
- "SQUID_PASSWORD=pass..."
@mahmoud-eskandari
mahmoud-eskandari / innodb_to_ndbcluster_migration.sh
Last active August 11, 2024 21:29
MySQL InnoDB to NDBCluster migration script (ignores non-compatible foreign keys)
#!/bin/bash
# Written by Mahmoud Eskandari @ BoomerangApp - 2024
# Warning: Backup your innoDB before run!
# ****** Caution ******
# If you mistakenly swap the source and destination,
# the source database will be deleted. This script will also delete and recreate the destination database.
# Please be careful.
#
@mahmoud-eskandari
mahmoud-eskandari / server_publish_mp4_as_hls_golag.go
Last active July 2, 2024 05:43
Simple Golang Mp4 to hls server
package main
import (
"bytes"
"fmt"
"io"
"math"
"net/http"
"os"
"path"
@mahmoud-eskandari
mahmoud-eskandari / validateCard.js
Last active June 22, 2024 19:05
گولنگ و پی اچ پی اعتبار سنجی کارت عابر بانک ایران در جاوا اسکریپت , Iranian bank cards validator function, Javascript Golang php ,تابع تشخیص صحت کارت عابربانک
"use strict";
// By Mahmoud Eskandari @ MIT license
function validateCard(card) {
if (typeof card === 'undefined'
|| card === null
|| card.length !== 16) {
return false;
}
let cardTotal = 0;
for (let i = 0; i < 16; i += 1) {
@mahmoud-eskandari
mahmoud-eskandari / docker-docker-compose-install.sh
Last active December 19, 2022 11:14
Docker and Docker Compose installation on Linux
curl -fsSL https://get.docker.com | sh
curl -L "https://github.com/docker/compose/releases/download/$(curl --silent "https://api.github.com/repos/docker/compose/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
@mahmoud-eskandari
mahmoud-eskandari / first-j-weekday.sql
Last active January 22, 2022 12:10
بدست آوردن نیمه شب شنبه‌ی هفته‌ی جاری در SQL, MySQL
TIMESTAMP(DATE_SUB(CURDATE(),INTERVAL
CASE weekday(CURDATE())
WHEN 0 THEN 2
WHEN 1 THEN 3
WHEN 2 THEN 4
WHEN 3 THEN 5
WHEN 4 THEN 6
WHEN 5 THEN 0
WHEN 6 THEN 1
END
@mahmoud-eskandari
mahmoud-eskandari / Numberformat.go
Last active August 11, 2021 12:34
Number format without array reverse in golang
func NumberFormat(s string) (out string) {
ln := len(s)
mod := ln % 3
m := strings.Split(s, "")
for k, v := range m {
if (mod == 0 && k > 0 && k%3 == 0 && k < ln) ||
(mod > 0 && k >= (mod) && (k+(3-mod))%3 == 0 && k < ln) {
out += ","
}
out += v
@mahmoud-eskandari
mahmoud-eskandari / CompleteListOfMimeTypes_mime_to_suffix.json
Last active May 2, 2021 02:05
Complete list of mime types to file extensions/suffixes and vice versa
{
"application/andrew-inset": [
"ez"
],
"application/applixware": [
"aw"
],
"application/atom+xml": [
"atom"
],