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/python | |
| '''Summarizes the ancestry of several given commits, using Graphviz. | |
| In a handwavey sense, it tries to show all of the "interesting" forks and merges in the ancestry of the commits you name. | |
| Example: | |
| $ python compressednetworkgraph.py origin/{master,environment,slice} | |
| digraph G { |
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
| '''To help debug, provides a decorator that logs every call to a function. | |
| Basically, | |
| >>> @log_calls | |
| ... def sqrt(x): | |
| ... if x < 0: | |
| ... raise ValueError("can only sqrt positive numbers") | |
| ... return x ** 0.5 | |
| ... |
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 math import log, exp | |
| from functools import total_ordering | |
| @total_ordering | |
| class LogFloat(object): | |
| """Represents a positive real number in log-space to avoid underflow.""" | |
| def __init__(self, normal=None, log_space=None): | |
| if not ((normal is not None) ^ (log_space is not None)): | |
| raise ValueError("must specify normal-space XOR log-space value") |
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/python | |
| # | |
| from math import sin,cos,tan,sqrt,pi,asin, atan2 as atan | |
| from GUI import View, Application, Window, Task | |
| from GUI.Colors import Color | |
| pale_blue = Color(.5,.5,1) | |
| black = Color(0,0,0) | |
| white = Color(1,1,1) |
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 numpy | |
| from math import cos, sin, atan2, sqrt, pi | |
| def floateq(x, y, tolerance=1e-10): | |
| """Tells if two floats are within a given tolerance of each other.""" | |
| return abs(x-y) < tolerance | |
| class Vector(numpy.ndarray): | |
| """An n-dimensional vector.""" | |
| def __new__(cls, coords, polar=False): |
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/python | |
| # | |
| # A package that runs Conway's Game of Life. Simple GUI interface. | |
| # Requires PyGUI and srptools (a small collection of libraries I wrote, available via my Github account, speezepearson. | |
| # | |
| import pickle | |
| from GUI import (Application, View, Document, Window, Task, Frame, | |
| Slider, Label, Button, ViewBase) |
NewerOlder