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 | |
| # /// script | |
| # requires-python = ">=3.10" | |
| # dependencies = [] | |
| # /// | |
| """Prune uv-managed Python installs, keeping only the newest patch per minor version. | |
| Why: uv installs a fresh patch release whenever one lands and never removes the old | |
| one, so `uv python list` slowly fills with 3.13.12, 3.13.13, 3.13.14, 3.13.15, and so | |
| on. Each of those is a complete standalone copy of Python sitting in |
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
| server { | |
| listen 80; | |
| server_name mkennedy.codes; | |
| charset utf-8; | |
| server_tokens off; | |
| root /apps/static/mkennedy.codes/mkblog/mksite/public-prod; | |
| index index.html; | |
| # To allow for Let's Encrypt |
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
| # Standard zshrc stuff like path, etc. | |
| # ... | |
| # Enable using the two files above: | |
| # Functions | |
| source venv-auto-activate.sh | |
| # Venv security whitelist/blocklist | |
| alias venv-security='uv run -q --no-project ~/scripts/venv-security.py' |
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
| """ | |
| Security audit tests using pip-audit to detect known vulnerabilities. | |
| This test runs pip-audit against the installed packages and fails if any | |
| vulnerabilities are detected, ensuring continuous security monitoring. | |
| """ | |
| import subprocess | |
| import sys | |
| from pathlib import Path |
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 hashlib | |
| import os | |
| from typing import Optional | |
| from pyramid.request import Request | |
| from pyramid.response import Response | |
| def build_cache_id( | |
| filename: 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
| # Global settings | |
| [global] | |
| exclude = ["node_modules", "build", "dist"] | |
| respect_gitignore = true | |
| # Disable specific rules | |
| disable = ["MD013", "MD033", "MD045", "MD025", "MD042", "MD041", "MD024", "MD042", "MD052", "MD036", "MD029", "MD026", "MD002", "MD014"] | |
| # MD013 - Line length: Allows lines longer than the default limit for better readability in technical docs | |
| # MD033 - Inline HTML: Permits HTML tags within markdown for enhanced formatting when needed | |
| # MD045 - Images should have alternate text: Allows images without alt text (useful for decorative images) |
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
| # Include this in your shell *rc file (e.g. .bashrc, .zshrc, etc). | |
| # Update the folder name to your convention. | |
| # This uses venv as the virtual environment name, but if you use .venv, change it in the script. | |
| # Auto-activate virtual environment for any project with a venv directory | |
| function chpwd() { | |
| # Function to find venv directory in current path or parent directories | |
| local find_venv() { | |
| local dir="$PWD" |
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 pathlib import Path | |
| # Creates a file watcher that runs `python build_assets.py`, a utility based on | |
| # webassets package whenever a css or js file is edited. It bundles a bunch of | |
| # our CSS files into a single minified one and does the same for our JS files. | |
| def main(): | |
| # Only import this if we run it, don't let the webframework try to pull it in prod. | |
| import livereload.server |
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 datetime | |
| import sys | |
| from typing import Optional | |
| import colorama | |
| import pyramid.config | |
| from loguru import logger | |
| from pyramid.request import Request | |
| from pyramid.response import Response |
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
| // ************************************************************************* | |
| // server-hot-reload.js v1.0.5 | |
| // | |
| // Server-side hot reload check by Michael Kennedy (https://mkennedy.codes). | |
| // Released under the MIT open source license, 2023. | |
| // | |
| // When the contents of the page change in any way, the page will be reloaded. | |
| // | |
| // Usage: | |
| // |
NewerOlder