Why you need to improve your training data, and how to do it

Pete Warden's blog

sleep_lostPhoto by Lisha Li

Andrej Karpathy showed this slide as part of his talk at Train AI and I loved it! It captures the difference between deep learning research and production perfectly. Academic papers are almost entirely focused on new and improved models, with datasets usually chosen from a small set of public archives. Everyone I know who uses deep learning as part of an actual application spends most of their time worrying about the training data instead.

There are lots of good reasons why researchers are so fixated on model architectures, but it does mean that there are very few resources available to guide people who are focused on deploying machine learning in production. To address that, my talk at the conference was on “the unreasonable effectiveness of training data”, and I want to expand on that a bit in this blog post, explaining why data is so important…

View original post 3,917 more words

Manipulating image pixels with python scikit image – color schemes

Scikit Image is an image processing library in python. It is a huge collection of algorithms and available for free of cost. This library can perform a variety of complex image processing like denoising, color scheme changing, image stabilization, perspective correction, edge and contour detection, etc. There are many powerful techniques that can be using in manipulating image pixels. Being the first article in the series of image processing articles with Scikit Image, in this tutorial, we will start with the basics of changing the color spaces of images.

Color space indicates the color scheme used by that image. Most of the images are either in RGB (Red, Green, Blue) color space as in image 1 shown below.


Interesting Fact: This image called the lena is one of the standard images used for image processing since 1973 and it is a picture of Lena Söderberg, shot by photographer Dwight Hooker. This appeared in the November 1972 issue of Playboy magazine.
Source: Wikipedia

We will use this as the testing image for the rest of the tutorial. all the color schemes or scales belong to the scikit’s color package. Before we get to the color schemes, we’ll define a way to read an image with scikit.

1. Read, write and show Image using scikit

Images in scikit are in the form of numpy arrays.  You can use scikit to read an image as a numpy array, apply the algorithms and write the arrays back as an image. Use the following code to read/ write an image.

from skimage.io import imread
from skimage.io import imsave

# read the image
inp_image = imread("/home/akshay/lena.png")
# replace the path above with the absolute path of the image you want to read

#write image back to file

#parameter 1: path where the image has to be saved.
#parameter 2: the array of the image.

If the image is not in the form of integer values, it cannot be saved. This happens when you apply some thresholding or manipulating functions. In such a case, you will have to first convert the image values to integer and then save it. The following code will help you do just that:

from skimage import img_as_uint

imsave("/home/akshay/new_lena.png",img_as_uint(inp_image)) #img_as_uint is the secret to correctly save images that cannot be saved directly!!

you can also see the image that you have read of just about to write by calling the imshow method as shown below:

from skimage.io import imshow, show

# the 'matplotlib' is used to tell the viewer to use matplotlib plugin while plotting the image.

Now that we know how to read, write and see images programmatically, we can start with the techniques to change color scales.

2. RGB to Gray (or Grey)

The RGB is a 3 channel color scheme with Red, Blue and Green channels whereas the Gray or Grey is a 2 channel scheme.

from skimage.io import imread, imsave
from skimage.color import rgb2gray, rgb2grey

inp_image = imread("/home/akshay/lena.png")

img_gray = rgb2gray(inp_image) # rgb2grey(inp_image) can also be used


the images below show the image before and after conversion


This technique is used as a pre-processing step in many image processing techniques like thresholding/ binarization. This is very useful when you do not need a 3 channel pixel like (120,140,30) for R, G, and B respectively but have just one value like (133) which represents the gray channel.

2. Gray (or grey) to RGB

There are cases when you have a single channel grayscale image and you want to convert into a 3 channel image, then it can be done by using the gray2rgb method of scikitImage. What you must understand is that this does not convert a grayscale image to color. that is a black and white image, remains black and white image after conversion. The only thing that changes is that, before the conversion happens, each pixel are represented as a single value, example: (120) and after conversion, it is represented in 3 channels. Example: (120,120,120). Thus, you will have an RGB image.

from skimage.color import gray2rgb

inp_img2 = imread("/home/akshay/lena_gray.png")
rgb_img = gray2rgb(inp_img2)

the images below are before and after applying the conversion. As you can see, there is no visual change.



3. RGB to HSV

HSV color space stands for Hue, Saturation, and Value. This is also called the HSI or HSB color space where ‘I’ indicates Intensity and ‘B’ indicates Brightness. The HSV color space is used a lot in the artists’ community or design community who want to understand and visually see the lighting intensity or the hue present in a given image.  Some of the image processing tasks that rely on intensities need the image to be in the HSV color space. Here is how you can convert a RGB image to HSV.

from skimage.color import  rgb2hsv

hsv_img = rgb2hsv(inp_image)

The images below show the image before and after applying the filter:


4. Binarization or Thresholding

Binarization, a.k.a Thresholding refers to converting an image of any type to a binary image. Each pixel in a binary can be either black (0) or white(1).  It is important to note that for binarizing an image, the image should be in grayscale first. So we start with a RGB image and then we convert it to grayscale before applying the thresholding to it.

