Skip to content

Instantly share code, notes, and snippets.

@amrza
amrza / run.py
Last active November 16, 2025 11:00
How to write RTL(Arabic/Persian) text on images in python.
# Tested on Python 3.6.1
# install: pip install --upgrade arabic-reshaper
import arabic_reshaper
# install: pip install python-bidi
from bidi.algorithm import get_display
# install: pip install Pillow
from PIL import ImageFont
@james2doyle
james2doyle / valid-email.lua
Last active July 22, 2021 18:14
Lua validate email address
function validemail(str)
if str == nil or str:len() == 0 then return nil end
if (type(str) ~= 'string') then
error("Expected string")
return nil
end
local lastAt = str:find("[^%@]+$")
local localPart = str:sub(1, (lastAt - 2)) -- Returns the substring before '@' symbol
local domainPart = str:sub(lastAt, #str) -- Returns the substring after '@' symbol
-- we werent able to split the email properly