Posts Tagged ‘GPL’

Anagram Solver in C

September 18, 2011 Leave a comment

Hi, Here’s a small anagram solver written in C. It works based on generating permutations of given string and comparing them using a dictionary. For fast search in dictionary, the program first creates an index of the starting location of each alphabet. It takes a few minutes to process long words.

Here’s the source code. Suggestions are always welcome, Greetings 🙂

Update: There’s a little problem in using the term ‘anagram solver’ here. An anagram solver finds words from another valid word – But this program finds words from the characters of given valid/invalid word.  Thanks to technikhil for the info 🙂


C program to extract email IDs from a file

Here’s a small program to extract email IDs from an input file. It could have done using regex (in Python or  in any other high level language), but doing it in C is more fun, eh? 🙂

The code is here!

Usage: parseEmail [FILE]

Suggestions and improvements are always welcome 🙂 Thank you!

Irssi notification in terminal using ‘write command’

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 ‘’.

Step 2 : Replace

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


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 🙂

C++ Program to tweet

September 20, 2009 16 comments

It’s very interesting to play with C++ and if it is in GNU/Linux, lots of tools like ‘wget’, ‘grep’,etc. are there to help us in time. Here is a simple C++ snippet which tweets directly to your time line. Feel free to add more features and would be great if you could share it with me too 🙂

 *      shell-tweet.cpp
 *      Copyright 2009 Ershad K
 *      Licensed under GPL Version 3
 *      Please change USERNAME, PASSWORD and compile with g++
 *      To compile - g++ shell-tweet.cpp
 *      To execute - ./a.out

#include <iostream>
#include <string.h>
#include <stdlib.h>

using namespace std;

int main()
char name[] = “username”, password[] = “password”, status[500], cmd[500];

char sym[] = {char(34),”};

again: cout << “\n Status: “;
fgets (status,140,stdin);

cout << “\n Length = ” << strlen(status);

if (strlen(status) > 139)
cout << ” Exceeds 140 character limit, Type again \n”;
goto again;

strcpy(cmd,”wget -nv –keep-session-cookies –http-user=”);

strcat(cmd,” –http-password=”);
strcat(cmd,” –post-data=”);


cout << “\n Done”;
return 0;

Easy Clarity – Connect Easily!

September 5, 2009 2 comments

‘Disconnection’ is a routine process in dial up internet. Here is an C++ snippet which dials BSNL WLL Clarity without asking for password again and again. It automatically closes on disconnection with a beep sound.

 *      easyclarity.cpp
 *      Copyright 2009 Ershad K
 *      Licensed under GPL Version 3
 *      Please change USERNAME, PASSWORD and compile with g++
 *      To compile - g++ easyclarity.cpp
 *      To execute - ./a.out

#include <iostream>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

int main ()
	char username[] = "USERNAME";
	char password[] = "PASSWORD";
	puts("\n EasyClarity - Connect wisely!\n\n");
	ofstream myfile;
	system("sudo wvdialconf"); ("/etc/widial.conf");
        myfile << "[Dialer Defaults]\nInit1 = ATZ\nInit2 = ATQ0 V1 E1 S0=0 "
               << "&C1 &D2 +FCLASS=0\nInit3 = at+crm=1;+cmux=1;+cps=33;+cta=0"
               << "\nModem Type = Analog Modem\nISDN = 0\nPhone = #777\nModem"
               << " = /dev/ttyUSB0\nUsername = "<<username<<"\nPassword = "
               <<password<<"\nBaud = 460800\nStupid Mode = 1\nAuto DNS\nCheck"
                <<" Def Route";
	system("sudo wvdial");
	cout << "\a";
	return 0;

Checknet V1.0 Alpha (GNU/Linux only)

Checknet is an application developed for slow Internet connection(especially Dial-up) users who likes to turn off monitor while downloading some files from the web. Since the monitor is switched off or else if you are working with some other application, you wouldn’t know whether the download is interrupted by connection erros. This application gives you beep-beep alerts when the connection gets dissconnected or the download is interrupted. You even need not turn your speakers ON for alerts, the alerts are from CPU :).

This programs is working based on the amount of received-data. It wil update the record every 2 seconds, if there is no change in the total recieved data, it just starts giving you alerts.

Checknet was initially created just for my personal use, hence it doesn’t feature a good interface or other extra elements. Feel free to edit it to suit your style.

Thanks to Ragsagar ettan and Sarath ettan 🙂

Click here for the executable fileClick here for the source code

e-FLAMES Beta now in GNU/Linux :)

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 <>
*      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
*      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