This file contains 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 sys, os, time | |
from collections import defaultdict | |
import re | |
import subprocess | |
SERVE_HTTP = False | |
if SERVE_HTTP: | |
import http.server | |
import socketserver |
This file contains 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 collections import defaultdict, namedtuple | |
import operator | |
import random | |
from functools import reduce | |
import math | |
class Vector(namedtuple('vector', 'x y z')): | |
"""A generic Vector object""" |
This file contains 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 array import array | |
from itertools import islice, izip, imap, izip_longest, tee, chain, product, ifilter | |
from maya.api.OpenMaya import MImage | |
import ctypes | |
def image_to_bytearray(img): | |
""" |
This file contains 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 os | |
import sys | |
import subprocess | |
PYHOME = os.environ.get("PY27", "C:\\ul\\tools\\python\\python27\\") | |
PYLIB = PYHOME + "libs" | |
PYINC = PYHOME + "include" | |
subprocess.call(("cython", sys.argv[-1], "--embed" )) | |
scriptfile = sys.argv[-1].replace(".pyx", ".py").replace(".py", ".c") |
This file contains 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 os | |
class UPathError(ValueError): | |
pass | |
class PathIsNotRelative(UPathError): | |
pass |
This file contains 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
__author__ = 'Steve' | |
import os | |
class EnvSetting(object): | |
""" | |
Set and unset an environemnt variable. If the variable did not exist at set time, it will be deleted at unset time | |
setter = EnvSetting('var', value) |
This file contains 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
/* | |
* GitHub style for Pygments syntax codehiliteer, for use with Pygments. Note the ".codehilite" tag names | |
* Courtesy of GitHub.com | |
*/ | |
.codehilite pre, pre, .codehilite .hll { background-color: #f8f8f8; border: 1px solid #ccc; padding: 6px 10px; border-radius: 3px; } | |
.codehilite .c { color: #999988; font-style: italic; } | |
.codehilite .err { color: #a61717; background-color: #e3d2d2; } | |
.codehilite .k { font-weight: bold; } | |
.codehilite .o { font-weight: bold; } |
This file contains 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
def add(vect, other): | |
return tuple(a + b for a, b in zip(vect, other)) | |
def sub(vect, other): | |
return tuple(a - b for a, b in zip(vect, other)) | |
def mul(vect, other): | |
if hasattr(other, '__iter__'): | |
return tuple(a * b for a, b in zip(vect, other)) | |
return tuple(a * b for a, b in zip(vect, [other] * len(vect))) |
This file contains 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 collections import namedtuple | |
import math | |
class Vector(object): | |
""" | |
generic vector operations | |
""" | |
def __add__(self, other): | |
return type(self)(*(a + b for a, b in zip(self, other))) |
This file contains 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
using UnityEngine; | |
using System.Collections; | |
/* | |
This is a simple example of the PIDContoller class. | |
For a discussion of PID theory see http://techartsurvival.blogspot.com/-address-tbd | |
Legalese: | |