from skimage.color import rgb2gray
from skimage.io import imread, imsave
from skimage.filters import threshold_otsu
from skimage import img_as_uint

inp_image = imread("/home/akshay/lena.png")
img_gray = rgb2gray(inp_image)

thresh = threshold_otsu(img_gray)
binary_thresh_img = img_gray > thresh

imsave("/home/akshay/lena_thresh.png", img_as_uint(binary_thresh_img))

You might have observed that while saving the image, we are using the “img_as_uint” method to save the thresholded image. This is done because, when the image has been binarized, it is in the form of non-integer values and thus cannot be saved. So by using the “img_as_uint” we are converting the image values to unsigned integers which can then be saved by scikitImage.

Following image shows the effect of applying the OTSU_thresholding on the image. Thresholding is used for many image based solutions like Optical Character Recognition, template recognition, etc.


Book Reviews #2

From the time I’ve written the last set of book reviews, I have mostly read fictional books and one on leadership.  This article reviews 4 amazing books:

1. Krishnavatara 1/The Magic Flute

My Rating: 5/5, Goodreads Rating: 4.44/5

An extraordinary tale of Krishna and the prophecy that he had to fulfill. I remember my grandparents telling me bits and pieces of Krishna’s and Balaram’s adventures but I had never got the full story up until now when I got a chance to read this book.

It is beautifully written offering a second, more realistic perspective to the other magical versions of this same story. This book took me straight to that era where Krishna was born and I could easily imagine and experience their life, their surrounding, their difficulties with vividity. This is one of those books where you know that certain events would happen but it wouldn’t change the excitement of getting to read those parts nonetheless.

The description of historical places like Gokul, Vrindavan, Mathura with their lush landscapes, palaces and the lives of people are breathtaking. I felt as if I was transported back in time to those places living with those people.

The book is written in a simplistic yet gripping style. I recommend it to anyone who wants to forget everything temporarily and go on an incredible adventure with Krishna and Balaram.

2. And Then There Were None

My Rating:  5/5, Goodreads Rating: 4.22/5

An enthralling book with a gripping storyline. Once I had started reading it, I couldn’t get myself to stop. The book teleported me straight to Soldier Island, the place where the story is set.

With multiple murders happening on the island, The reader’s mind races to conclude who the killer could be. Each conclusion made will be proved false soon after. It’s an amazing book written in a way where the events are presented as it is so the reader can make deductions. Vivid descriptions of the events and the surrounding give the reader’s imagination fuel to visualize the eerie surrounding and the morose atmosphere. The thoughts running through the minds of people on the island builds the suspense and tension.

The characters in the story are very well picked. We get to experience each one of them trying to best utilize their skill just to survive. Their instincts of self-preservation are completely based on their experiences in their chosen field of work. Whether it’s the doctor, the policeman, the army man or the judge, each one of their contribution to keeping everyone alive is noteworthy.

Murder mysteries have always fascinated me and this one is truly a masterpiece. I can very well relate to the author when she says ” I know how hard it was to write this book”. There are innumerable things that had to be set right for this story to be woven out perfectly and that is exactly what has been done. Loved this book from the start to the end.


3. The Ant & The Elephant

My Rating: 5/5, Goodreads Rating: 4.21/5

A brilliant book that talks about the working of our conscious and subconscious mind. I loved the analogy of the ant being the conscious mind and the elephant being the subconscious mind as it describes in clarity the potential that we have as humans.

This book is written as a story of an ant and an elephant in a desert with a wise teacher preaching the ant to learn and work with the elephant, guiding it in the process. I loved the simple way in which the author has conveyed the 5 important steps to tune and work with both your minds to reach your goals and become a better leader. The things to learn from it are direct and each lesson is accompanied by the excitement, hard work, and frustrations that we face in daily life and how we can apply the teachings to change our way of thinking and handle situations in a better way.

I felt as if is this book was written for me because the situations and reasoning were exactly what I was facing or had faced before ( turns out, a lot of people feel that this book was specifically written with them in mind) and it showed what I was doing wrong. I could experience changes early on by applying the steps mentioned in the book. Anyone reading this book will have at least one new thing to learn from.

Two quotes I liked the most in this book:
1) Gratitude is the magic ingredient in the recipe for a fulfilling life.
2) No two thoughts can occupy the mind at the same time ( think about something positive when negative thoughts come to your mind) 

4. The Hitchhiker’s Guide To The Galaxy

My Rating: 4/5, Goodreads Rating: 4.2

When I read that this was a sci-fi book about the galaxy and beyond, it immediately caught my attention. I started reading it and I loved it. It combines two genres ( sci-fi and comedy) seamlessly to bring out a wonderful story of these few people from various galaxies who embark on an adventure around the universe.

This is a book about a book. “The hitchhiker’s guide to the galaxy”  is a guide/book that helps space travelers to survive and know about new planets/ start or a solar system, and how to travel throughout the universe. The best thing about this book is the ability to bring out perspective on how a far more advanced life form than ours in the universe can still have the same mentality of people we meet or see every day and what kind of chaos it can create.

