Skip to content

Instantly share code, notes, and snippets.

View bgribble's full-sized avatar

Bill Gribble bgribble

View GitHub Profile
@bgribble
bgribble / git-chunks.py
Last active December 12, 2017 18:48
Split a source file into chunks, preserving git history
#! /usr/bin/env python3
'''
git-chunks - split a source file into multiple chunks, preserving Git
history of the source text
You have a too-big file foo.py that is old and crufty. In
your editor split it into multiple files foo-bar.py,
foo-baz.py, and foo-quux.py, with some desiccated remains
in foo.py still. So from Git's perspective you have unstaged
@bgribble
bgribble / rgba_on.py
Created September 5, 2017 19:44
Convert an RGBA color over a background RGB color to RGB
import sys
if __name__ == '__main__':
r = int(sys.argv[1])
g = int(sys.argv[2])
b = int(sys.argv[3])
a = float(sys.argv[4])
if len(sys.argv) > 5:
bg_rgb = sys.argv[5]