Skip to content

Instantly share code, notes, and snippets.

@sidisinsane
sidisinsane / toponyms.json
Created May 23, 2025 17:48
ISO 3166-1 alpha-2 country code toponyms generated with Babel.
This file has been truncated, but you can view the full file.
[
{
"code": "AC",
"names": {
"ab": "ад-ха Вознесениа",
"af": "Ascensioneiland",
"ak": "Asɛnhyin",
"am": "አሴንሽን ደሴት",
"an": "Isla Ascensión",
"ar": "جزيرة أسينشيون",
@sidisinsane
sidisinsane / glossonyms.json
Last active May 23, 2025 17:46
ISO 639-1 language code glossonyms generated with Babel.
[
{
"code": "aa",
"names": {
"aa": "Qafar",
"af": "Afar",
"am": "አፋርኛ",
"ar": "الأفارية",
"as": "আফাৰ",
"az": "afar",
@sidisinsane
sidisinsane / fs_utils.py
Created May 22, 2025 12:47
Utility functions for common file and folder operations.
"""
src/YOUR_MODULE_NAME/utils/fs_utils.py
Utility functions for common file and folder operations.
Currently includes:
- IgnorePatternsError: Exception for handling load/parse failures.
- load_ignore_patterns: Read and parse ignore-files into a list of patterns.
- parse_ignore_patterns: Extract non-comment, non-blank lines from raw file content.
- JSONLoadError: Exception for JSON loading failures.
@sidisinsane
sidisinsane / decimal_arithmetic.py
Created May 22, 2025 10:16
Utility functions for precise decimal arithmetic operations.
"""
src/YOUR_MODULE_NAME/utils/decimal_arithmetic.py
Utility functions for precise decimal arithmetic operations.
Functions:
- decimal_add: Sum of two addends.
- decimal_subtract: Difference of minuend and subtrahend.
- decimal_multiply: Product of two factors.
- decimal_divide: Quotient of dividend and divisor.
@sidisinsane
sidisinsane / ci.yml
Created June 4, 2024 09:03
Github workflows for Python hatch projects.
---
name: ci
on: # yamllint disable-line rule:truthy
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
@sidisinsane
sidisinsane / country-identifiers.json
Created May 26, 2024 17:44
JSON list with ISO 3166-1 alpha-2, alpha-3 and numeric country-codes.
[
{
"Country": "Afghanistan",
"ISO 3166-1 alpha-2": "AF",
"ISO 3166-1 alpha-3": "AFG",
"ISO 3166-1 numeric": "004"
},
{
"Country": "Albania",
"ISO 3166-1 alpha-2": "AL",
@sidisinsane
sidisinsane / .coveragerc
Last active June 4, 2024 08:57
Python hatch project setup files.
[paths]
source = src
[run]
branch = true
parallel = true
source = tests
[report]
show_missing = true
@sidisinsane
sidisinsane / stop-other-media.js
Created August 9, 2023 17:51
Stops other media elements from playing when a media element starts playing.
/**
* Stops other media elements from playing when a media element starts playing.
*
* @param {HTMLMediaElement[]} mediaElems - An array of HTML media elements.
*
* @example
*
* // Stop other media elements when one starts playing
* const allMediaElems = document.querySelectorAll("audio, video");
* stopOtherMedia(allMediaElems);
@sidisinsane
sidisinsane / argv.json
Last active June 4, 2024 16:35
VSCode configuration for Python (with Hatch as package manager).
{
"locale": "en"
}
@sidisinsane
sidisinsane / dict_unique.py
Last active July 16, 2023 16:52
Return a dictionary containing unique values from a given dictionary.
def dict_unique(dict):
"""
Return a dictionary containing unique values from a given dictionary.
Args:
dict (dict): The input dictionary.
Returns:
dict: A new dictionary with unique values.