Humour is present everywhere. Right from the way different life forms are portrayed to giving consciousness to robots, it’s hilarious ( I just love Marvin.. he’s funny in his own depressed ways). Some of the scientific explanation of what we feel as impossible things are hysterical. I thoroughly enjoyed reading this book.

So, these were the 4  books I recently finished reading and all of them were awesome. Share your thoughts and recommendations in the comments below.

Book Reviews #1

I have started to read a lot and I figured that I could share what I read with others who might find this as a useful recommendation tool. If you have read books that are similar to these, you might recommend them to me as well.

This article is the first in the series and I review the following books:

  1. Inner Engineering: A Yogi’s Guide to Joy by Sadhguru
  2. Rahul Dravid: Timeless Steel (Anthology) by ESPN Cricinfo
  3. Elon Musk: How the Billionaire CEO of Spacex and Tesla is Shaping Our Future
  4. The White Tiger

1. Inner Engineering: A Yogi’s Guide to Joy


My rating: 5/5, Goodreads rating: 4.34/5

A phenomenal non-religious book on mysticism, yoga, well-being, inner peace, and more. It has been structured in two parts. The first part is devoted to making the reader understand the various processes in yoga and debunk myths. It also introduces readers to various dimensions and the non-physical experiences that are unknown to many. The second part of the book deals with the various aspects of what life is and gives numerous exercises and practical experiments for the readers to try and have a glimpse of “out-of-this-world” experiences.

There are a few things that I absolutely love about this book. Firstly, the way in which Sadhguru has explained some of the simplest things in life makes you understand its profound impact and makes you realize that perspectives can make an insignificant routine to a life changing experience. Secondly, this book steers far away from any religion, beautifully explaining its difference with spirituality. Thirdly, unlike most of the books, it does not stop at giving you hopes of the so-called “unrealistic expectations”. The author repeatedly asks the reader to experiment with what has been conveyed and gain the knowledge of peace, well-being and out of the body sensations through an experiential process. Finally, the anecdotes in this book are amazing. Some are witty, some are to the point, but all of them successfully convey the intended message to the reader.

I thoroughly enjoyed this book and learned a lot from it. It is not a manual to bliss and harmony but a catalog of what is possible. There aren’t any step-wise procedures but that is something the reader is expected to explore, experiment and seek post reading the book.

Best quote from the book: “Yoga is not about being superhuman; it is about realizing that being human is super.”

2. Rahul Dravid: Timeless Steel (Anthology)


My Rating: 4/5, Goodreads Rating: 4.25/5

This book is a collection of articles about Rahul Dravid, written in a span of over a decade. These articles sum up Rahul’s life as a cricketer(mostly), as a person, and as a family man from many different people’s perspective. It is like a small window to this great achiever’s life and I got to learn a lot of things from him (indirectly of course).

His Determination, hardworking nature, strength to withstand dark moments, and most importantly his humility has been elaborated by many people who got a chance to know him. For the cricket lovers, some of these articles get technical about the game and it’s an enjoyable experience to read his stats.

The last article in this book is the speech given by Rahul at the Sir Donald Brandman Oration and I feel this could have been the best way to end this book. It’s a brilliant speech that shows his passion and concern towards cricket and also the hope of better days in the future for some forms of the game.

3. Elon Musk: How the Billionaire CEO of Spacex and Tesla is Shaping Our Future


My Rating: 5/5, Goodreads Rating: 4.22/5

This is a well-written biography. I always wanted to know about the man trying to change the world, and this book gave me an unbiased view on Elon and his companies. I got a complete picture of things that go behind building multiple companies that have the potential to disrupt industries. It beautifully reveals the struggle, the dedication, the drive, and ruthlessness that exists within Elon and how he uses them to his advantage, even when the whole world is against him.

One other thing I had always wondered was, how it would be working with him and this book, I found a pattern with the people working with him, what he expects from them and what they think of him. the author has interviewed many people working with him right from the top to the bottom and you can see the consistency in the employees’ drive and motivation to change the world ( not all the employees, however).

The best part about this book is that it isn’t written to glorify him, but to give an account of what he has done and how he did it. We have to analyze those facts to see if Elon is actually the person we think he Is. This is truly a journalistic masterpiece.

I would recommend this book to anyone interested in entrepreneurship, technology or clean energy.

4. The White Tiger


My Rating: 3/5, Goodreads Rating: 3.71/5

This book is written in a very unique style, the whole story is conveyed through letters written to the Chinese Premier ( why specifically him, I couldn’t figure out, probably it was some inner urge he had to get his story out and share his secret one way or another)

It’s a story about a guy from a village in north India and his transformation that occurs when he becomes a driver to a wealthy man in Delhi. The story is definitely gripping and you will always be left wanting to know more about him and why he became a murderer.

