Maybe you think this code is useful, too?
I have released the following code into the public domain (except fitellipse and meanshift, which I can't). Feedback is still welcome, however. Email <yotam (strudel) yotamgingold.com>.
YImage (updated 2012-01-09):
[yimg.tgz]
[README]
[YImage.hpp]
[YImage.cpp] ()
[showpng.cpp]
Fork the code on GitHub
YImage: A simple pixel buffer class that can - save and load itself as a PNG (preserving alpha channel) - set color-plane layout (compile-time) - resize/flip/mirror/greyscale showpng: An example GLUT application using YImage that takes a PNG file as argument and displays it over a horrible green background.
MiniParser (updated 2007-09-20):
[miniparser.tgz]
[README]
[MiniParser.hpp]
[MiniParser.cpp]
[example.cpp]
Fork the code on GitHub
MiniParser: A simple C++ expression parser with no external dependencies whatsoever that can - generate a parse tree from an expression - parentheses - constants - symbolic variables - binary operators: - add: + - subtract: - - multiply: * - divide: / - modulus: % - exponent: ^, ** - unary operators: - negate: - - functions: - sin() - cos() - log() (base 10) - ln() (base e) - exp() - sqrt() - constants (override any variable with the same name): - PI = 3.14... NOTE: Order-of-operations is entirely left-associative. There is no operator precedence. Use parentheses everywhere! example: An example command line application that demonstrates a class with a predefined expression evaluated via operator() as well as an expression with an arbitrary number of variables. Can be called with two values (x,y) or with an expression followed by an arbitrary number of values assigned to the letters of the alphabet (a, b, c, ...).
GL.framework: [GL.framework.tgz] A framework of symlinks for Mac OS X to allow OpenGL #include's the same way as every other platform: <GL/gl.h>, <GL/glu.h>, <GL/glut.h>. Put it in /Library/Frameworks/.
Half-edge data structures in python [GitHub] and C++ [GitHub] with no external dependencies (well, the python one makes basic use of NumPy).
fitellipse.py: [fitellipse.py]
Ellipse fitting ported from the matlab file fitellipse.m by Richard Brown. This code is verified: After I ported the matlab code to python, I verified that both versions compute the same things internally and return the same results in all branches (two kinds of linear and nonlinear).
A proper readme (but using MATLAB) can be found here.
The original code can be found here. Note that the test code is embedded as a function in fitellipse.py.
MeanShiftCluster.py: [MeanShiftCluster.py]
Mean Shift clustering ported from the matlab file MeanShiftCluter.m by Bart Finkston.
The original code can be found here. Note that there is a small test function embedded inside which is performed if the script is run as main.
osx_ssh_agent: [osx_ssh_agent.tgz] [README] [ssh_agent_start] [ssh_agent_stop] [environment.plist]
UPDATE: Mac OS X 10.5 (Leopard) sets this up properly, so these scripts are no longer needed. (If you want to avoid the new password dialog box, continue to run "ssh-add" once when you first login.)
You don't need any fancy GUI programs to run a global ssh-agent for your entire login session on Mac OS X. All you have to do is define the environment variable SSH_AUTH_SOCK in ~/.MacOSX/environment.plist and then do something like "ssh-agent -a ${SSH_AUTH_SOCK}". (My environment.plist is included here for reference; use it if you don't have one at all.)
The problem with "ssh-agent -a ${SSH_AUTH_SOCK}" is keeping track of the PID for (a) making sure you only run one and (b) killing it when you're done (logout?).
The two scripts in this directory, ssh_agent_start and ssh_agent_stop, keep track of the PID so only one ssh-agent ever runs. I run ssh_agent_start once at login and then ssh-add once, and then I forget about it.