This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sphinx: regex for converting list items into hyperlinks. | |
sed -E 's|^#\. (.*)$|#. `\1 <../../../../\1/docs/build/html/index.html>`_|g' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# sed & awk for gzip-ed text files. | |
# The `zsmartcat` function reads the contents of a file, but it intelligently | |
# handles files that are either: | |
# 1. Gzip-compressed files (e.g., `.gz` files). | |
# 2. Regular text files (uncompressed files). | |
# The function decides whether to use `zcat` (to extract and display | |
# a gzip-compressed file) or the standard `cat` command (to display | |
# an uncompressed text file), based on the file type. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Quickstart script for a Generic project. | |
This Python script automates the creation of a generic project directory structure | |
with Sphinx documentation integration. | |
""" | |
import argparse | |
import shutil | |
import subprocess | |
from dataclasses import dataclass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from datetime import datetime | |
from pathlib import Path | |
import pandas as pd | |
class ConcatCSV: | |
""" | |
Handles concatenation of multiple CSV files in a specified directory into a single CSV file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import matplotlib.pyplot as plt | |
from random import gauss | |
NUM_SAMPLES = 128 | |
def plot_gaussian_distribution(mu: float, sigma: float) -> None: | |
"""Check N(mu, sigma) distribution visually.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def split_n_strip(str_in: str, sep: str = ';') -> list[str]: | |
""" | |
Split a string into a list of non-empty, stripped substrings. | |
""" | |
return [s.strip() for s in str_in.split(sep) if s.strip() != ''] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from PIL import Image, ImageDraw, ImageFont | |
""" | |
Create a blank PNG image with a test string—A code written by ChatGPT o3-mini-high. | |
This script is created by ChatGPT o3-mini-high with the following prompt: | |
Objective: Write a Python code that creates a PNG file. | |
Specification: | |
- Ask the user for the dimension of the image. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
from collections import Counter | |
from datetime import datetime | |
from pathlib import Path | |
from list_files_sha256 import hash_by_256, list_fpaths_in_dir | |
class FindDupFile: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
from hashlib import sha256 | |
from pathlib import Path | |
def hash_by_256(fpath): | |
""" | |
Computes a SHA-256 hash of a file using variable chunk sizes based on file size. |