The story, however, has been told in an extremely negative mindset about India from corruption to filth to poverty and makes India look like a completely chaotic place with no hope. Well, though most of it might be true, it’s not the only thing that happens. Irrespective of where you are, India has a lot to offer. you can find more good than bad unlike how it has been portrayed in this book. I would have rated this book higher if it weren’t for this negative look on India.

Smartphone and you – How to improve your sleep quality

In the world of technology, we often tend to think that our life is made simpler and our capability to do things more efficiently has been made possible. However, like our inherent human tendency, we abuse the power we have been given and completely ignore the possibilities of side effects.

Does technology have any side effects?  Well, there are many which you might not be aware of but through this post, I will try to answer this fundamental question and hopefully help make your life a little better.

To begin with, answer the following questions to evaluate where you stand now:

  1. Do you find yourself sleep deprived irrespective of the number of hours you have slept for? or are you waking up each morning wondering why you aren’t feeling fresh?
  2. Do you experience headaches frequently? Do these headaches last for hours together?

If your answer to both were yes, then this article will give you more information on why that might be happening and suggest slight adjustments that you can make in your routine and try to mitigate the side effects.

If your answer was no for the questions above, then you are doing something right and this article will tell you what that is.

The Normalcy

Before we go about the issues,  I would like to dive into the science of what happens normally in a human body and how it happens.I will try to keep these explanations as simple as possible.

1. Circadian Rhythm a.k.a The Biological Clock

The Circadian Rhythm is a cyclic process in your body responsible for controlling various internal processes like maintaining your sleep cycle, blood pressure, secreting hormones at the right time, regulating bowel movements, and many many more things. This happens every day.


(Example of Circadian Rhythm) Source: Wikipedia

Though this cycle has a set of tasks to perform at a given point in time, it is very flexible and can be influenced by the person’s surrounding environment. This is a good thing because it adapts to the natural changes like seasonal changes, light, and temperature without affecting you. However, this also means that leading an unhealthy lifestyle can heavily influence this cycle and throw it off balance causing many issues to you.

2. Eyesight

The reason why we have the ability of sight is relatively unknown. To understand this, we would have to first understand what light is.  To put it in simple terms, light is a wave of energetic particles. In this wave,  only a small portion is visible to the human eye and this visible portion is responsible for our visual perception.

visble-light(The visible spectrum of light) Source: Visible Light

in the diagram above, the left-hand side depicts lower energy particles and rightmost side indicates higher energy particles. The ultraviolet light comprises of high energetic particles that are bad for humans. Fortunately for us, most of it is filtered out when the light from the sun travels through the earth’s atmosphere.

When the rest of the visible light passes through your eye, many different things happen. Firstly, as the objects around you reflect the light, your brain forms the image of your surrounding by processing in this information. Depending on the energy of the reflected light that falls in your eyes, it will identify and differentiate the various colors and you will be able to see.

However, the energy of the light particles that falls through your eyes is used by the brain to determine a few other things. For example, in the visible range, the blue light corresponds to higher energy particles, and when this light falls through your eyes, your brain interprets that it’s morning time and starts to trigger various chemical processes in your body.

3. The Sleep Cycle

Your biological clock responds to external stimuli to trigger the sleep process. The most influential external stimulus is light. When sunlight fades and it starts to get dark, the amount of light going through your eyes reduces drastically and the body starts to generate a sleep hormone called Melatonin. When this hormone is released in large quantities in the blood ( usually in the night), you tend to relax and start feeling sleepy.

When you wake up the next morning, the sunlight pours in through your eyes and the body gets the signal that it’s daytime. It has now been observed that the “blue light” which is a part of the sunlight is heavily responsible for suppressing melatonin. With the receding levels of this hormone in your body, you feel fresh and ready to start your day. This process happens day after day for your whole life.

Melatonin can also be absorbed by the body from certain types of vegetables and fruits like tomatoes, walnuts, olives, rice, etc and you may start to feel relaxed. When the time comes for the body to secrete this hormone, it generates the right amount required for a good sleep.

Udemy Generic 300x250

The Smartphone

In this section, I will try to simplify how the smartphone display works. Though this process is similar to almost all the digital devices, I want to focus more on smartphones as they are the most used device by people these days and are also the cause for the current technology-driven lifestyle.

Most of the smartphones today have LED screens. This screen is made up of a set of LED light bulbs and a few layers above it. These layers are made of various materials to filter light as it reaches to the top where the user can see.


(Cross section of LED screen) Source: Sound&Vision

As these smartphones are often used outside, the sunlight tends to glare your screen and you wouldn’t be able to see anything on it. To overcome that, the phone screens come with a few things:

  1. Anti-glare screens – These screens disperse the light that falls on it, thereby reducing the glaring effect.
  2. High Energy light –  The Blue Light, which we have seen earlier are high energy particles in the visible range are used. This makes the screen appear much brighter so that you can easily see it when you are outside. The high energy of the blue light particle makes it the perfect choice to beat the sunlight and make the phone display stand out even in bright places.

The result of this is the bright, crisp high definition screen that makes anything on it look amazing any time of the day. This is truly an engineering marvel.

