How to make google drive as your automated backup location using python

December 30th, 2012 Comments

Before you going to coming paragraphs of this article, I recommend you to watch following youtube video so you will get what is going to describe here:

Read following links to learn more about the authentication mechanism google API is using :

As Claudio (GOOGLE) mentioned in the above video, (, we need to use some logic (client library) to sort your crendentials for reusing. Other wise on every execution of ‘’ script, you need human interaction for getting tokens. I added 6 lines to google’s ‘’ to keep authorization code for reusing. So as long as the user has not revoked the access granted initially to the application, you don’t need a human interaction.

For more details :

You can get modified google’s using following:

git clone

Goto :

So, you got the idea how to deal with Google API and authentication to Google drive without human interaction. Now, you just need to apply your modifications to the script, suitable to your environment and then just put a cron job.

Categories: Python, Scripting

How to use memcached with python and MySQL

December 27th, 2012 Comments

memcached_banner75memcached is an open source project designed to make use of the spare RAM in multiple servers to act as a cache for frequently accessed bits of information. For example, consider a typical website; a web site served up dynamically will have certain components or information constant throughout the life of the page. Loading this information each time through a query to the database is very unnecessary. In this point the importance of caching is coming to the picture. If you have a caching mechanism on RAM rather than on a Hard Disk, you can imagine how fast it will be.

For demonstrating the performance of memcached powered application, I wrote a script called

You can clone this script from my github repository using following:

git clone

Or, if you just want to understand the script use following link :

What this script is doing:

Read more…

python digital clock

November 1st, 2012 Comments

I wrote a small python digital clock which can run on terminals. You can make use this as sleep in a finite or infinite loop in your program (If have a situation where you want a sleep ;) ). In that case, instead of showing inactive terminal, can display this digital clock.

You can clone this digital_clock from git using following:

git clone

or save following code manually and execute it.

# Author : Suku
import sys
import time
while True:
    sys.stdout.write("\r%s" % time.ctime()) # what is '\r' ? Its a terminal control code, carriage return
Categories: Python, Scripting

Convert currency values from command line

October 17th, 2012 Comments

If you are in Linux Administration field, you must study Python. There are lot off discussions we can see in Internet about Python v/s Perl. I don’t want to talk anything about it. Python will help you to automate lot of stuffs in very easy way. Python have lot of modules, built in as well as external. I usually do automation using Bash. But bash have always certain limitations and so decided to study python. I wrote a small python script for converting currency values among different currencies. You can always download latest version of it from my GitHub account using following command.

git clone

Help menu:

sgeorge-mba:~ sgeorge$ --help
usage: Example: 1 USD INR

positional arguments:
  COUNT          how many count you want to convert
  CURRENCY       which CURRENCY (code) you want to convert from
  CURRENCY       which CURRENCY (code) you want to convert to

optional arguments:
  -h, --help     show this help message and exit
  -l, --list     print all available currency code
  -v, --version  show program's version number and exit

Usage examples:

sgeorge-mba:currency_converter sgeorge$ python 1 EUR USD
1 EUR = 1.3097 USD
sgeorge-mba:currency_converter sgeorge$ python 1 USD EUR
1 USD = 0.7635 EUR
sgeorge-mba:currency_converter sgeorge$ python 2 USD EUR
2 USD = 1.5270 EUR
sgeorge-mba:currency_converter sgeorge$ python 1 INR EUR
1 INR = 0.0144 EUR
sgeorge-mba:currency_converter sgeorge$ python 1 INR USD
1 INR = 0.0189 USD
sgeorge-mba:currency_converter sgeorge$ python 1 USD INR
1 USD = 52.9000 INR

Read more…

Categories: Linux, Python, Scripting

Difference between $* and $@ in bash?

June 26th, 2012 Comments

$* and $@, both these variables expands to the positional parameters, starting from the first one.

These variables are same (expand positional parameters in same way) when using without double quotes. If these variables are using inside double qoutes, will expand positional parameters differently.

Read more…

Categories: Bash, Linux, Scripting


December 14th, 2011 Comments

In this article I am explaining IPv4 subnetting in following two situations.

1. Subnetting when given a required number of networks [Example 1]
2. Subnetting when given a required number of hosts [Example 2]

Note : You need to have basics of IPv4 address types and basics of subnetting

Example 1 :

You have a Class C network range and need to break it into 20 separate networks.

Note : Here you have the information about number of nerworks you needed.

Solution : 

Read more…

Categories: Tutorials

TCP/IP network model

November 29th, 2011 Comments

In this article I am explaining the Encapsulation part of a TCP/IP network model.

The process of sending data can be viewed as a five-step process in TCP/IP model.

Note: For understanding the things explained in this article you need to have a good idea about TCP/IP network model.

Step 1:
Create and encapsulate the application data with any required application layer headers.
For example, the HTTP OK message can be returned in an HTTP header, followed by part of the contents of a web.

Read more…

Categories: Tutorials

Find out what all filesystems are supported by linux kernel

November 25th, 2011 Comments

“/proc” contains many files critical to a Linux OS. In “/proc” there is a file named “filesystems”. And as the name implies, it contains what all filesystems are supported by a running kernel.

Read more…

Categories: Linux

“test” operators in Bash

November 25th, 2011 Comments

This article will help you to utilize the power of bash scripting for “test”ing conditions.

File tests

Read more…

Categories: Bash, Scripting

Differences between innodb and myisam mysql storage engines

November 16th, 2011 Comments

Data in MySQL is stored in files (or memory) using a variety of different techniques. Each of these techniques employ different storage mechanisms, indexing facilities, locking levels and ultimately provide a range of different functions and capabilities. By choosing a different technique you can gain additional speed or functionality benefits that will improve the overall functionality of your application.

Comparison between the MyISAM and InnoDB storage engines of MySQL.

innodb myisam


row-level locking table-level locking


supports transaction does not support transactions


foreign key constraints no foreign key constraints


row count is not stored internally and so slow COUNT(*)s row count is stored internally and so fast COUNT(*)s


automatic crash recovery no automatic crash recovery, but it does offer repair table functionality


stores both data and indexes in one file stores indexes in one file and data in another


uses a buffer pool (innodb_buffer_pool_size) to cache both data and indexes uses key buffers (key_buffer) for caching indexes and leaves the data caching management to the operating system


ACID(Atomicity, Consistency, Isolation and Durability) compliant not ACID compliant
Categories: MySQL db Server