This file contains 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 bs4 import BeautifulSoup | |
# Constant for ruby-related annotation tags | |
RUBY_ANNOTATION_TAGS = ['rt', 'rp'] | |
def clean_ruby_annotations(soup: BeautifulSoup) -> BeautifulSoup: | |
""" | |
Cleans a BeautifulSoup object by removing ruby-related annotations. |
This file contains 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 subprocess | |
from argparse import ArgumentParser | |
from charset_normalizer import from_path | |
class ChardetJa: | |
"""Class for detecting the character encoding of files. |
This file contains 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 argparse import ArgumentParser | |
from pprint import pprint | |
from typing import List | |
COLOR_Y = "\033[93m" | |
COLOR_0 = "\033[0m" | |
def make_labeled_matrix(num_rows: int, num_cols: int, prefix: str = 'a') -> List[List[str]]: |
This file contains 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 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 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 Generic project. | |
This Python script, `pj_quickstart.py`, automates the creation of a generic | |
project directory structure. It also integrates Sphinx documentation and | |
performs additional configuration tasks. | |
""" | |
import argparse | |
import shutil | |
import subprocess |
This file contains 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 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 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() != ''] |
NewerOlder