Piecing Things Together

Now that we know how our body works normally and how a smartphone display would work, we can piece these two together to understand the side effects of using a smartphone throughout the day.

1. The Day Time

During the daytime, there is not much of a difference in terms of the light from the screen affecting you on a short term basis. Mainly because the light emitted by the smartphone has similar traits when compared to sunlight.  However, since we are constantly looking at screens for a prolonged period of time during the day, the high energy particles cause flickering in the eyes leading to eye strains. This, in turn, causes loss of clarity, headache, mental fatigue, to name a few.

2. The Night Time

The most destructive effect of smartphone screens happens at night. Consider this normal behavior of an average person living in a town/ city.

He or she returns home in the evening after staring at computer monitors/ mobile phones for a prolonged amount of time. At this point of time, the body senses that it’s dark due to the absence of sunlight and starts to produce melatonin in the body. The person starts to feel relaxed and once the chores are done, the person picks up the smartphone to check WhatsApp, to watch an episode of a series on YouTube and checks mail. At this point of time, the person does not realize what’s happening inside the body.

Inside the body of that person, melatonin, the sleep hormone is being secreted, but as the bright blue light from the smartphone enters the eyes, the brain gets a signal and it starts interpreting that it’s day time. And since the biological clock is influenced by your surrounding, it starts to suppress the melatonin and instead of becoming more and more relaxed, you start to become more and more alert. Suddenly you find yourself thinking, that you aren’t feeling sleepy anymore and you continue to use your mobile for some more time. It’s a vicious cycle.

So, What are the Side Effects?

As you might have guessed by now, this habit of yours is suppressing the amount of melatonin required for a good sleep.  This answers the first question that we had asked, why do we find ourselves sleep deprived irrespective of the number of hours we have slept for? and why we aren’t fresh when we wake up. When you do not get a good sleep, that triggers another set of problems like headaches throughout the day, feeling lethargic and having mental and physical fatigue and in some cases, this habit leads to insomnia.

Another side effect that arises from staring at the bright blue light in a dark place is eye strain. The Bright light which has high energy can strain your eyes causing headaches and loss of clear vision.

Different Ways to Prevent It

The side effects can be prevented to a great extent and following some of these prevention techniques can help you feel better within a day. Now, the most obvious thing to do would be to reduce the usage of the smartphone. If you can do this, then hats off to you. However, most of us might find this to be a very challenging task. So, for people like you and me, here are a few simple things you can try out for various screen types:

  1. Use the screen in low brightness from evening onwards.
  2. For your desktop/ laptop screen, there is a  software called Flux. This software works by making your screen slightly orange depending on the time of the day. orange light falls in the low energy particle side of the visible spectrum, thereby reducing damage to your eyes.
  3. Most Important Step: Practicing this step can quickly show you the results and so it’s important that you do this every single day. DO NOT use smartphones or any digital device 1.5 to 2 hours before you sleep.   Make sure you finish checking your emails, WhatsApp and other important things at least 1.5 hours before you sleep. Set your alarms and leave the phone aside. You can use the time you have till you fall asleep to go for a walk, talk to your family members or best, spend time reading a good book.

I hope that this has given you a  bit more understanding of the aspects of smartphones and human processes and I hope that this information helps you.   

P.S: share your views on the effects of smartphones, how it has helped you or how it hasn’t in the comments below. If you find this article informative, share it with others so that they can benefit from this as well.  

Source Dexter is becoming better and I need your help!

Dear reader,

Thank you for being a part of my journey. Over the years, this blog has tried to become a destination for useful resources in the technological space.I have put my heart and soul into some of the things I have shared here and I have always wanted to make this big.

Among the tens of thousands of readers that this blog has witnessed, I know for a fact that many have found the information present here to be very useful. It makes me feel good that I had a part to play in helping a few people in their respective journeys. I do not exactly know how many are constantly following this blog, but if you are one among them, I thank you for your support. I wouldn’t have a good blog without you.

To share with you a brief history of this blog, I would have to go back a couple of years when I had felt that I could share the things that I come across with other people with a hope to help them in some way. As time went by, the readership grew and so did the type of blog posts. I primarily blogged about a few niche technologies like python, Raspberry Pi, and Ubuntu. This blog has helped me in various ways which I hadn’t realized before. One example for this is the way in which I was able to leverage these content to get freelance writing projects. However, the times when I was not fascinated by a few technologies or when I got caught up with work, I wouldn’t blog and months of dry spells would follow. I sometimes felt that the drive to keep this alive was missing.

Writing and science have been two of my passions but this blog focused more on technology which as you know is a by-product of science. I want to change this now and start giving more importance to science as well. You might have subscribed to this blog for the type of technical content I have been writing so far and so it is important that you know what is coming up next from my side. I have decided to publish science-based articles that dwell deep into the intertwining of science with technology in a bid to simplify some of the complex concepts or bring out some of the research work that can benefit common people like you and me.

