Skip to content

Instantly share code, notes, and snippets.

@promto-c
promto-c / path_variable_extractor.py
Created January 29, 2024 03:31
Python Utility for Extracting Variables from Structured Paths.
"""
Copyright (C) 2024 promto-c
Permission Notice:
- You are free to use, copy, modify, and distribute this software for any purpose.
- No restrictions are imposed on the use of this software.
- You do not need to give credit or include this notice in your work.
- Use at your own risk.
- This software is provided "AS IS" without any warranty, either expressed or implied.
"""
@promto-c
promto-c / svg_precision_reducer.py
Last active January 27, 2024 02:53
Python script for reducing decimal precision in SVG files, optimizing them for web and graphics use.
import re
from typing import Match
def reduce_precision(svg_content: str, precision: int) -> str:
"""Reduces the precision of numerical values in the SVG content to the specified number of decimal places.
Args:
svg_content: A string containing SVG content.
precision: An integer representing the number of decimal places.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@promto-c
promto-c / The_Twin_Paradox-Understanding_Time_Space_Relativity.md
Last active October 15, 2024 19:50
Explore the Twin Paradox in this concise guide. It offers insights into time dilation, relativity, and their real-world implications, ideal for anyone keen on understanding this fundamental concept in physics.

Twin Paradox, featuring Bob and Alice as twins.

The Twin Paradox: A Fascinating Conundrum of Time and Space

The Twin Paradox presents a captivating scenario in the realm of theoretical physics, particularly in the study of relativity. It involves a pair of twins and a journey that leads to an intriguing outcome: upon reunion, the twins are no longer the same age. This paradox has been a topic of much discussion and analysis in the context of special and general relativity.

Prerequisites: Fundamental Concepts Required Before exploring the Twin Paradox, it is essential to be familiar with several key concepts in physics:
@promto-c
promto-c / General-Web-App-GitHub-Pages-Deployment-Guide.md
Created December 28, 2023 16:59
Comprehensive Guides for Deploying React, Node.js, and General Web Applications on GitHub Pages

Deploying a General Web App (HTML, CSS, JS) on GitHub Pages

A step-by-step guide to deploying web applications (using HTML, CSS, JavaScript) on GitHub Pages, categorized into three main sections for ease of understanding and implementation.

Preparing Your Web Application

  1. Create Your Web Application

    • Prepare your web application with HTML, CSS, and JavaScript files. Ensure the entry point of your app is an index.html file.
  2. Organize Your Application

@promto-c
promto-c / Pug_Template_Example_and_Introduction.md
Last active December 27, 2023 11:01
A concise guide introducing Pug, the powerful templating engine for web development. Includes basic syntax, features, usage, and resources for beginners.

A digital illustration representing the concept of Pug, a web templating engine

Introduction to Pug (formerly known as Jade)

Pug is a powerful and expressive templating language commonly used in web development to generate HTML markup. It is known for its concise and clean syntax, making it a popular choice among developers for creating dynamic web content. Pug was formerly known as Jade, but the name was changed to Pug to avoid trademark issues with another software.

Table of Contents

  1. Key Features of Pug
  2. Getting Started with Pug
  3. Basic Syntax
  4. Using Pug as a Template in Web Frameworks
@promto-c
promto-c / Python_LRU_Cache_Usage_Guide.md
Last active September 22, 2026 13:56
A detailed guide to using Python's functools.lru_cache for efficient function caching. Covers basic usage, cache management, custom cache control, and additional insights for optimal utilization in various development scenarios. Ideal for Python developers looking to enhance performance with caching techniques.

1703673950911

Python lru_cache Usage Guide

Overview

The lru_cache decorator in Python's functools module implements a caching strategy known as Least Recently Used (LRU). This strategy helps in optimizing the performance of functions by memorizing the results of expensive function calls and returning the cached result when the same inputs occur again.

Basic Usage

from functools import lru_cache
@promto-c
promto-c / PyPI_Package_Deployment_Guide.md
Last active December 20, 2023 21:16
Comprehensive Guide for Deploying Python Packages to PyPI.

Header Image for Python Package Deployment to PyPI

Steps to Deploy a Python Package to PyPI

Prerequisites

  1. Account on PyPI: Make sure you have a registered account on PyPI.
  2. Install Required Tools: Ensure you have setuptools and twine installed. If not, you can install them using pip:
    pip install setuptools twine
from PyQt5 import QtWidgets, QtCore, QtGui
from typing import Any, Optional, List, Tuple
from datetime import datetime, timedelta
from tablerqicon import TablerQIcon
from theme import set_theme
def get_date_list(
start_date: Optional[str] = None,
@promto-c
promto-c / python_basic_cheat_sheet.md
Last active February 1, 2026 16:51
Comprehensive Python Cheat Sheet: From Basic Syntax to Intermediate Concepts - A quick reference guide for Python learners, covering key syntax, control structures, data structures, OOP, and more. Ideal for revision and quick look-ups.