Today I decided that I’m going to give twitter another try, but the first thing that struck me was how cumbersome it was to actually post a tweet.

The way I did it:

  1. Open your favourite browser
  2. Go to twitter.com
  3. Log in
  4. Write a tweet

I’m a Linux user and I love the terminal. Wouldn’t it be better to write tweets from the terminal? – Yes it would!

I have written a quick and dirty python script that enables you to write tweets from the terminal.

You can download the script here.

Install guide for Debian:

Step 1: Download

$ wget http://dibon.net/tweet
$ chmod +x tweet
$ sudo mv tweet /usr/bin/

Step 2: Install curl

The script uses curl to send data to twitter, if you don’t have curl installed you have to install it:

$ sudo aptitude install curl

Step 3: Make the config

Make a file called “.tweet” in your home directory:

$ vim .tweet

And insert the following:

[login]
username = YOURUSERNAME
password = YOURPASSWORD

You may want to edit the permissions for the file

$ chmod 0700 .tweet

That’s about it. You may have you reopen your terminal window before you can use the tweet command.

Usage:

$ tweet "I'm writing a tweet in terminal!"

Unfortunately it is necessary to use single or double quotes before and after the message.

Learn Python in 10 minutes

June 22nd, 2008

My friend He Yu provided me with a link where you can learn Python in 10 minutes. A nice introduction to Python assuming that you know general programming.

I’m looking into Python for two reasons. One; I want to expand my knowledge of programming languages. Two; Next term I’m taking the course Introduction to Algorithms where Python is the language we will be using. It’s always nice to have a head start.

Update:

It turns out that the professor teaching the course has written books about Python and also written a short tutorial. Click here for tutorial.