Archive

Archive for the ‘Uncategorized’ Category

The little twitter client I use :)

March 12, 2011 2 comments

Here’s a small python script to update and read tweets from different timelines. You can use it with head/tail commands to customize the output. Actually, I wrote this script just for personal use and now I would like to share it with you :) Thanks to tweepy python module, make sure it’s installed before trying the script :)

#!/usr/bin/env python
# Copyright 2011 Ershad K <ershad92@[nospam]gmail.com>
# Licensed under GPL Version 3

import sys
import tweepy

CONSUMER_KEY = ' Fill here'
CONSUMER_SECRET = ' File here too'
ACCESS_KEY = ' Type yours here'
ACCESS_SECRET = 'Type yours here too'

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

if sys.argv[1] == 'u':
    api.update_status(sys.argv[2])

elif sys.argv[1] == 'p':
    public_tweets = api.public_timeline()
    for tweet in public_tweets:
        print tweet.user.screen_name,":",tweet.text
        print ""

elif sys.argv[1] == 'r':
    mention_tweets = api.mentions()
    for mtweet in mention_tweets:
        print mtweet.user.screen_name,":",mtweet.text
        print ""

elif sys.argv[1] == 'h':
    friends_tweets = api.home_timeline()
    for ftweet in friends_tweets:
        print ftweet.user.screen_name,":", ftweet.text
        print ""

Hope you like it :)

Python Script to fix VBR errors of mp3 files in a directory, recursively

February 19, 2011 8 comments

If the seek bar of your rhythmbox is not working with some mp3 files, it might be an issue with Variable Bit Rate of them. The tool, ‘vbrfix’ written by William Pye solves the issue, but the problem is that it doesn’t have an option to search for files recursively. Here is a small python script that gets the paths of multiple mp3 files recursively and give them as arguments to vbrfix tool. Make sure you install vbrfix (from the software repo) before running the script.

Please see comments for a better, 1 line substitute to do the same. Thanks to Rajeesh ettan and Syam ettan :)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#       vbrfixdir.py
#
#       Copyright 2011 Ershad K <ershad92@gmail.com>     
#
#       Usage: python vbrfixdir.py
#
#       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 2 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, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.

import sys
import os

quote = '"'
folder = sys.argv[1]
find_command = "find " + folder
find_command += " > mp3files_list"

os.system(find_command)
os.system("sed 1d mp3files_list > mp3files_list1");

f = open("mp3files_list1", 'r')
for line in f:
    line = line[:len(line)-1]
    command = "vbrfix -always "
    command += quote + line + quote
    command += " " + quote + line + quote
    print command
    os.system(command)

os.system("rm mp3files_list mp3files_list1")

Improvements to code and suggestions are always welcome, Happy Hacking :)

Irssi notification in terminal using ‘write command’

May 10, 2010 Leave a comment

In Desktop Environments like KDE or GNOME, we have special libraries like knotify or libnotify to display notifications from various applications. Some applications like Konversation has its own notification systems. But what about command line tools like Irssi? Imagine you are chatting in tty1 using irssi and doing something in tty2.How will you know if someone has mentioned you nick in channel message? Well, here is a small solution for this.

Luke Macken has written a wonderful  perl script to display notifications using notify-send command in desktop environments. Thanks to open source, I tweaked the call to notify-send command to suit our tty-notification. All that you have to do is this :

Step 1 : Get the Script and write it to a file ‘notify.pl’.

Step 2 : Replace

system(“notify-send -i gtk-dialog-info -t 5000 ‘$dest->{target}’ ‘$stripped’”);

With

system(“echo ‘$dest->{target}’ ‘$stripped’ | write <Your username>”);

Make sure you replace <Your username> with your system username.

Step 3 : Put it in ~/.irssi/scripts/ directory.

Step 4 : Execute the following commands in irssi:

/load perl
/script load notify

Done, you will get notification to the latest tty to which you are logged in!
Good luck :)

PS: The notification that you get is not eye-candy, please adjust for it now :)

Configure Gmail in Mutt easily!

April 21, 2010 Leave a comment

It’s always wonderful to play with terminal. Last week, I tried to configure my Gmail account in mutt, a powerful console based mail client, using this tutorial. I had to create some configuration files for various related applications and executed some commands. Hence I thought it would be nice if there is any script/program to configure mutt easily by simply entering the Gmail ID and password. Here is such an application, written in C++, which will help you to configure mutt very easily. All that you need to do is install mutt and follow these steps :

1. Download this file
2. Exctract it to your home directory
3. Execute the following commands :

$cd muttgconf
$./muttgconf

VERY IMPORTANT: THE PROGRAM CREATES / MODIFIES MANY CONFIGURATION FILES. I WILL NOT BE RESPONSIBLE FOR ANY DAMAGE OR LOSS CAUSED BY THIS APPLICATION. USE IT UNDER YOUR RISK.

Get its source from git://github.com/ershad/Mutt-Gmail-Conf.git    Good luck :)

Setting up Malayalam and installing swanalekha in sabayon 4

May 15, 2009 4 comments

