Friday, January 30, 2009

Tiny URLs

Want tinyurl.com-style links in your application? Need to generate a random sequence of alphanumerics? Here's a quick function in Python:

import random
import string

def short_id(num): return "".join(random.sample(string.digits + string.letters, num))

print short_id(6)

It will return something like AnLrJl or 9mLXut, or even bK5D4O. Simple and powerful.

Wednesday, January 7, 2009

Христос се роди! Срећан Божић!

To all the people that celebrate Christmas today, we wish you a Merry Christmas and that you and your family are healthy, happy and wealthy!