Thursday, September 18, 2008

Setup Virgin Media broadband on Linux

The problem with Virgin Media is they don't support Linux.

If you want to setup your broadband connection using Virgin Media, then you need to run their installation CD using either a Windows or Mac machine. I don't know how the installation would run using WINE on Linux, although I haven't tried it.

Fortunately I have come across this URL which allows you to setup your connection without having to run the CD.

http://act2.virginmedia.com

Getting my broadband connection setup using Virgin Media wasn't a problem for me since I dual boot, although I do hope this post will be useful for any Linux users who are experiencing difficulty.

Or better yet, try using an alternative ISP that does provide half decent support for Linux.

Tuesday, September 16, 2008

Twittering with a shell script (or Zen Twitter)

If I wanted to update my status on twitter then I used to have to open my web browser, go to twitter.com, login, then update my status.

Thanks to chimeric I now have an easier way of updating my status on twitter by simply just running the script from my menu that opens a dialogue box for me, which I use to enter my status then click OK ... and that's it!

It's basically just a shell script that uses cURL and Zenity, which has been named Zen Twitter ... either in the sense of simplicity or the fact that it uses Zenity, or maybe both.

This is how the shell script looks, simply just copy/paste into a text editor, enter your user name and password, then save as zentwitter.sh.

#!/bin/bash
# @author Michael Klier 
# @www    http://www.chimeric.de/pojects/ZenTwitter

# trivial twitter status update client

# set username/password
USER="user name"
PASS="password"

# main script
URL="https://twitter.com/statuses/update.xml"
ZENITY=/usr/bin/zenity
CURL=/usr/bin/curl

# check if zenity is installed
if [[ ! -x $ZENITY ]];
then
   echo "ERROR: Zenity is missing!"
   exit 1
fi

# check if curl is installed
if [[ ! -x $CURL ]];
then
   $ZENITY --error --text="ERROR: curl is missing" --title="ZenTwitter"
   exit 1
fi

# get tweet
tweet=$(${ZENITY} --entry --text="Gimme your tweet:" --title="ZenTwitter")

if [[ "$?" == 1 ]];
then
   exit 0
fi

while [[ $(echo "${tweet}" | tr -d ' ') == "" ]];
do
   tweet=$(${ZENITY} --entry --text="D'oh! You entered nothing! Try again or cancel:" --title="ZenTwitter")
   if [[ "$?" == 1 ]];
   then
       exit 0
   fi
done

# update status
$CURL -u ${USER}:${PASS} -d status="${tweet}" ${URL} -k

if [[ "$?" == 0 ]];
then
   $ZENITY --info --text="Updated successful!" --title="ZenTwitter"
   exit 0
else
   $ZENITY --error --text="Something went wrong!\nRun ZenTwitter.sh from a commandline for more information!" --title="ZenTwitter"
   exit 1
fi

Remember to insert a carriage return at the end of this script.