Tech Tip's : Do's and dont's

Convert rows into space-delimited line and vice versa

While dealing with text processing jobs we would like to convert a selection of rows separated by \n and convert it to space delimited single line. 
We will do this with ‘tr’ – unix tool that translates, deletes, squeezes characters from standard input and writes the same to standard output. “Awk” is a powerful tool used to perform pattern scannind and processing language and it is one of the important commands, a powerful linux user should be aware of its usage.


To convert rows into a space-delimited line and save to a file:

$ cat intput.txt


$ cat input.txt | tr “\n” ” ” | tee output.log

ankit shah is my name I am awesome

To convert spaces to line break (newline) and save to a file:

$ cat intput.txt

Hi how are you doing

sed -e ‘s/\s\+/\n/g’ input.txt | tee output.txt



Find email id of any github user.

Hi all,

Recently, while browsing github, I wanted to find email id of a github user and imagined if there is a possible way to find this person as I am interested in learning more about the work on his github account and would like to contribute to the same.

Luckily I found that the github api is very insecure and presents the email id of a github user with ease.

So, here’s a script that will help you determine email id of any github user.
#The script for finding email address of any user.

function _md5()
  if which md5sum > /dev/null; then
    echo -n $1 | md5sum | cut -d ” ” -f1
    md5 -q -s $1

USAGE=”$(basename “$0”) [-e] [-g] user — Find the email address of any GitHub user
    -h, –help Help: display this help message
    -e Event log: show all emails that appear in the user’s event log
    -g Gravatar match: attempt to match an event email to the user’s Gravatar ID”

if [ “$1” == “-h” ] || [ “$1” == “–help” ] || [ -z “$1” ] ; then
  echo “$USAGE”

if [ “$1” == “-e” ] || [ “$1” == “-g” ] ; then
  if [ -z “$2” ] ; then
    echo “$USAGE”

  EVENTRESPONSE=`curl -s$USER/events/public`
  EMAILS=`echo “$EVENTRESPONSE” | grep “\”email\”:” | sed -e’s/[,|”]//g’ | sort | uniq -c | sort -n | awk ‘{print $(NF)}’ | grep -v null`
  if [ “$1” == “-g” ] ; then
    GID=`echo “$PROFILERESPONSE” | grep “\”gravatar_id\”:” | sed -e’s/[,|”]//g’ | awk ‘{print $(NF)}’`
    for EMAIL in $EMAILS ; do
      if [ $GID == `_md5 $EMAIL` ] ; then
        echo “$EMAIL”
    if [ -n “$EMAILS” ] ; then
      echo “$EMAILS”

EMAIL=`echo “$PROFILERESPONSE” | grep “\”email\”:” | sed -e’s/[,|”]//g’ | awk ‘{print $(NF)}’ | grep -v null`

if [ -z “$EMAIL” ] ; then
  EVENTRESPONSE=`curl -s$USER/events/public`
  EMAIL=`echo “$EVENTRESPONSE” | grep “\”email\”:” | sed -e’s/[,|”]//g’ | sort | uniq -c | sort -n | awk ‘{print $(NF)}’ | grep -v null | tail -n1`

if [ -n “$EMAIL” ] ; then
  echo “$EMAIL”

exit 1


Save the above script in a bash file or download it here : –

Usage: bash

Machine learning Tips for Audio, Image and Video Analysis

Original post :-

By Lillian Peirson

Post is as follows : –

Neural networks are great in image, video, and audio machine learning problems. For example, if you have an image classification task, you can use convolutional neural nets. First, you’ll need to normalize your image, and then downsample it to a smaller size. Usually 16 – 64 pixels for each dimension is good.
After that you can build a simple convolutional net to learn from these downsampled images. The most important hyperparameter is the learning rate – tune it first. After that you can play around with changing layer sizes, the convolutional layer kernel, and pooling sizes. Try adding more layers and activation functions. Definitely try using the dropout method.
If your dataset is not very large, use data augmentation. Usually if you rotate your image or move it by a few pixels horizontally or vertically, the class doesn’t change, right? Sometimes you can even make a mirror image! Data augmentation can help you avoid some overfitting, making it possible to try an even bigger net. Finally, if you need a little better quality, you should definitely try to build several models with similar hyperparameters and then build a voting classifier on top of them.

Tech Tips: Do’s and Dont’s featured on

Hello readers,

I am excited to bring you this news that Tech Tips: Do’s and Dont’s is now featured on

Andrei, a moderator at Tech 3dge, presented me with an opportunity to feature this blog on their website.

Tech3dge is a website that features the newest electronic product updates and innovations, and EEWeb’s Europe website.

Their primary website is Elektronik Forum EEWeb.

EEWEb Europe is an electronics and electrical engineering online community with electronics forum and electrical engineering forum. It has electrical and electronic design articles, and resources
in the area of RF design, analog design, embedded design, PCB design, test and measure.

Link featuring this blog is present here

