Skip to content

Instantly share code, notes, and snippets.

View fitzy1321's full-sized avatar

Joe Fitzgibbons fitzy1321

View GitHub Profile
@fitzy1321
fitzy1321 / find_file.py
Created June 6, 2026 18:57
Search Path for File
from pathlib import Path
def find_file(p: Path, file_name: str) -> Path | None:
if p.is_file() and file_name in p.parts:
return p
for sp in [p, *p.parents]:
candidate = sp / file_name
if candidate.exists() and candidate.is_file():
@fitzy1321
fitzy1321 / python.gitignore
Created April 27, 2026 20:57
Python gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
@fitzy1321
fitzy1321 / postgres_enum_exists_checker.sql
Last active September 7, 2025 01:28
Postgres find all enum types
-- Return a bool if enum exists
CREATE OR REPLACE FUNCTION enum_exists(enum_name text, enum_schema text DEFAULT 'public')
RETURNS boolean
LANGUAGE sql
AS $$
SELECT EXISTS (
SELECT 1
FROM pg_type t
JOIN pg_namespace n ON t.typnamespace = n.oid
WHERE t.typname = enum_name
@fitzy1321
fitzy1321 / typer_example.py
Created August 21, 2025 05:57
Typer add `-h` flag
import typer
app = typer.Typer(context_settings={"help_options_names": ["-h","--help"]})
# ...
if __name__ == "__main__":
app()
@fitzy1321
fitzy1321 / csv_inspector.ipynb
Last active December 3, 2024 23:29
csv inspector notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<a href="https://fitzypop.deno.dev" target="_blank" rel="noopener noreferrer">Fitzypop's Blog</a>
@fitzy1321
fitzy1321 / pytest_slow_marker.md
Last active January 10, 2023 02:50
Pytest slow test marker

Mark a test as slow and skip it

# In pyprojct.toml
[tool.pytest.ini-options]
markers = ["slow: mark tests as slow (deselect with '--runslow')"]

Add the following to your conftest.py file:

@fitzy1321
fitzy1321 / vscode_pytest_troubleshooting.md
Last active December 7, 2022 21:26
VSCode and pytest troubleshooting

VSCode and pytest

If your encountering problems running pytest in vscode testing panel, create an .env file with the following:

# .env
PYTHONPATH="./<package_name>;${PYTHONPATH}"

Make sure to add .env to your .gitignore file

@fitzy1321
fitzy1321 / git-diff.md
Last active April 24, 2024 17:51
Exclude files from git diff

How to exclude files from git diff

# fish shell
set _git_ignore_list "':!/*Cargo.lock' ':!/*deno.lock' ':!/*package-lock.json' ':!/*poetry.lock' ':!/*yarn.lock'"
# fish abbreviation gdnl, stands for "git diff no lock"
abbr -a gdnl git diff -- $_git_ignore_list
@fitzy1321
fitzy1321 / fix.md
Created September 15, 2022 17:30
Fix xcode install loop problem

How to fix xcode install loop after upgrading macOS

I recently upgrade my mac to 12.6, and xcode command line tools is now in an install loop. Preventing me from running make commands, I found this stack overflow post.

TL;DR: my need to reset path to xcode tools (I think)

xcode-select -s /Library/Developer/CommandLineTools