Tag Archives: Programming

Using reduce in Python.

Python has a built in operator called reduce. This is just another name for what a functional programmer would called a fold. They’re really useful, but you don’t know so until you actually need one. The easiest example to understand is listed below and is the same example provided on Python’s documentation. lon = [1, [...]

Posted in Programming | Also tagged , | Leave a comment

Calculate file age in Python.

I use a file’s age for many things, especially when it comes to monitoring servers with nagios. Every language has their own modules to do these things, so here is my quick example to calculate a file’s age with Python. import os from datetime import datetime stat = os.stat(’/etc/php.ini’) fileage = datetime.fromtimestamp(stat.st_mtime) now = datetime.now() [...]

Posted in Programming | Also tagged , | Leave a comment

Open source database for books.

Have you ever wanted to add your favorite book’s thumbnail or description to webpage or blog? I did, but I couldn’t find a really good book knowledgebase/database where I could query for book information and thumbs. I found two really great options: Google Dynamic Links Open Library Both are identical implementations, but one is run [...]

Posted in Webhosting | Also tagged , , , , | Leave a comment