Skip to content

Instantly share code, notes, and snippets.

@motebaya
motebaya / green_duotone.py
Last active September 3, 2025 12:31
Bulk/single image/s convert to Pink × Green duotone
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @gist.github.com/motebaya - 3/9/2025
# rewrite from TS - https://lovable.dev/projects/8354edf5-ed78-4f83-8860-5ac9d2f067ff
import numpy as np
import os
from PIL import Image
import sys
@motebaya
motebaya / 4to2.py
Created August 23, 2025 14:10
4 to 2 indentation
#!/usr/bin/python3
import sys
import re
def cv_indent(file: str) -> str:
x = open(file, "r").read().strip().splitlines()
print(f" *!reading: {len(x)} lines")
code = ""
for line in x:
@motebaya
motebaya / statistic_frame.py
Created August 16, 2025 16:26
draw frames statistic into PNG
#!/usr/bin/python3
# @github.com/motebaya - 16/08/2025
# frames statistic into PNG!!!
import os
from PIL import Image, ImageDraw, ImageFont
def draw_stat(img_path: str, text: str, font: str, font_size: int) -> None:
img = Image.open(img_path).convert("RGBA")
overlay = Image.new(
@motebaya
motebaya / fastnote.py
Last active August 1, 2025 11:10
parse backup file mobile app: net.fast_notepad_notes_app.fastnotepad
#!/usr/bin/python
# @github.com/motebaya - 6/4/2025
import json, re, datetime, sys
if (len(sys.argv) < 2):
print("Usage: fastnote.py <file>")
sys.exit(1)
FILE = sys.argv[1]
@motebaya
motebaya / tokped_report.py
Last active May 31, 2025 06:34
request a personal data download through your account setting...usually it’s quick, takes less than a day, and you’ll get a pdf report.
#!/usr/bin/python3
# d: 28/05/2025 12:44:41
# you need this dawg: https://pypi.org/project/PyMuPDF/
import re
from datetime import datetime
PDF = "download.pdf"
PWS = "password123"
@motebaya
motebaya / yolo_img_crop.py
Last active April 7, 2025 07:01
crop images from all results face detection from: https://github.com/zymk9/yolov5_anime
#!/usr/bin/python
# crop image area with cv2
# @github.com/motebaya - 7/10/2024
import cv2
import os
import logging
logging.basicConfig(level=logging.INFO)
from argparse import ArgumentParser, RawTextHelpFormatter
from colorama.ansi import Fore
@motebaya
motebaya / merging.js
Created March 23, 2025 02:33
merge image using sharp JS : https://github.com/lovell/sharp
#!/usr/bin/node
/**
* @github.com/motebaya
* 2024-02-16 03:28:08.599531900 +0700
*/
import sharp from "sharp";
async function mergePanel(imageslist, output) {
return new Promise(async (resolve) => {
try {
#!/usr/bin/python
# 2/24/2025 - @github.com/motebaya
from PIL import Image
from io import StringIO
import pilgram
import os
ext_list = list(Image.registered_extensions().keys())
list_filters = [
-- https://github.com/yasugami/yasugami.github.io
-- 23/03/2025 - @github.com/motebaya
if arg[1] then
local code = assert(io.open(arg[1])):read("*a")
local f = io.open('.tmp.lua', "w")
if f then
local modcode = code:gsub('_ENV%[%"\\108\\111\\97\\100%"%]', "print"):gsub('%(%)', '')
f:write(modcode)
f:close()
end
@motebaya
motebaya / formatter.php
Created January 21, 2025 15:24
php-parser 4.x to format/beautify php code without any installed composer.
<?php
/**
* no need composer
* @github.com/motebaya - 2025-01-19 19:36:32.659806400 +0700
* @reff: https://github.com/pk-fr/yakpro-po/blob/master/include/classes/parser_extensions/my_autoloader.php
*/
namespace PhpParser;