Skip to content

Instantly share code, notes, and snippets.

View ClimenteA's full-sized avatar
👋
Hi! Let's connect on LinkedIn/X!

Alin Climente ClimenteA

👋
Hi! Let's connect on LinkedIn/X!
View GitHub Profile
@ClimenteA
ClimenteA / youtube_video_id_generation.py
Created January 21, 2026 14:23
Generates a URL-safe, 11-character string similar to YouTube video IDs.
import secrets
import base64
def generate_youtube_id():
"""
Generates a URL-safe, 11-character string similar to YouTube video IDs.
Calculates 8 bytes of entropy (64 bits) and encodes it to Base64.
"""
# 1. Generate 8 random bytes (64 bits)
random_bytes = secrets.token_bytes(8)
@ClimenteA
ClimenteA / text_from_image.py
Created December 15, 2025 09:13
Extract text from image using Python PaddleOCR
# uv add paddlepaddle paddleocr
from paddleocr import PaddleOCR
def extract_text_from_image(image_path: str):
ocr = PaddleOCR(
lang="ro",
device="cpu",
use_angle_cls=False,
)
@ClimenteA
ClimenteA / pdf_to_png_optimizer.sh
Created November 1, 2025 19:19
Optimize documents in pdfs and images from a given folder
#!/bin/bash
##############################################################################
# PDF to Optimized PNG Converter
# Converts PDFs to high-contrast, sharpened PNG images
# Optimized for text documents (black text on white background)
# Make executable
# sudo chmod +x pdf_to_png_optimizer.sh
@ClimenteA
ClimenteA / settings.json
Created October 19, 2025 14:57
Ruff formater settings
{
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff",
},
"python-envs.defaultEnvManager": "ms-python.python:venv",
@ClimenteA
ClimenteA / Sony_SRS_XB100.md
Last active May 19, 2025 09:04
Sony SRS-XB100 - Ubuntu Microphone Setup
#!/bin/bash

# systemctl --user restart wireplumber pipewire pipewire-pulse

# Change this to match your device alias (as shown in `pactl list cards`)
@ClimenteA
ClimenteA / calculate_monthly_rate_based_on_working_days_and_vacation.py
Last active May 1, 2025 08:20
Freelance calculator - Calculate monthly rate based on working days and vacation
year = int(input("Invoice year: "))
month = int(input("Invoice month: "))
monthly_rate = float(input("Monthly rate: "))
print(
f"\nYou can verify working days here: https://romania.workingdays.org/workingdays_calendar_{year}_{month}.htm"
)
working_days = int(input("Working days: "))
legal_holidays = int(input("Legal holidays if they are not in weekend: "))
vacation_days = int(input("Vacation days: "))
@ClimenteA
ClimenteA / view_enums_in_postgress.sql
Created March 27, 2025 09:36
How to view enum types in postgresql
SELECT * FROM pg_type
SELECT pg_type.typname AS enumtype,
pg_enum.enumlabel AS enumlabel
FROM pg_type
JOIN pg_enum
ON pg_enum.enumtypid = pg_type.oid;
@ClimenteA
ClimenteA / calcul_taxe_impozite.py
Last active September 6, 2024 10:19
PFASimplu calcul taxe impozite
def calcul_taxe_impozite_local(venit_net: float, anul: int):
"""
versiune = "2.0.0"
"""
minim_brute_an_val = {
2020: 2230,
2021: 2300,
2022: 2550,
@ClimenteA
ClimenteA / order_media_files.py
Created June 18, 2023 13:19
Useful python script which can be used to organize your archive of photos, videos, documents etc
import os
import shutil
fileFormat = {
"Picture": [
".jpeg",
".jpg",
".gif",
".bmp",
@ClimenteA
ClimenteA / ffmpeg_reencode_mp4_1080p.py
Last active June 20, 2023 11:23
Re-encode videos to mp4 1080p 24 fps in case videos are corrupted
import os
import subprocess
input_folder = "./vids"
output_folder = "./reencoded"
# Create the output folder if it doesn't exist
os.makedirs(output_folder, exist_ok=True)
# Get a list of all the .mp4 files in the input folder