I think it moved (Pinkit version 3)

Added support for animated GIFs to my reddit image viewer Pinkit for Nokia N9.

Here is the full changelog:

Have fun viewing some random nsfw gifs!

p.s. bonus website: Every animated GIF on Wikipedia

Categories: N9, Pinkit, Programming, English
Date: 2012-12-12 21:40:54

ANSI colors in Python

It is nice to have colors in modern Linux shell. Colors in bash scripts are quite common, but coloring Python script output is just as easy. Colors in shell are done with ANSI escape codes. Here is an example code snippet on how to get started with ANSI colors in Python.

import sys

ansi_red = '\033[91m'
ansi_yellow = '\033[93m'
ansi_end = '\033[0m'

def apply_color(msg, color):
    if sys.stdout.isatty():
        return "%s%s%s" % (color, msg, ansi_end)
    return msg

def apply_red(msg):
    return apply_color(msg, ansi_red)

def apply_yellow(msg):
    return apply_color(msg, ansi_yellow)

print "%s roses and %s submarine." % (apply_red("Red"), apply_yellow("yellow"))

Function apply_color does some minor sanity checking, so that when redirecting output to file it will not insert the ANSI escape codes there.

Date: 2012-11-01 21:27:51