Archive for the 'Internet' Category

twitpie: Twitter Commandline Client

Jun 16, 2008 in Internet, Programming, Python

A simple need, solved in a simple way - a twitter client for those wanting command-line access and auto-refresh + posting tweets from the same place. It does not implement anything fancy. Just the basic features.

You can choose to expand on the source code and/or leave comments so that I can update it and let everyone else also enjoy a better client.

#!/usr/bin/env python
#
#           twitpie
#
#           Twitter Command Line Client
#
#           A simplistic client useful to get a auto-refreshed feed of your
#           + friends timeline and to post tweets.
#
#
# Author:   Harshad Sharma
#           http://www.twitter.com/hiway
#           harshad (dot) sharma @ gmail (dot) com
#
#
# Usage:    Edit this file --> put in username and password
#           Start program "python twit.py" - it will automatically start showing
#           the latest tweets. To update or quit, press Ctrl+C
#           Type in a tweet and press enter to post the update.
#           simply type 'q' to quit.
#
# Dependency:
#           http://pypi.python.org/pypi/python-twitter/
#
# License:
#           This program is free software: you can redistribute it and/or modify
#           it under the terms of the GNU General Public License as published by
#           the Free Software Foundation, either version 3 of the License, or
#           (at your option) any later version.
#
#           This program is distributed in the hope that it will be useful,
#           but WITHOUT ANY WARRANTY; without even the implied warranty of
#           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#           GNU General Public License for more details.
#
#           You should have received a copy of the GNU General Public License
#           along with this program.  If not, see .

import twitter
import time

# Add your username and password here…
api = twitter.Api(username=’twitterusername’, password=’twitterpassword’)     # <--- EDIT HERE

version = 0.1
finished = False

# Loop till finished is changed to True
while finished == False:
    try:
        # Create an empty list.
        tweets = []

        # iterate throgh the friends timeline and gather data.
        for i in api.GetFriendsTimeline():

            #-------- Choose your fave formatting: --------
            # keep only one line uncommented at a time.

            #tweets.append( "%s (%s) \n%s\n" %(i.user.name, i.relative_created_at, i.text))
            #tweets.append( "%s | %s (%s)\n" %(i.user.name, i.text, i.relative_created_at))
            #tweets.append( "(%s) %s" %(i.user.name, i.text))
            #tweets.append( "%s: %s" %(i.user.name, i.text))
            tweets.append( "%s\n%s\n" %(i.user.name, i.text))

        # Since we want the latest tweets to appear near the prompt instead of
        # scrolling up... (if you want it the other way round, comment the line)
        tweets.reverse()

        # Iterate over the list and print
        for tweet in tweets:
            print tweet

        # Wait for some time...
        time.sleep(3*60) # 3*60 = 3 minutes

    except KeyboardInterrupt: # If user presses Ctrl-C, do the following:

        # Get imput - either tweet or command to exit.
        tweet = raw_input("\n\nWhat are you doing (q=quit | r=refresh): ")

        if tweet.lower() == 'q':
            # Exit loop by setting the flag
            finished = True
        if tweet.lower() == 'r':
            pass
        else:
            # User wants to post a tweet... do it :-)
            api.PostUpdate(tweet)

Google Speaks Hindi!

May 03, 2008 in Computers, Internet, news

I happened to browse to Google’s Language tools today, and I was in for a surprise - it offered me to translate from English to Hindi and back from Hindi to English!

If you know it already, no fun, but since I had not checked it recently, it came as quite a surprise! Here’s my Twitter page… all tweets translated by google.

Twitter translated to Hindi by google language tools

Isn’t it fun?

I’m happy that a lot more people from my country will be able to browse the Internet and understand the content in their own language. Go Google!

Link: http://translate.google.com/translate

And The Reason is… Twitter!

Apr 29, 2008 in Computers, Internet

I’ve been addicted to Twitter for past few months. Signed up during the early few days of twitter, but never happened to use it much - none of my friends were ready to spend 5 INR per text message (SMS) and send messages saying what they were doing at any given time.

Later, using twitter from the web became more common instead of costly messages… still no sign!

Then finally, after almost a year, there was a surge in Indian twitter users, and the place became chatty, twittery even! With the number of people rising, I too got involved in conversations… and before I knew it, I was looking forward to waking up early in the morning to catch up with all the tweets of the office-going tweeters on my list!! This was a drastic change in habit that *nothing* had been able to induce till date.

Peer pressure - no, nobody asked me to wake up. Eagerness to keep up with interesting people - absolutely yes!

Thank you Twitter for making me a early to bed early to rise geek! :-P Now I can enjoy the day and enjoy company of geeks at the same time!

P.S. You can follow my updates here: http://twitter.com/hiway

BSNL Broadband Slow Like Hell

Mar 05, 2007 in Computers, Internet

It is 3:43 am, when most other users are offline, I am trying to download KDE 3.5.5 source packages for my newly installed FreeBSD 6.2 on AMD64 machine - I am using a 256 Kbps BSNL DataOne Broadband connection. On January 2007, BSNL announced that it has upgraded all users for speeds upto 2 Mbps. Yes, I enjoy the speed - and I am thankful to BSNL. However, as I watch the progress of my downloads, there’s nothing else than “SHOCK” that awaits me.

Here’s a sampler from my Python download session:

Python-2.4.3.tgz                                5% of 9129 kB 3775  Bps 39m04s

3775Bps, around 3 KBps which comes around to 3*8 = 24 Kbps. Am I being served 10 times slower internet or what?

This is not just for one or two downloads. I tried reconnecting, hoping vainly that things might magically sort themselves out. I tried to check my DNS settings (Regular and OpenDNS both) both resolve fine. This is not the first time this has happened. It’s becoming a regular P.I.T.A., and I’m very much frustrated with it. If BSNL decides to make the 2 AM to 8 AM block free for all users (no charges for downloads) then they should at least give the minimum promised 256 Kbps speed!!! 24 kbps is just #$%@#$% #%$@@.