Skip to content

Instantly share code, notes, and snippets.

View MayankFawkes's full-sized avatar
🎓
Open to work on github projects

Mayank Gupta MayankFawkes

🎓
Open to work on github projects
View GitHub Profile
@MayankFawkes
MayankFawkes / HashOTP.py
Last active November 19, 2023 16:01
python otp management without database, with overtime-handler
# -*- coding: utf-8 -*-
'''
>>> otp = HashOTP()
>>> otp_code = h.now("MY NAME IS MAYANK")
123456
>>> verify = h.verify("MY NAME IS MAYANK", "123456")
True
'''
@MayankFawkes
MayankFawkes / main.go
Created April 9, 2023 15:56
Check if your ISP blocking your ports.
package main
import (
"log"
"net"
"strconv"
"sync"
)
const (
@MayankFawkes
MayankFawkes / benchmark.md
Created February 15, 2023 16:47
Python VS Golang - API Benchmarks

Benchmarks

EC2 AWS 
Image: Ubuntu 22.04 LTS, 64-bit (x86)
Instance: t2.micro 
Location: ap-south-1 (Mumbai)
vCPUs 1 | RAM 1gb 

Overview

@MayankFawkes
MayankFawkes / main.go
Last active January 23, 2023 09:31
Personal CDN with Nginx and Golang | in nginx.conf you can add 443 with SSL if you want | thanks to https://bit.ly/3XM7wQm
package main
import (
"net/http"
"io/ioutil"
"log"
"fmt"
)
var print = fmt.Println;
@MayankFawkes
MayankFawkes / k8-test.yaml
Last active October 25, 2023 13:03
k8s testing yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
spec:
selector:
matchLabels:
run: hello-world-selector
replicas: 2
template:
@MayankFawkes
MayankFawkes / sources.list
Created January 16, 2023 11:43
Ubuntu 22.04 LTS (Jammy Jellyfish) complete sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
@MayankFawkes
MayankFawkes / docker-nosudo.sh
Last active April 20, 2024 06:25
Install docker in single script with latest docker-compose
apt-get remove docker docker-engine docker.io containerd runc
apt-get update
apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get -y install docker-ce docker-ce-cli containerd.io
compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
curl -L "https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
@MayankFawkes
MayankFawkes / auto-sudo.sh
Created October 15, 2022 05:18
setup Kubernetes digitalocean ubuntu 22.04
sudo apt update
sudo cat << EOF | sudo tee /etc/modules-load.d/k8s-modules.conf
br_netfilter
overlay
EOF
sudo cat << EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
@MayankFawkes
MayankFawkes / AlphaSeries.py
Last active October 31, 2022 03:57
A simple serial generator, it can be used in renaming images on cdn or as any uniform id generator, scalable with shading.
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
'''
A simple serial generator, it can be used in renaming images on cnd or any purpose
>>> series = AlphaSeries()
>>> series = series + (1_000_000_000 * 1_000_000_000 * 1_000_000_000) # billion * billion * billion
>>> print(series, series.int())
BSnRvvkli4KYvXUE 1000000000000000000000000000
@MayankFawkes
MayankFawkes / remove.bg.py
Last active September 20, 2022 11:52
Remove background
from io import BytesIO
from PIL import Image
from re import compile, search, findall, sub
import requests
class Background1:
PATTERN_CSRF = compile(r'<meta name="csrf-token" content="(.*)"')
PATTERN_TOKEN = compile(r"useToken\(\'(.*?)\'\)")