See comments in file for usage. Feel free to use/distribute however, but if distributing please include a link back here or to the blog post linked above.
This was one of the first OpenSCAD scripts I wrote. It's perhaps not as concise as it could be but it works.
For what it's worth: I printed everything at 40% infill and the parts feel really solid.