To begin with,  I will publish articles only when I am satisfied with it and not on a regular basis just to maintain a cyclical publishing habit. As time goes, I might shift to a fixed pattern. I would, however, need your support in terms of sharing the content and helping more people understand and gain more knowledge. I don’t want to consider this as a new year’s resolution but as a new attempt in pursuing my passion and giving this blog a part of my identity.

Happy holidays!! I hope to see you soon.


P.S: please do share your opinions and suggestions through the comments. It helps me as a blogger to understand what you feel and also improve myself. So, go ahead, let me know 🙂

Udemy October sale. Get upto 85% off on your favorite courses!


The Udemy Sale is back with huge discounts.Sitewide-15dollars is now live. You can get even courses worth $200 just for $15 . this sale will last only for 3 days so make sure you grab the courses you love!!

Steps to get your favorite course for up to 95% discount and in some cases for free:
1) narrow down on the topic you want to learn.
2) Click the sale link Here and login
3) That’s it. All courses from $50 to $200 will be up for only $15.
4) Also look out for a few courses that are free for the sale duration. just sort the search result  by price to free.

Following are some of the best selling  courses designed to make you a pro:

So, do not wait for any longer, go ahead and get you favorite courses today!!

Raspberry Pi Tutorials : how to assign static IP and change hostname

Making a Raspberry Pi cluster requires an initial setup to be performed. Here I assume that the OS that is running is Raspbian. So once the cluster is built generally one Raspberry pi designated as the  master node controls the functionality of all the other nodes. So this post deals with how the master node connects to or other nodes ,how you can use the master node to login to any other node in the cluster, how to assign static IP address and how to differentiate each of the nodes from the other by assigning different hostnames.

Assigning static IP address :

The first thing that has to be done is assign static IP address to each PI . This helps to connect to other PIs(nodes) via SSH (Secure Shell) . So first use the command :


This lists all the IP addresses. My result of running the command ifconfig was :

inet addr: bcast addr: mask:

Make a note of these addresses. So, from the above result, the inet address indicates the IP address of the node. What we do now is assign addresses to each node. The first step in it is to decide a range of IPs . I had 5 nodes and so I decided to take the range to . Once the range is fixed login to one of the PIs.
Also, make a note of the gateway address by typing the following command

sudo route -nee

Gateway: 192.168.3. 1

The final step is to modify the interface file :

sudo nano /etc/network/interfaces

Remove the line that reads

iface eth0 inet dhcp

Add the following:

iface eth0 inet static
address #change according to your range

save by pressing CTRL+X and then type Y to save and exit. then reboot the PI using :

sudo reboot

Type the following command to ping your gateway address or router and will return :

ping  -c3

The response should look somewhat like this :

64 bytes from icmp_req=1 ttl=255 time=2.18
64 bytes from icmp_req=2 ttl=255 time=2.43
64 bytes from icmp_req=3 ttl=255 time=3.24


Learn  how to make your Bench Automation Raspberry Pi computer now!!!

One last thing that needs to be modified is the /etc/resolv.conf file. This file contains information of DNS name resolvers that allow your raspberry pi to resolve names to IP addresses. For example, if you ping http://sourcedexter.com, the raspberry pi will have to determine the IP address of my python tutorials website,

Enter the following command to edit the resolv.conf file:

sudo nano /etc/resolv.conf

Enter the follow Google public DNServer IP address:


Press CTRL-X to exit but remember to save the file by accepting the changes.

Now type ifconfig and the new IP will be the one you would have assigned.Repeat this for all the other nodes on the cluster individually.


Change the hostname manually

If SSH is not installed then the hostname can be changed manually by logging into each of the raspberry pi individually and changing the hostname file as :

sudo nano /etc/hostname

By default the content of the file is :


change it to what you want. for example, if the new hostname should be client003 , then delete the existing name and type the new name :
press CTRL+X followed by Y to save and exit. So from the next time you login the new hostname will be seen.



SOURCE :   http://www.suntimebox.com/ ,  http://www.southampton.ac.uk/~sjc/raspberrypi/

How to encrypt data in Linux using gpg and open SSL

1 Introduction

Encryption is the process of encoding messages or information in such a way that only authorized parties can read them. With almost no privacy in this digital generation of our’s, encryption of our data is one of the most required tools. Most of the applications like Gmail encrypt our data, but the data on your system is still unsecured and there are hackers or unauthorised users waiting to access them.

When you are building many other applications using various Linux based devices, you still have to take care of the data on it. One way to minimize the risk of data theft is to encrypt the data that is present even on our local system.

Now there is another very interesting topic called steganography. This involves hiding data. The key difference between encryption and steganography is that, in encryption, you know there is data but you cannot make any sense out of it. And decryption is the only way you can read the actual data. However, in steganography, you won’t even know that the data actually exists. it’s hidden in plain sight. You can easily build your own steganography tool in python.

This tutorial demonstrates several methods of encrypting the data on Linux systems using command line tools.

2 Encryption using GPG

2.1 GPG Introduction

