Skip to content

Instantly share code, notes, and snippets.

@greenarrow
greenarrow / spherical_translate.scad
Last active December 23, 2015 15:59
OpenSCAD Spherical Translate
/* http://en.wikipedia.org/wiki/Spherical_coordinate_system */
module spherical_translate(value)
{
radius = value[0];
inclination = value[1];
azimuth = value[2];
x = radius * sin(inclination) * cos(azimuth);
y = radius * sin(inclination) * sin(azimuth);
@greenarrow
greenarrow / sigpipe.py
Created February 13, 2015 12:30
How to make Python play nicely with pipes
import sys
import errno
def main():
for i in range(20):
print i
if __name__ == "__main__":
# ensure buffer is flushed before we handle SIGPIPE
try: