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 | |
| # eml_viewer.zsh | |
| # | |
| # Defines `view_eml`, a small helper for reading RFC 5322 email message files | |
| # from the shell. | |
| # | |
| # Usage: | |
| # # Add this file's contents to `.ztools`, then load `.ztools` from `~/.zshrc`: | |
| # source "${HOME}/.ztools" |
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
| from __future__ import annotations | |
| from email import policy | |
| from email.header import decode_header | |
| from email.message import Message | |
| from email.parser import BytesParser | |
| from typing import Any | |
| def _decode_header(value: str | None) -> str: |
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
| """ | |
| Lightweight image metadata privacy checker. | |
| Checks common metadata exposed through Pillow, including GPS and potentially | |
| identifying EXIF fields. | |
| This is not a complete forensic metadata audit. For broader coverage of EXIF, | |
| XMP, IPTC, HEIF, and application-specific metadata, use ExifTool: | |
| https://exiftool.org/ | |
| """ |
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
| import random | |
| from typing import List | |
| def generate_positive_gaussian_samples( | |
| mean: float, | |
| approx_upper_bound: int, | |
| trial_number: int, | |
| ) -> List[float]: | |
| if trial_number < 0: |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Poisson Histogram Generator</title> | |
| <style> | |
| :root { | |
| color-scheme: light; | |
| --bg: #f6f7f9; |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Gaussian Histogram Generator</title> | |
| <style> | |
| :root { | |
| color-scheme: light; | |
| --bg: #f6f7f9; |
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
| from __future__ import annotations | |
| from math import isqrt | |
| # An example for a typical downstream usage is available at the bottom of the page. | |
| def is_prime(n: int) -> bool: | |
| if n < 2: | |
| return False | |
| if n == 2: |
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 | |
| """ | |
| webarchive_to_html.py | |
| Extract HTML and resources from an Apple .webarchive file using Python's plistlib, | |
| then rewrite common resource links for better offline viewing. | |
| Usage: | |
| python webarchive_to_html.py input.webarchive | |
| python webarchive_to_html.py input.webarchive -o output_dir |
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
| import re | |
| class WhitespaceRemover: | |
| """Remove whitespace from text using different strategies. | |
| All methods remove *Unicode whitespace* (not just ASCII spaces). | |
| Choose a method based on readability, performance, and workload size. | |
| """ |
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
| # Set up the prompt | |
| # 1. This MUST be here for the $(...) or ${...} to work | |
| setopt PROMPT_SUBST | |
| # 2. Tell the venv script not to mess with the prompt | |
| export VIRTUAL_ENV_DISABLE_PROMPT=1 | |
| # 3. The prompt string (no spaces inside the parentheses) | |
| PROMPT='${VIRTUAL_ENV:+(${VIRTUAL_ENV:t}) }%m:%1~ %# ' |
NewerOlder