Thanks Andrei for featuring this blog.

To find more latest tech updates on Electronics and Electrical engineering community head over to their primary website and

Machine learning : SVM

SVM – Support Vector machines.

Different kernels – linear, rbf, poly etc.

Each Kernel is an additional parameter to SVM classifier to map data points to ta new dimensional space and then perform the classification.

Gamma more = ?

C value is more means that the error is more => More data points are correctly classified.

More the value of C does not gurantee an accurate classifier.

One needs to be careful of overfitting in machine learning.

For SVM overfitting the parameters in control are C, gamma, kernel used.

Indentation of files in vim.

We all wish to indent files in vim so that the code looks more uniform and coherent across multiple systems.

Here’s a script written to indent file which runs on bash. This script expects an input (argument) from the user which can be file name or a directory path [assumed that user wishes to run the script for all files in that directory]

#Pass absolute file name which you wish to indent as an argument to this script
if [[ -d $argument ]]; then
    echo “$argument is a directory”
    for file in `find $argument -type f -name “*.c” && find $argument -type f -name “*.h”`
        echo $file 
        vim $file -c “normal gg=G” -c “wq”
        expand -t 4 $file $file      
elif [[ -f $argument ]]; then
    echo “$argument is a file”
    vim $file -c “normal gg=G” -c “wq”
    expand -t 4 $file $file
    echo “$argument is not valid”
    exit 1

Save the above code as

Type ./ .

Installation of Praat – Solve unable to hear sound issue quickly.

Praat is a software package for analysis of speech and get detailed information like pitch, spectogram, intensity and a raft of speech features needed in detailed analysis.

Praat is well recognized in the research of phonetics and linguistic.

Here’s a link to the official praat website: –

Let’s get to issues faced while installing from the default package manager in Linux.

I had used sudo apt-get install praat on a Debian system.

The package manager installed praat successfully which was launched by typing praat from the terminal.

Launching was not an issue, however when I tried to play an audio file in wav format, there was no audio from Praat play command.

To check the setup of hardware tried to play the file from another player – banshee and the sound file worked just fine.

bt_audio_service_open: connect() failed: Connection refused (111)

The above message was displayed from the terminal screen while playing the audio file from Praat.

On googling found [] that the issue was due to bluez-alsa package installed in system.

Uninstalled bluez-alsa package using synaptic package manager but still the issue still persisted where praat was not able to play the audio file.

Spend another few hours trying to solve the issue, but since nothing was being displayed from the terminal output.

Finally got the idea to uninstall and install again and this time with the package provided on the praat website.

Downloaded the tar file and unzipped it and typed ./praat from the extracted directory

Voila it worked fine!!!

Moral of the story: Don’t try to use shortcut command of sudo apt-get install to get your work done. Keep an open eye for other solutions as well.

How to Root Samsung Galaxy J7 with a few clicks

How To Install TWRP Recovery & Root Samsung Galaxy J7

Samsung Galaxy J7 is a high quality Android smartphone, which comes with 5.5 inch super AMOLED touchscreen display powered by 1.5 GHz octa-core processor along with a 1.5 GB RAM and the device runs on Android 5.1 Lollipop operating system. If you have purchased this smartphone and looking for a way to gain root privileges, you are in the right page as I have given a tutorial to root Samsung Galaxy J7 here.
Along with rooting tutorial, I have also provided a tutorial for installing TWRP recovery in Galaxy J7 using Odin. The advantages of gaining root privileges is that it will let you to install custom-built Android applications which only runs on rooted devices, custom ROM firmware’s, etc.

WARNING: Rooting your Samsung smartphone will void its warranty and you won’t be able to claim it back until you unroot your device. Also, if your device gets damaged during the rooting procedure, don’t held me responsible. Proceed with CAUTION.

Install TWRP Recovey And Root Samsung Galaxy J7


1) Before getting started with a rooting procedure, it is always important to take a complete backup of personal data in your smartphone. So take a complete backup using Samsung Kies.
2) Next, you will need to enable USB debugging mode in your smartphone by following this path: Settings -> Developer Options -> USB Debugging.
Enable USB Debugging In Galaxy J7
If you can’t see the Developer options in your Settings, then you will need to enable it by following this path: Settings -> About Phone -> Build Number (tap on it for 7 times to enable Developer Mode). Also, if you are using the Indian version of Samsung Galaxy J7, you will need to enable OEM Unlock by following this path: Settings -> Developer Options -> Enable OEM Unlock.
Enable OEM Unlock Samsung Galaxy J7
3) Now, download Samsung Galaxy J7 USB driver and install it in your computer. Only by doing so, you will be able to connect your smartphone with the computer.
4) Make sure that your device has at least 50-60% battery backup in it before getting started with the rooting procedure.
Once you have finished all these prerequisites, you can follow the tutorials given below.

Tutorial To Install TWRP Recovery In Samsung Galaxy J7:

