Building an LED Hula Hoop From Scratch

  • Posted on: 26 November 2016
  • By: davis

I'll save you a read if you don't care about details. Long story short - buy yourself a quality hoop from Hyperion. Save yourself the trouble of doing this, because frankly, the results we obtained were not that impressive. We spent around $800 in materials by the end of this project and ended up with a heavy, bulky, large, cumbersome hoop that broke after 10 minutes. Seriously - just get a good hoop from a pro.

Our final result, starring my girlfriend Amanda:


Fixing missing libssl library when using Django/Anaconda

  • Posted on: 16 November 2016
  • By: davis

Here's the fix for this error message on OSX: 

raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/anaconda/lib/python2.7/site-packages/psycopg2/, 2): Library not loaded: libssl.1.0.0.dylib


Python: Capitalize First Letter of Each Word in a String (including after punctuation)

  • Posted on: 14 November 2016
  • By: davis

Python's str.title()  and string.capwords(str) methods have some flaws. Namely:

str = "my dog's bone/toy"
assert str.title() == "My Dog'S Bone/Toy"
assert string.capwords(str) == "My Dog's Bone/toy"

As you can see, str.title() doesn't quite format the string "Dog's" correctly - it instead opts to convert the "'s" to uppercase. This results in somewhat nonsensical strings.

string.capwords(str) is better about honoring the possessive case, but it has its own flaws. Firstly - it doesn't recognize words that occur after common punctuation like /, ( ), -, _, etc. This means that "bone/toy" will only be converted to "Bone/toy"

I've written my own answer to this problem, hopefully it helps anyone else who needs to capitalize the first letter of each word after punctuation without using title() or simply relying on capwords().

My solution first takes advantage of title() to solve most of the capitalization. It then uses a Regular Expression to look for an upper-cased letter preceded by a single quote mark that is in turn preceded by a lower-cased letter(this solves the issue of retaining contractions while matching single quotes within strings.)


Primitive Pics: A Really Cool Go Project

  • Posted on: 20 September 2016
  • By: davis

This is a really neat project that allows you to create cool photographs from your input.

A target image is provided as input. The algorithm tries to find the most optimal shape that can be drawn to minimize the error between the target image and the drawn image. It repeats this process, adding one shape at a time. Around 50 to 200 shapes are needed to reach a result that is recognizable yet artistic and abstract.