If it won't be simple, it simply won't be. [source code] by Miki Tebeka, CEO, 353Solutions

Sunday, October 29, 2006

Going Offline For a While

I will be offline for about a month or two...

Have fun in the meanwhile, and do come back.


Since I am (sadly) on Windows platform, I use cygwin a lot.

One of my most used scripts is putpath which puts the windows path of the first argument to the windows clipboard (if called without any arguments it uses the current directory).

It uses the putclip program that comes with cygwin.

#!/usr/bin/env python
'''Put a path in clipboard'''
__author__ = "Miki Tebeka "

from os import system, popen
from os.path import exists
from optparse import OptionParser

# Command line parsing
p = OptionParser("usage: %prog [options] [PATH]")
p.add_option("-u", help="unix path format", dest="unix",
default=0, action="store_true")
p.add_option("-c", help="C string format", dest="cstr",
default=0, action="store_true")

opts, args = p.parse_args()
if len(args) not in (0, 1):
p.error("wrong number of arguments") # Will exit

if len(args) == 0:
path = "."
path = args[0]

if not exists(path):
raise SystemExit("error: %s - no such file or directory" % path)

# Output format (unix/dos)
if opts.unix:
format = "u"
format = "w"

path = popen("cygpath -%sa '%s'" % (format, path)).read().strip()
if opts.cstr and (not opts.unix):
path = path.replace("\\", "\\\\")
popen("putclip", "w").write("%s" % path)

Thursday, October 12, 2006


When releasing a new version, I like to send an email that starts with:

Stupid version 0.1.2 is out, grab it from
ftp://stupid.com/pub/stupid-0.1.2.tar.bz2 before SOMETHING is over!

Where SOMETHING is an event happening at the time of the post. To find what events happen today, I use the following script (called "today"):

#!/usr/bin/env python
'''Launch wikipedia page for today'''

from time import strftime
import webbrowser

day = strftime("%d")
# Change 06 -> 6
if day.startswith("0"):
day = day[1]

url = "http://en.wikipedia.org/wiki/" + strftime("%B") + "_" + day

Blog Archive