1) To get started, download Odin package and extract it to a folder in your computer. Next, download TWRP recovery for Samsung Galaxy J7

and save it in your computer as well. Once done, launch the Odin3 window.
2) Now, switch off your Galaxy J7 smartphone and boot it into the bootloader mode by pressing and holding the Volume Up, Home and Power buttons simultaneously for few seconds.
Download Bootloader Mode Samsung Smartphone
3) Once your Samsung device boots into the Bootloader or Download mode, connect it with the computer using the original USB data cable. If you have installed the USB drivers of your device properly, then you will see the “Added” message in the Log box of Odin.

Odin3 Added Message
4) Now, click on the AP button in Odin and select the “twrp-” file from the folder where you have TWRP recovery extracted files.
Odin3 AP Button
5) Next, make sure that the “Auto Reboot” and “F. Reset Time” boxes are ticked in Odin. Also ensure that the “Re-Partition” option is not enabled. Once everything is in place, click the “Start” button in Odin to begin the flashing process.
6) If you have done everything properly as per the instructions given here, TWRP recovery will get flashed in your device. Once the flashing process is over, it will automatically reboot. Also, you will get the “PASS” message in Odin as shown in the screenshot below.
Odin3 Pass Message
That’s it. Now you have successfully finished flashing TWRP recovery in Samsung Galaxy J7 smartphone. Let’s find out the way to root this smartphone.

Tutorial To Root Samsung Galaxy J7:

1) To get started, download SuperSU zip package to your computer. Next, connect your smartphone to the computer using the original USB data cable and transfer the SuperSU file to your device’s internal memory. Once done, unplug your smartphone from the computer.
2) Now, switch off your smartphone and boot it into the TWRP recovery mode by pressing the Volume Down, Home and Power buttons simultaneously for few seconds.
Recovery Mode Samsung Galaxy J7
3) Once your device boots into the TWRP recovery mode, flash the SuperSU package by following this path: Install -> Select Zip To Install (select the SuperSU zip package).
TWRP Recovery Screen Moto E
4) Once the flashing process gets finished, click on “Reboot System” to finish the rooting process.
TWRP Recovery Reboot System
That’s it. Now you have successfully finished rooting Samsung Galaxy J7. For confirmation, open up your Apps Menu and look for the SuperSU app. If it is located there, then you have completed the rooting procedure successfully. Alternatively, you can confirm the root privileges of your smartphone by using the Root Checker app (available in Google Play Store).
Samsung Galaxy J7 Root Access Is Available
If you encounter any issues while following this procedure, do let me know via comments.

Bash Useful Tricks

Source: – bash-shortcuts-for-maximum-productivity
Really useful article. Practice until you remember these little tricks. This article will save you a lot of time

Sharing this article on the blog, so that readers can get best tips at one location.

Command Editing Shortcuts

  • Ctrl + a – go to the start of the command line
  • Ctrl + e – go to the end of the command line
  • Ctrl + k – delete from cursor to the end of the command line
  • Ctrl + u – delete from cursor to the start of the command line
  • Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
  • Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
  • Ctrl + xx – move between start of command line and current cursor position (and back again)
  • Alt + b – move backward one word (or go to start of word the cursor is currently on)
  • Alt + f – move forward one word (or go to end of word the cursor is currently on)
  • Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)
  • Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word)
  • Alt + u – make uppercase from cursor to end of word
  • Alt + l – make lowercase from cursor to end of word
  • Alt + t – swap current word with previous
  • Ctrl + f – move forward one character
  • Ctrl + b – move backward one character
  • Ctrl + d – delete character under the cursor
  • Ctrl + h – delete character before the cursor
  • Ctrl + t – swap character under cursor with the previous one

Command Recall Shortcuts

  • Ctrl + r – search the history backwards
  • Ctrl + g – escape from history searching mode
  • Ctrl + p – previous command in history (i.e. walk back through the command history)
  • Ctrl + n – next command in history (i.e. walk forward through the command history)
  • Alt + . – use the last word of the previous command

Command Control Shortcuts

  • Ctrl + l – clear the screen
  • Ctrl + s – stops the output to the screen (for long running verbose command)
  • Ctrl + q – allow output to the screen (if previously stopped using command above)
  • Ctrl + c – terminate the command
  • Ctrl + z – suspend/stop the command

Bash Bang (!) Commands

Bash also has some handy features that use the ! (bang) to allow you to do some funky stuff with bash commands.

  • !! – run last command
  • !blah – run the most recent command that starts with ‘blah’ (e.g. !ls)
  • !blah:p – print out the command that !blah would run (also adds it as the latest command in the command history)
  • !$ – the last word of the previous command (same as Alt + .)
  • !$:p – print out the word that !$ would substitute
  • !* – the previous command except for the last word (e.g. if you type ‘find some_file.txt /‘, then !* would give you ‘find some_file.txt‘)
  • !*:p – print out what !* would substitute

Blog at

Up ↑