Tag Archives: raspberrypi

All ip assigned within a network

Many a time you wanted to know the assigned ip addresses in your LAN. My use cases:

I was working on nano pi neo cheapest things can be!!

You don’t want to move from your ass but this is more of a reason when you already know how to do this 🙂

Okay so on windows you have Advanced ip scanner. You can even log into your router and get to see the client list this is always the easiest way but (ohh but again)..   what if you have reset your router password. Most of the time you will forgot it!! It is not often that you need to login into your router so reset password means forgot. Do you want to reset the router password now just for this with router’s reset button. Or you are in office or you don’t own the router.

Anyway whatever your cause is here is a very easy command to get the list of all assigned ip using linux system:

sudo apt-get install nmap

:~$ sudo nmap -sP

Starting Nmap 6.40 ( http://nmap.org ) at 2017-01-04 18:23 IST
Nmap scan report for domain.name.dlink.com (
Host is up (0.00024s latency).
MAC Address: 1C:5F:2B:4D:05:71 (Unknown)
Nmap scan report for
Host is up (0.00028s latency).
MAC Address: FA:7B:DE:ED:46:55 (Unknown)
Nmap scan report for
Host is up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 3.27 seconds

If there are not much of machines in your LAN you will figure out which machine has what ip or you can ssh to each to verify. Without nmpa also you can ping all the ip and get the list but nmpa also tells you the friendly name of the machine.



Clone an SD-card

You will find many ways to clone an SD-card there are softwares like win32diskimager (A great tool for all practical purposes related to flashing cloning). You have the famous Linux dd command.

The problem arise when you are working on a bigger sd-card say 64 Gb. You have done something really cool and you want this to be in production or just share this with your friend so they will not spend 4-5 hours following your script to recreate the same image. You can just clone your card and zip it that will make the footprint small because anyway most of the 64 Gb part was empty to zip has done it’s trick but what if your friend has a 8 Gb card. You shouldn’t have started with a big card? Anyway cloning the whole card look very ugly to me (time factor is also there).

How to cleanly clone a SD card?

This is very simple I will explain it first then we will walk through a sample use case with all the commands. All the exercise is on Linux machine.


  1. Insert the SD-card on Linux machine and get the device name e.g. /dev/sdb sdb1 sdb2
  2. Start Gparted and select your device from top. sudo apt-get install gparted If you do not have this. I like using the GUI interface but if you are the bearded Unix man you can just use the parted command.
  3. Shrink your partition with the graphical interface. You need to unmount the partitions if it is auto mounted. You can do this from the gparted UI itself by right clicking on the partition and selecting unmount. After the device is unmounted(all its partitions) you can select a partition and see the options of deleting the partition shrinking/resizing it.
  4. gparted will automatically recognize the unused space with some margin and give you option to shrink it to that much space. shrink your partition and click save to apply it. This will take some time.
  5. Now you have just sufficient amount of space for each partition unused area is mark unallocated now. We can now clone the SD-card as usual.
  6. Just check the memory used via your favorite software/command then copy using dd   sudo dd if=/dev/sdb of=~/shrinked.img bs=1M count=2470

The way to it

Now let us walk through an example with all the commands:

:~$ sudo gparted

:~$ sudo dd if=/dev/sdb of=~/myRaspberryPi.img bs=1M count=2470

:~$ sudo fdisk -l

Partition table entries are not in disk order

Disk /dev/sdb: 64.0 GB, 64021856256 bytes
64 heads, 32 sectors/track, 61056 cylinders, total 125042688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00042380

Device Boot Start End Blocks Id System
/dev/sdb1 49152 131071 40960 83 Linux
/dev/sdb2 131072 5160959 2514944 83 Linux

You need this information to know the size you have to copy with dd command.

:~$ sudo dd if=/dev/sdb of=~/eyerisDvpCam.img bs=1M count=2470

2470+0 records in
2470+0 records out
2589982720 bytes (2.6 GB) copied, 82.9483 s, 31.2 MB/s

Do you know SD stands for Secure Digital?

There are some open points like:

  • What if your partitions are not continuous?
  • What if there is a big unallocated space in the beginning of the sd-card?

You can use skip with dd to reject the initial space I tried once didn’t worked for me got image was corrupted. May be I have done it incorrectly. Then you can also copy your partitions one by one and then create an image separately by joining them.

command with skip

:~$ sudo dd if=/dev/sdb of=~/myCoolTvSkip.img bs=1M skip=23552 count=2444

2444+0 records in
2444+0 records out
2562719744 bytes (2.6 GB) copied, 107.389 s, 23.9 MB/s

Alexa on Raspberry pi

Amazon has done a good job for hobbyist by opening their Alexa API. They have even given the boilerplate code base to start.

You an create almost same experience as Amazon echo with Raspberry-pi.

After first sexting up raspberry pi by raspbian and then installing Debian. You need to configure raspberry. One mistake I did was installing raspbian and then installing debian from that while I should have directly written debian on my sd card. Installing debian via rasbian path is so much time consuming.

Anyway configuring raspberry-pi is very simple

after first debian boot do

sudo apt-get update

sudo apt-get upgrade


sudo rasps-config

Now enable ssh (in In advanced optionsI don’t know why they have disabled this to begin with (security reason I know but why?)

You can overclock your raspberry pi for better performance.
Alexa RPi

Follow the steps from:


Very simple to setup just need time.

At last open three tabs in command window T1, T2, T3


cd ~/Desktop/alexa-avs-sample-app/samples
cd companionService && npm start


cd ~/Desktop/alexa-avs-sample-app/samples
cd javaclient && mvn exec:exec
To use the Sensory wake word engine, type –

cd ~/Desktop/alexa-avs-sample-app/samples
cd wakeWordAgent/src && ./wakeWordAgent -e kitt_ai

My experience with RPi-Alexa was not so great because I used old RPi which was not supported/mentioned in the blog. And frankly speaking this was damm slow not very usable. Overclock help a little bit. It was a good experience/fun and good toy 🙂 that is all I can say for echo. I don’t think it is really usable to be more than a toy right now. You can enjoy it for a month or two max.

Alexa has (great I am not so sure of) many addons which you can add to your raspberry pi via web interface. This can make it more interesting for may be more than a month. You can say like “Whats my briefing” You an play guessing games. Adding items to shopping list and emailing them setting reminder for gym, grocery shopping etc.

Some Commands in not any particular order:

  • Tell me a joke
  • Add X to my shopping list
  • Add 34 + 67
  • Who is X?
  • How tall is X?
  • Whats on my shopping list?
  • Create a new to-do.?
  • What time is it?
  • What time is it in Bengaluru?
  • What is the weather like in Bengaluru?
  • Set a timer for X seconds/minutes
  • What’s on my to-do list?
  • How old is X (Obama)
  • How many grams in an ounce?
  • News highlights
  • knock knock
  • Do you have any new features?
  • How do you say tomato in hindi /french
  • Define X
  • How many calories in a tomato ?
  • How do you spell entrepreneur ?
  • Flip a coin
  • Roll a dice
  • Rock paper scissor
  • When is holi?
  • Wikipedia X
  • One fish two fish
  • Do you like green eggs and  ham ?
  • Where are you from ?
  • I want the truth
  • Surely you can’t be serious.
  • I need to buy deodorant.
  • Good afternoon
  • What’s the meaning of life
  • Sing happy birthday
  • What day of the week christmas fall
  • Can you rap?
  • What’s my flash briefing?
  • Whats in the news ?
  • Alexa inspire me
  • How to make bloody marry ?
  • Start workout
  • Start Akinator
  • play jeopardy

For some you may need to enable addons like for news, for workout you need 7 -minutes workout.

Add Alexa in front of all command which makes it really annoying citing her name each time. They should have made it more smart and keep it triggered for at least 5 extra minutes. Could have add this to user agreement. I know people are worried about security, privacy. Amazon/Google listening our conversation always. But I guess main problem for amazon would have been understanding a whole para to make sense out of questions directed to Echo  when listening for five full minutes.

Some recording:

Reply for Alexa, When is holy?

Reply for Alexa, One fish two fish 

Some more: