Saturday, April 24, 2010

script to copy file to remote server (Using scp)

I always want to copy files to my athena account, which is the server in our lab where i have an account.So i wrote this script , which helps me not to write a long line command always.


if [ $# -lt 1 ]
  echo "Error:Specify atleast a file"
  exit 1 ;

echo "Specify Destination folder"
read dest;

for file in $@
  if [ -f $file ]
    echo "Copying file $file to $dest"
    scp $file b070147cs@$dest
    if [ $? -eq 0 ]
      echo "Successfull"
      echo "Error :copying" 
    echo "Error: $file doesnot exist"
    exit 2 ;

exit 0;

And if you have done as per this post(see here) , you can save typing passwords too .

Saturday, April 17, 2010

PHP script for getting tweet updates

Here is the php script to get updates from a twitter account.

   $uname = "YourUserName";
   $url = "$uname.rss";
   $rss = @file_get_contents($url);

          $xml = @simplexml_load_string($rss);
          if($xml !== false)
                 foreach($xml->channel->item as $tweet)
                       echo $tweet->pubDate."\n";
                       echo substr($tweet->description,10)."\n";
                   echo "Error: RSS file not valid!";
          echo "Error: RSS file not found, Invalid username";

Thursday, April 15, 2010

Downloading youtube videos

There are lot of ways you can download youtube videos.I will mention a few online downloaders..
Different methods are here:
  1.   Replace youtube in the URL by voobys
     If the url of the video is ,change it to , You can download the video from this link.

   2) Add "kiss" to the youtube URL
         So change the above url as
   3) Add ok to the URL
           Change url as

  4) Some other webpages where you can download youtube videos:
  5) For those who prefer command line terminal , use Youtube-dl package . You can then  download the video by typing   youtube-dl 
But remember downloading vids is forbidden by the Terms of Service of youtube and in some cases illegal.You can watch them on YouTube and you can, providing the video owner lets you, "embed" them to other sites using the code beside the video you want to show off elsewhere.  And you can use the email function to send them to people who you want to show it to.
All that is done on YouTube, directly on the video's page itself.  :)

Monday, April 12, 2010

Searching mails in Gmail

Recently i was searching for a method to get all my unread mails from my inbox in gmail. I felt it very difficult to search for it manually .So as usual i googled for a solution .I was really surprised to see the power of gmail search mail option. You can simply give a search for
.All the unread mails will be one isnt ?

See below options too .

Keyword what it will do ?

from:abc --- get all mails from abc
to:abc --- get all mails send to abc

is:read --- get all read mails
is:unread --- get all unread mails
is:starred --- all starred mails

in:inbox --- mails in inbox
in:trash --- mails in trash
in:spam --- mails marked as spam

Many options are there.. Get the entire list from See here

Sunday, April 04, 2010

tweeting from the BASH terminal

i feel this an awesome script..tweet from command line terminal in linux..
script is as follows:


username="yourUserName" ;

URL="" ;

if [ $(echo "$1" | wc -c ) -gt 140 ]
echo "Whoo: Its more than 140 characters"
exit 0;

result=$(curl -u $username:$password -d status="$1" $URL) ;

exit 0 ;

save this in some file name "tweet" and make it executable ( chmod +x tweet )
And for simplicty add an alias ..
Now tweet from terminal using the command
tweet "tweeting from the command line"