GPG stands for GNU Private Guard which is a command line utility that is used to encrypt and decrypt data files or folders using either symmetric or public key encryption. GPG is a GPL Licensed alternative to the PGP cryptographic software suite. GPG is used by OpenPGP-compliant systems as well.

2.2 Encryption using Symmetric Key

Here I have a file named “test.txt” that I will encrypt and then decrypt with a symmetric key and print the decrypted text into another file called “output.txt”.

Run the following command to encrypt the file test.txt using a symmetric key. The option “-c” indicated the GPG to use symmetric keys.

gpg -c test.txt

The result of this will look like the image below. The first time when GPG is run, a .gnupg folder is created. It contains the files that are necessary for the encryption process. It then asks you to enter a passphrase twice. Please make sure that you enter a strong passphrase and that you remember it as you need this in future to decrypt your files.

So, once the passphrase is entered correctly, a file called “test.txt.gpg” is created. This is the encrypted file. The following image shows the file before and after encryption.You can see that the encrypted text is in an unreadable format.

Use the following command to decrypt the encrypted file

gpg -o output.txt test.txt.gpg

You will be prompted to enter the passphrase used to encrypt. Once you enter that correctly, “output.txt” file will be created with the same contents as that of “test.txt”. The output of decryption might look similar to the image below:

2.3 Public Key Encryption

Here we will encrypt a set of files using the public / private key encryption mechanism of GPG. It involves creation of a private key which should never be shared with anyone and a public key that has to be shared with the people who want to send you encrypted data. Public key cryptography is a very interesting topic. You can read about it in detail here.

First, we will have to pack the files into a compressed folder. Here I have a directory called “enctest”with three files test1.txt to test3.txt .We will compress this directory tar.gz file. I wll use the following command to create the compressed tar.gz archive:

tar czf files.tar.gz ~/enctest

This creates a file “files.tar.gz” . We now have to generate the public/private key pair. Run the following command to generate the key:

gpg –gen-key

Remember, this has to be done only once and any number of files and folders can be encrypted with this key. Once you type this command, various set of questions will be asked. The questions will be:

  • What kind of encryption to use? I selected 1 which is RSA and RSA.
  • What should be the key size? I chose 2048, you can choose any size in the range of 1024 and 4096.
  • When should the Key expire? I selected 0 , which means that the key never expires. But can provide days, weeks or years if you want it to expire in a particular time.

Other things like passphrase will be asked, you will be prompted to enter it twice. Make sure you use a strong one and that you remember the passphrase. Also your credentials will be used. The credentials that I have used here (provided below) are just for testing. It is recommended that you use your genuine credentials like name, email ID and provide some comment.

The following content shows my answer and how the output will be:

gpg (GnuPG) 1.4.16; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 2048
Requested keysize is 2048 bits
Please specify how long the key should be valid.
         0 = key does not expire
        = key expires in n days
      w = key expires in n weeks
      m = key expires in n months
      y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"

Real name: John Doe
Email address: johndoe@somemail.com
Comment: tis is key generation
You selected this USER-ID:
    "John Doe (tis is key generation) <johndoe@somemail.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

Once you enter the passphrase, it begins to generate the key. It will ask you to do some work. It is recommended to move the mouse or type something or use the drives to open some files. It will use this work to generate random bits. You may have to do this multiple times. The output for me is shown below:

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 187 more bytes)
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 92 more bytes)

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 114 more bytes)


Once done, the key has been generated. It will look similar to the content below:

gpg: /home/akshay/.gnupg/trustdb.gpg: trustdb created
gpg: key FA2314B6 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   2048R/FA2314B6 2015-04-02
      Key fingerprint = 5A02 5D77 3E0A 8B69 8086  3032 DE51 6EA5 FA23 14B6
uid                  John Doe (tis is key generation) <johndoe@somemail.com>
sub   2048R/6F78E642 2015-04-02

There are two important things here: provide a strong passphrase and make sure to remember your passphrase

Now that the keys are generated, we will now have to export the public key file for importing it on other systems or to send it by email. To start the export, use the following command:

gpg –armor –output file-enc-pubkey.txt –export ‘John Doe’

Replace ‘John Doe’ with the name you used while generating the key.

It is also recommended to take a backup of the private key. We can use gpg to do that. To take the backup, use the following command:

gpg –armor –output file-enc-privkey.asc –export-secret-keys ‘John Doe’

Here the file “file-enc-privkey.asc” will hold the backup of the private key safely. Once exporting and key backup is complete, we can now encrypt and decrypt the .tar.gz file. Use the following command to encrypt:

gpg –encrypt –recipient ‘John Doe’ files.tar.gz

Remember to change ‘John Doe’ in the above command to the name given by you during key generation, else the encryption will fail. When the command runs successfully, an encrypted file called “files.tar.gz.gpg” will be created.

Now we can decrypt the tar.gz archive using the following command. It will use the private key along with the passphrase to decrypt and provide the decrypted folder. Use the following command to decrypt:

gpg –output output.tar.gz –decrypt files.tar.gz.gpg

