Sending Mail through PHP Mailer using TLS

	define('SMTP_SERVER', '');
	define('SMTP_PORT', 587);
	define('SMTP_USERNAME', '');
	define('SMTP_PASSWORD', 'password');
	define('MAIL_ORDERS_ADDRESS', '');
	define('MAIL_ORDERS_NAME', 'User');

	require_once "PHPMailerAutoload.php";

		$mail = new PHPMailer(true);
		$mail->SMTPAuth = true;
		$mail->Host = SMTP_SERVER;
		$mail->Port = SMTP_PORT;
		$mail->Username = SMTP_USERNAME;
		$mail->Password = SMTP_PASSWORD;
		$mail->SMTPSecure = 'tls';
		$mail->Subject = 'Mail test ';
		$mail->AddAddress('', 'Receiver');

		if(!$mail->Send()) throw new Exception($mail->ErrorInfo);
	catch(Exception $e){
		echo $e->getMessage();

Gnome3 · Linux

Archlinux User Theme Fix for Gnome Shell 3.4

Install User theme from Gnome extensions website. Which is accomplished by clicking the OFF button (top left). It will ask for your permission to install. Proceed and then it will be installed under you home directory. Once succesfully installed OFF will turn to ON

But if you check gnome tweak tool, most probably, shell theme will be seen disabled. The fix is mentioned in the comments section of the page.

sudo cp $HOME/.local/share/gnome-shell/extensions/user-theme\ /usr/share/glib-2.0/schemas/

sudo glib-compile-schemas /usr/share/glib-2.0/schemas

Now check gnome tweak tool, you will be able to change the shell theme.

Bash · Linux · Perl · Ruby

A program to chart your bandwidth* usage in linux

Version 0.2 of inetstat has been released.

Get it from

git clone git://
cd inetstat

It now includes a charter program, in order to run it, you need to have GD::Graph perl module. Either install it from system repositories or from cpan.

In Linux Mint

sudo apt-get install libgd-graph-perl

With cpan

cpan GD::Graph

Now run in you terminal

You also have the freedom to specify an output file ( uses barchart.png by default ). -o mychart.png

That’s it. Have a great day!.

*by bandwidth, I’m referring to monthly data transfer.

Linux · Vim

Switching Vim Colors Revisted

This script does things a bit differently. Also, I have used rand to generate random number. So you need to have rand installed.

sudo apt-get install rand

The Script

" colorswitch.vim - Switch between installed Vim color schemes
" Usage:
" 		F8 Switches to next Color Scheme
"		Shift-F8 Switches to previous one
"		Alt-F8 Switches to a random one

if v:version < 700 || exists('loaded_schemes')

if !exists('g:colors_name')
colorscheme default

let loaded_schemes = 1
let s:paths = split(globpath(&runtimepath, 'colors/*.vim'), "\n")
let g:mycolors = map(s:paths, 'fnamemodify(v:val, ":t:r")')

function! SwitchColorRandom()
execute "let random_number = system('rand -M " . len(g:mycolors) . "')"
execute 'colorscheme ' g:mycolors[random_number]
execute 'colorscheme'

function! SwitchColorForward()
let s:idx = index(g:mycolors, g:colors_name)
if s:idx < len(g:mycolors)
execute 'colorscheme ' g:mycolors[s:idx + 1]
execute 'colorscheme'

function! SwitchColorBackward()
let s:idx = index(g:mycolors, g:colors_name)
if s:idx >= 1
execute 'colorscheme ' g:mycolors[s:idx -1]
execute 'colorscheme'

nnoremap <F8> :call SwitchColorForward()<CR>
nnoremap <S-F8> :call SwitchColorBackward()<CR>
nnoremap <A-F8> :call SwitchColorRandom()<CR>

If you don’t have many color schemes installed  then you can go to this page and download Then extract it to ~/.vim/colors/

Next if you want to try the above script, save it in ~/.vim/plugin. Next time you open vim you will be able to access it via below mentioned shortcuts.

F8 – Test Next Scheme

Shift – F8 – Test Previous Scheme

Alt – F8 – Test a Random One

Happy Switching 🙂

Linux · Vim

Switching Colorschemes in Vim

If you have lots of vim color schemes and you want to check each one out, then, I don’t think anything could be better than this. Check it out.

If you are unsure of how to use it, first save the file ( Found below the Script Section or download it from here) into your plugin directory  ~/.vim/plugin. If it’s not there, make one.

mkdir -p ~/.vim/plugin

cp setcolors.vim ~/.vim/plugin

Restart vim or you can source the file from Vim for immediate effect, like done below.

:so ~/.vim/plugin/setcolors.vim 

Now press F8 to try next scheme
Shift F8 to try previous scheme ( if any )
Alt F8 to try a random one.


Linux · Mint


GoldenDict is a very useful dictionary look program, I have yet to find something similar in Linux with all the features that GoldenDict provides.

You can install it Mint by.

sudo apt-get install goldendict goldendict-wordnet

Noticeably ,the very useful of its features is Scan Popup. In fact, I accidentally found this app by searching for this functionality. What it does is it pop-ups with the word meaning when you select a word. This can be a little more customised, like you can specify it to only open when selected keys are pressed. By default Scan Popup functionality is disabled in GoldenDict. You can change it in preferences and make it always start with Scan Popup turned on.

There are many other features in it which you can enable from the preferences. Don’t forget to install goldendict-wordnet package it will aid as offline dictionary which I found very useful.  Ofcourse you can install many other supported dictionaries, by default it comes with Wikipedia enabled.  You might find it very useful.

Some Screenshots.