Skip to content

Instantly share code, notes, and snippets.

View jbradberry's full-sized avatar
💭
🗿

Jeff Bradberry jbradberry

💭
🗿
View GitHub Profile
@jbradberry
jbradberry / KeplerGears.ipynb
Last active July 12, 2024 16:03
Kepler Gears
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbradberry
jbradberry / Vignetting-flat.ipynb
Last active October 8, 2022 17:57
Vignetting calculations for the Sony a6000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbradberry
jbradberry / gist:147e1d731d028226ec3e0245d30b24bb
Last active July 26, 2021 16:17
Receptor mesh inventory processing
In [1]: import json, networkx
In [2]: import matplotlib.pyplot as plt
In [3]: with open("test-inventory.json") as f:
...: data = json.load(f)
...:
In [4]: G = networkx.DiGraph()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbradberry
jbradberry / Retirement.ipynb
Last active May 21, 2021 17:41
Retirement simulation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbradberry
jbradberry / rebase_migrations.py
Last active June 21, 2024 01:37
Re-number Django migrations during a rebase, use like `$ git rebase -i devel --exec "python3 rebase_migrations.py"`
from collections import defaultdict
from pathlib import Path
import re
import subprocess
changed_files = subprocess.check_output("git diff-tree --no-commit-id --name-status -r HEAD", shell=True)
changed_status = [line.split('\t') for line in changed_files.decode('utf-8').rstrip('\n').split('\n')]
changed_migrations = {fname for status, fname in changed_status
if '/migrations/' in fname and Path(fname).name[0].isdigit() and status != 'D'}