The above command will ask for the passphrase and then decrypt the encrypted file and create a compressed file named “output.tar.gz” which can then be extracted to folder with tar to get back the files. The following image shows the output of encrypting and decrypting commands:

2.4 Why GPG?

GPG supports both: public key encryption and symmetric encryption and this provides a good amount of flexibility and can be used for a wide range of applications. There isn’t a need to provide any kind of sensitive information and also gpg can have any number of encryptors by using the public key. Choice is given to the user to select from multiple encryption algorithms. These reasons make it a very useful security tool to for encryption of files and folders or data.

Interested in Security, there is no better way to learn than knowing how to breach security:  Learn from experts on ethical hacking and how people and data can be manipulated to gain unauthorised access to private data :

Ethical Hacking By experts

3 Encryption using OpenSSL

3.1 Introduction to OpenSSL

The OpenSSL project is a collaborative effort to develop a robust, commercial-grade, full-featured and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS) protocols as well as a full-strength general purpose cryptographic library. OpenSSL is available for most Unix-like operating systems and it is based on SSLeay. OpenSSL supports also many SSH, SFTP, and SCP applications. Here we use OpenSSL to encrypt data by making use the asymmetric encryption and the AES cipher. Symmetric encryption can be used for encrypting bigger files or data.

3.2 Generating the Public and Private keys

The first thing we have to do is generate the public and private keys.We first generate the private key. To do so, use the following command:

openssl genrsa -out private_key.pem 1024

The above command instructs OpenSSL to use RSA to generate a private key with a size of 1024 bytes. The key is then stored securely within a file called “private_key.pem”. The output of this command will look similar to the image below:

Once the private (the secret) key is generated, we can use that to generate the public key so that they form a pair. Use the following command to generate the public key:

openssl rsa -in private_key.pem -out public_key.pem -outform PEM -pubout

It will look like the image below:

3.3 Encrypting data

We can now use the public key to encrypt data. Here we will encrypt the file “test.txt” and store the encrypted text in the file encrypt.dat. Execute the following command:

openssl rsautl -encrypt -inkey public_key.pem -pubin -in encrypt.txt -out encrypt.dat

The following images show the text file before and after encryption:

3.4 Decrypting data

Here we use the private key to decrypt the file. Run the following command:

openssl rsautl -decrypt -inkey private_key.pem -in encrypt.dat -out decrypt.txt

The file decrypt.txt will contain the decrypted data. The execution of the above command and also the file content is shown in the image below:

Source : My article from HowtoForge

ARM chips and their benefits in a Raspberry Pi

In the process of building a Raspberry Pi cluster, I came across a few libraries for inter-node communication. I was facing some issues while using these libraries and the errors weren’t one of the common ones associated with Raspberry Pis.  These libraries made use of a feature called Hard Floating Point computation and I wanted to know if my Raspberry PI supported it. So, this article is my understanding of ARM chips and its variants and how it all fits my cluster built using a Raspberry Pi.

ARM chips which are based on the RISC (Reduced Instruction Set Computer) architecture were developed by a British company called ARM Holdings. Since RISC allows components to be very small in size and lesser in number, you can find that the ARM chips are very small themselves and they don’t require any  external cooling. This is the main reason for most of the smartphones  today to have ARM chips in them.

ARM releases these chips in various versions . Among all of them, till ARM V7,  all chips supported only 32-bit architecture. But from ARM V8 onward, support was provided for 64-bit architecture as well. The major advantage of these chips is that it supports efficient multi-core computing and high core counts at lower costs.

Raspberry pi Model B supports multiple nodes to be connected and used in parallel. To achieve this, two variations of  ARM chips can be used. One is the ARMEL (ARM little endian) and the second ARMHF (Hard Floating) . ARMEL is used for soft floating points where the computation is restricted only to a certain level of floating point numbers but ARMHF, on the other hand, is a hard floating point architecture , giving more support to high floating point number computations during parallel computing. The  raspberry Pi comes with a support for ARMHF which is available for use through various ports provided by Raspbian (the Debian OS for raspberry Pi).

MPICH2 is a very good message passing library that makes parallel processing on a Pi possible but has packages only for ARMEL architecture. So, it’s wiser to use MPICH tools and build it within the raspberry Pi and utilize the ARMHF.

The Pi Model B has an ARM11 family of chips inside it. The ARM11 is based on the ARM V6 and is hence 32-bit architecture. This chip has a clock speed of 700 to 750 MHz but can be overclocked to 800 Mhz without a void in warranty. But the full overclocked speed is  around 1 GHz. The CPU, the GPU, and the RAM are on the same chip.  The CPU has a speed of 65 GFLOPS and the GPU of about 24 GFLOPS and  a 512 Mb RAM.

Overall, it’s a very efficient chip having power equivalent to a Pentium 2 processor and contributes greatly to the small size and low cost of the raspberry pi.

You can now learn to build cool applications with Raspberry Pis. Sign up and get the best resources to get started: Login to get the Course for $10