Though the Sabayon 4 DVD release comes with SCIM , it’s not possible read Malayalam or write using swanalekha by the usual methods. Let’s see how to do it.

Type in terminal:

$sudo bash

#wget http://ershad.freehostia.com/download/AnjaliOldLipi.ttf

#cp AnjaliOldLipi.ttf /user/share/fonts/

Now you can read Malayalam :), To type using swanalekha, do the following :

#wget http://ershad.freehostia.com/download/install-swanalekha.tar.gz

#tar -xvf install-swanalekha.tar.gz

It’s done, Right click the text box, select “SCIM input method” and start typing !!

Select SCIM from right click menu

Unfortunately this is not working in firefox. Please inform me if there is any mistake or bug. Thanks to SMC :)

Categories: Uncategorized Tags: , , ,

A journey with sabayon…

May 12, 2009 2 comments

Think of a wonderful world where you have every basic needs without much difficulty and effort. Quite interesting??  well,  This is what sabayon explains, where you will feel heaven if you are using slow Internet without compromising in quality and support.  A bit confusing ?? we’ll see…

My journey with GNU/Linux  started with gentoo  2 years before, when I had a tough time installing it as dual boot  and of  course, it  ended up in the complete data loss !! My next linux-try was ubuntu 8.04, the one that Jesse had given, was easy to install and use. The next OS’ that i tried was  ubuntu 8.10, ubuntu 9.04, kubuntu 8.10 and fedora. But the problem with all these was they are CDs !! Though they contain all basic softwares and packages, it was a tough job to get additional ones. I had to rely on my slow Dial up connection which would take 15 minutes to download 10 MB!! So the one and only choice was to get a DVD based distro.

For the past few weeks,  I was searching for such a DVD release distro so that the rate of software and package downloads can be minimised considerably. My next step was to find such a disrto. To download nearly 4.5 GB @ 16 kbps speed is obviously a nightmare. Then i thought of taking copy, but the source became a issue. As i don’t have any Linux based magazine’s subscription, it was almost impossible.  But later  i came to know that one my friends has such a subscription and he has a  DVD that contains sabayon 4.

Then the things went pretty fast. The installation of sabayon was easy and without XFCE and games, it consumed nearly 9 GB and  took 44 minutes to complete in my P4 2.6 GHz, 1.2 GB RAM Desktop.  The intial boot soon after the installation was slow and it took around 2 minutes to get the login screen. Even now, it is a wonderful sight for me to see many desktop environments including KDE, GNOME etc.. in sessions menu :)

Sabayon 4 has all basic free software and package by default. sabayon is meant for all type of users. The software collection explains this.  Inkscape, GIMP etc… are meant for graphic enthusiasts where GCC, JAVA,Python,etc.. are there for programmers. Like these, sabayom comes with many pretty and useful softwares so that users dont have to spend time searching for them. Well, there are the good sides of sabayon. As always, it has another side which is not serious but which worths mentioning here. In ubuntu and other distros, we can install any software or package by running ‘apt-get install’ in terminal which is not possible in sabayon. Also, sabayon dont support deb/rpm packages by default though the team claims it is not necessory where the internal package manager is more than enough. But it would have been better if  sabayon supports that also. Next issue is that, it doesn’t support malayalam by default where i had to install it manually.

Well, I’m not going more technical because, this is my limit. I should stop here, the rest ie about it’s core,kernel, working, etc… are available over web. Please have a look at it if you are interested. I haven’t read this post twice, so they are chances for grammatical/technical/spelling mistakes. Please point them out. Thank you

Categories: Uncategorized Tags:

e-FLAMES Beta now in GNU/Linux :)

April 8, 2009 3 comments

Hello friends,

I’m glad to present the Beta version of e-FLAMES for GNU/Linux before you. Thanks to Jesse, for his valuable header file with  getch() function in GNU/Linux.  I have made minor changes in this version and now, it’s licensed under GPL V3. The  program still has some errors when strings with special characters are given as input. Please help me correct those and make this program bug-free.  I expect to release the final version before the end of this month. Till then, please try this program and give me your valuable comments.

(Click here to download GNU/Linux executable)

Here are the screenshots :

The source code is written in C++ using Geany as IDE. The source code is given below …

/*
*      e-FLAMES.cpp
*
*      Copyright 2009 Ershad K <ershad92@gmail.com>
*
*      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 2 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, write to the Free Software
*      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
*      MA 02110-1301, USA.
*/

//Including header files..
#include <iostream>
#include <string.h>
#include <stdlib.h> //for system() function
#include “jesse_conio.h”

char name1[30], name2[30]; //declaring global name variables

using namespace std; // dunno what’s this, please tell me..

void message(); // for general headings and texts

void getnames(); // for names input

void copyright(); //print copyright notice

void changecase( char names[]); //change case function

void removespecial(char name_1[]); //remove spaces

(Click here to view full source) (Click here to download GNU/Linux executable)

This source code can be used in windows also with a few changes in headers and can be succesfully compiled. Please add more features and it would be better if any one works to bring out a GUI version of e-FLAMES. Hope you would like this one and feel free to add your suggestions and opinions as comments. Best Wishes

Follow

Get every new post delivered to your Inbox.