Skip to content

Instantly share code, notes, and snippets.

View amirshnll's full-sized avatar
🎯
Focusing

Amir Shokri amirshnll

🎯
Focusing
View GitHub Profile
@amirshnll
amirshnll / nationalcode.py
Created April 15, 2024 22:55
validate iranian national code (pytohn)
def validate_iranian_national_code(code):
code_len = len(code)
if code_len > 10 or code_len < 8:
return False
if len(set(code)) == 1:
return False
if len(code) < 10:
code = code.zfill(10)
@amirshnll
amirshnll / states.php
Created January 20, 2024 23:12
List of Iranian (IR) states in WooCommerce
$states = [
'ABZ' => 'البرز',
'ADL' => 'اردبیل',
'EAZ' => 'آذربایجان شرقی',
'WAZ' => 'آذربایجان غربی',
'BHR' => 'بوشهر',
'CHB' => 'چهارمحال و بختیاری',
'FRS' => 'فارس',
'GIL' => 'گیلان',
'GLS' => 'گلستان',
@amirshnll
amirshnll / extract.py
Last active January 7, 2024 10:03
Get Person Names from Passports by Python!
from PIL import Image
import pytesseract
import re
def extract_name_from_id_card(image):
try:
image = Image.open(image)
ocr_text = pytesseract.image_to_string(image).lower().replace(" ", "")
name_pattern = re.compile(r"p<([^<]+)<<([^<]+)<")
matches = name_pattern.findall(ocr_text)
@amirshnll
amirshnll / regex.md
Last active December 12, 2023 12:07
My Regular Expression - REGEX

My Regular Expression - REGEX

Email Address Validation:

/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/

URL Validation:

@amirshnll
amirshnll / natas.txt
Last active October 8, 2022 16:20
Natas Challenge Username & Passowrd
url : http://natas0.natas.labs.overthewire.org
username : natas0
password : natas0
url : http://natas1.natas.labs.overthewire.org
username : natas1
password : gtVrDuiDfck831PqWsLEZy5gyDz1clto
url : http://natas2.natas.labs.overthewire.org
username : natas2