Msmtp is a small but powerful and highly customizable smtp client. You can access gmail smtp using msmtp, which is exactly what I’ll teach in this tutorial.
Step by step instructions:
Install msmtp and ca-certificates for use with SSL:
Here’s a function which thoroughly checks email-address and returns true for a valid email address and returns false for invalid one. I thought it was worth sharing so I posted it on my blog. You will find the source link at the bottom.
/**
Validate an email address.
Provide email address (raw input)
Returns true if the email address has the email
address format and the domain exists.
*/function validEmail($email){$isValid=true;$atIndex=strrpos($email,"@");if(is_bool($atIndex)&&!$atIndex){$isValid=false;}else{$domain=substr($email,$atIndex+1);$local=substr($email,0,$atIndex);$localLen=strlen($local);$domainLen=strlen($domain);if($localLen<1||$localLen>64){// local part length exceeded$isValid=false;}elseif($domainLen<1||$domainLen>255){// domain part length exceeded$isValid=false;}elseif($local[0]=='.'||$local[$localLen-1]=='.'){// local part starts or ends with '.'$isValid=false;}elseif(preg_match('/\\.\\./',$local)){// local part has two consecutive dots$isValid=false;}elseif(!preg_match('/^[A-Za-z0-9\\-\\.]+$/',$domain)){// character not valid in domain part$isValid=false;}elseif(preg_match('/\\.\\./',$domain)){// domain part has two consecutive dots$isValid=false;}elseif(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',str_replace("\\\\","",$local))){// character not valid in local part unless // local part is quotedif(!preg_match('/^"(\\\\"|[^"])+"$/',str_replace("\\\\","",$local))){$isValid=false;}}if($isValid&&!(checkdnsrr($domain,"MX")||checkdnsrr($domain,"A"))){// domain not found in DNS$isValid=false;}}return$isValid;}
I came across this error while trying to run BloGTK.
I tried installing it from repositories but it failed:
sudoapt-getinstall python-gtkhtml2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-gtkhtml2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package python-gtkhtml2 has no installation candidate
I came across this simple script on ubuntuforums which I thought was really very useful and worth sharing it on my blog. You can either make a function out of it and put it in .bashrc file or make an executable script and put it in /usr/bin/.
Method 1:
Open your ~/.bashrc file using any editor.
gedit ~/.bashrc
Copy and paste the following code at the end of it:
extract-file (){if[-f $1] ; thencase $1in*.tar.bz2)tar xjvf $1;;*.tar.gz)tar xzvf $1;;*.bz2)bunzip2 $1;;*.rar) rar x $1;;*.gz)gunzip $1;;*.tar)tar xf $1;;*.tbz2)tar xjvf $1;;*.tgz)tar xzvf $1;;*.zip)unzip $1;;*.Z) uncompress $1;;*.7z) 7z x $1;;*)echo"'$1' cannot be extracted via extract-file";;esacelseecho"'$1' is not a valid file"fi}
Now you can use the following command to extract any archive:
extract-file
The command extract-file would be available only to terminals which have been opened after saving the .bashrc file with the above code. Also this code is user-specific, so if another user logs in he cannot use this command.
Method 2:
Use the following command to create a new file in /usr/bin directory and launch the gedit.
There are lots of commands to find out your ditribution name and distribution version. Some work on some distros, some work on others. Here are some of the methods:
lsb_release -a
cat /etc/*release
cat /etc/issue
cat /proc/version
uname -a
One of these methods will surely tell you your linux distribution name and current version.
I was free, so just decided to see how browsers compare on Google’s sputnik test. Its a test about javascript conformance. Well, here’s the introduction from site:
Sputnik is a JavaScript conformance test suite containing over 5000 tests. It tests how well a JavaScript implementation adheres to the ECMA-262 specification version 5, looking only at those features that were also present in the previous version, version 3, and not the new features added in version 5.
So, in essence its a test which checks how complete a browser’s javascript engine is and how well does it complies to standards.
I decided to test: Mozilla Firefox 3.6.6 Google Chrome 5.0.375.86 and Opera 10.60
Opera 10.6 which was released yesterday is currently one of the fastest browsers. It has beaten Chrome in javascript speed test. It also features better support for HTML5, WebM video support.
You can now install it on Ubuntu via PPA.
Add the PPA in your repository:
sudo sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list'
To err is human. Humans forget things, MySQL root password is one of those things. However, its not very difficult to reset the root password if you have root access to the machine.
The tutorial does seem a bit long because of all the alternate ways to kill and start the mysqld, but trust me its simple.
Here’s in short what we will be going to do:
Step 1: Stop mysql server process
Step 2: Start mysqld with --skip-grant-tables option.
Step 3: Run mysql without any parameters.
Step 4: Change the root admin password (old password not required.)
Recently I got this error after installing VLC on Ubuntu 10.10 Maverick Meerkat. Not really remembering what caused the error to be triggered in the first place, it became very difficult to find a solution for it. When I executed sudo apt-get upgrade to upgrade my packages, it told me there was some issues and I needed to execute sudo apt-get -f install to fix them. I did as advised but it produced the following error:
Reading package lists… Done Building dependency tree Reading state information… Done Correcting dependencies… Done The following extra packages will be installed: vlc vlc-nox Suggested packages: mozilla-plugin-vlc videolan-doc The following packages will be upgraded: vlc vlc-nox 2 upgraded, 0 newly installed, 0 to remove and 198 not upgraded. 66 not fully installed or removed. Need to get 0B/5,258kB of archives. After this operation, 229kB of additional disk space will be used. Do you want to continue [Y/n]? y WARNING: The following packages cannot be authenticated! vlc vlc-nox Install these packages without verification [y/N]? y (Reading database … 206759 files and directories currently installed.) Preparing to replace vlc 1.1.0-1~ppa1~maverick (using …/vlc_1.1.0-1ubuntu1_i386.deb) … Unpacking replacement vlc … dpkg: error processing /var/cache/apt/archives/vlc_1.1.0-1ubuntu1_i386.deb (–unpack): trying to overwrite ‘/usr/lib/vlc/plugins/access/libxcb_screen_plugin.so’, which is also in package vlc-nox 1.1.0-1~ppa1~maverick dpkg-deb: subprocess paste killed by signal (Broken pipe) Preparing to replace vlc-nox 1.1.0-1~ppa1~maverick (using …/vlc-nox_1.1.0-1ubuntu1_i386.deb) … Unpacking replacement vlc-nox … dpkg: error processing /var/cache/apt/archives/vlc-nox_1.1.0-1ubuntu1_i386.deb (–unpack): trying to overwrite ‘/usr/lib/vlc/lua/playlist/anevia_streams.luac’, which is also in package vlc 1.1.0-1~ppa1~maverick dpkg-deb: subprocess paste killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/vlc_1.1.0-1ubuntu1_i386.deb /var/cache/apt/archives/vlc-nox_1.1.0-1ubuntu1_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
After some time of googling and head-scratching, I finally found a solution and it wasn’t that difficult either. To fix it just note down the path of files which are causing the trouble. From the above mentioned error, we can clearly see that there are these two files causing the error: Read the rest of this entry »
Linux is awesome and so is the terminal. Things become a lot more easy if you can just type in few commands and get your work done. Downloading youtube video has always been messy with GUI downloaders, browser extensions and web services which claim to give you the download link to that video. Now, you can download it from the terminal using youtube-dl in ubuntu. You can also download and install it in other flavors of linux. The script is written in python.
Install youtube-dl from the official repository in Ubuntu: