Skip to content

Instantly share code, notes, and snippets.

View erfanhs's full-sized avatar
🎯
Focusing

Erfan Harirsaz erfanhs

🎯
Focusing
  • Mashhad, Iran
View GitHub Profile
@erfanhs
erfanhs / resize.py
Last active November 23, 2022 10:24
Get new dimensions by changing width or height ( remain aspect ratio )
def gcd(x, y): # Simplify Fraction (Greatest common divisor)
if (x < y):
temp = x
x = y
y = temp
while (y != 0):
remainder = x % y
x = y
y = remainder
r = x
@erfanhs
erfanhs / writeOnImage.py
Last active March 9, 2021 09:50
write persian text on image (python+pillow)
import arabic_reshaper # pip install arabic-reshaper
from bidi.algorithm import get_display # pip install python-bidi
from PIL import ImageFont, Image, ImageDraw # pip install Pillow
def wrap(text, maxLen):
res_lines = []
for line in text.split('\n'):
lines = []
words = line.split(' ')
line = ''
### Keybase proof
I hereby claim:
* I am erfanhs on github.
* I am erfoon (https://keybase.io/erfoon) on keybase.
* I have a public key ASA_MoCunSQ8x8Ph-sIFK9cInnNc77Vf76nv88XEoR4vcwo
To claim this, I am signing this object:
@erfanhs
erfanhs / twitter_vdl.py
Created June 1, 2020 10:04
download twitter videos with python
import requests
from bs4 import BeautifulSoup
from pathlib import Path
# github.com/erfanhs
# download with twittervideodownloader.com
class Downloader:
def __init__(self, output_dir='./output/'):