Monthly Archives: April 2011

git amend

A nice git option I stumbled upon today – amend.

Typical scenario – you’ve done a local check-in, then notice there’s a typo in your code comments. Fix up the typo, then use - – amend to re-check-in, without having to do a reset/revert. For example:

git add foo.file
git ci -m "added the frob feature to the whiz-bang"
...
notice and fix typo in foo.file
...
git add foo.file
git ci --amend

When you do the amend check-in, your editor will pop up, allowing you to re-edit the commit message if desired.

Obviously, if you’ve done a commit to a remote/public repository, amend has issues, similar to reset.

Also, I have entries like this in my .gitconfig, hence “git ci” rather than “git commit”.

[alias]
        ci = commit
        co = checkout
        st = status
        br = branch

Python-iView

A nice tool written by Jeremy Visser – Python-iView.

As Jeremy says on his blog: “Python-iView is an alternative frontend to ABC iView, which … is an awesome ABC TV programme catchup service that lets you watch most ABC programs from the last month in your browser… However, the iView website has some major problems… To address this, I wrote the open source (GPLv3) application Python-iView, which … allows you to download episodes to your hard drive in their original FLV format.”

Thanks Jeremy!

Python, Lambda, Closures

(apologies to slug planeteers for the duplicate info).

A very interesting post from André Pang about some issues he came across with lamdas and closures in Python. Well, interesting to me because I’m playing with Lisp and Python at the moment…

Some links from his blog, in case the original post ever disappears:

A nice snippet of code to remind me of the issues:

def callback(msg):
    print msg
funcList=[]
for m in ('do', 're', 'mi'):
    # funcList.append(lambda: callback(m))
    funcList.append(lambda m=m: callback(m))
for f in funcList:
    f()