This was originally the majority of this post: Start a django project the right way but I've decided to put in it's own post instead.
I'm assuming you're on OSX. If you're on Linux most of these steps will be the same. If you're on Windows… Install VMWare and then install Linux.
I've added a
tl;dr at the end.
Although I have tweaked this over the years, the original code came from (I think, I've long since lost the bookmark) klymyshyn.com
Although I doubt I'm forging into unknown territory, here is a nice little way I came up with to iterate around a box or square.
def next_coord( w, h ): """ get the next x,y coordinates around your box w,h are the width and height of your box note, the strange ranges are to prevent getting the corners twice this loop configuration goes around clockwise from top left for x,y in next_coord(3,3): print "(%d,%d)" % (x,y), >>> (0,0) (1,0) (2,0) (2,1) (2,2) (1,2) (0,2) (0,1) """ for x in range(0,w-1): # top yield x,0 for y in range(0,h-1): # right yield w-1,y for x in range(w-1,0,-1): # bottom yield x,h-1 for y in range(h-1,0,-1): # left yield 0,y
I saw a recent post of the most incredible maze I've ever seen. Well I just had to solve it.
Here's a python script to increment an emails spam score. I call it (potentially several times) after SpamAssassin and before final delivery.