Monday, May 11, 2015

Latitude Longitude Boundaries on World Map


You might have encountered situations where you wanted to get the latitude and longitude boundaries of an rectangular area on world map, I have put together a simple js application using leaflet js and leaflet.draw plugin to provide the functionality.

  1. You can access the hosted application from here
  2. You can access the sources from here
Enjoy and please comment if you encounter any issues.


Figure 1 - Boundary Application



Wednesday, May 6, 2015

How to kill multiple processes from terminal with single line

You might encounter situations where you need to kill group of processes, such as when google-chrome is running. Chrome spawns multiple processes and you might want to shut it down from terminal.

[rozaydin@RO ~]$ ps -e | grep chrome
 5017 ?        00:00:01 chrome
 5027 ?        00:00:00 chrome-sandbox
 5028 ?        00:00:00 chrome
 5033 ?        00:00:00 chrome-sandbox
 5036 ?        00:00:00 chrome
 5055 ?        00:00:00 chrome
 5083 ?        00:00:00 chrome
 5091 ?        00:00:00 chrome
 5107 ?        00:00:00 chrome
 5111 ?        00:00:00 chrome
 5115 ?        00:00:00 chrome
 5123 ?        00:00:00 chrome
 5131 ?        00:00:00 chrome
 5139 ?        00:00:00 chrome
 5142 ?        00:00:00 chrome
 5154 ?        00:00:00 chrome
 5160 ?        00:00:00 chrome
[rozaydin@RO ~]$
 

Killing these processes  one by one is a tedious task instead you can use below command the kill them with one single line. (Bird massacre with single stone)


ps -e | grep <processname> | awk '{system("kill -9 "$1)}'


[rozaydin@RO ~]$ ps -e | grep chrome | awk '{system("kill -9 "$1)}'
sh: line 0: kill: (5033) - No such process
sh: line 0: kill: (5036) - No such process
sh: line 0: kill: (5055) - No such process
sh: line 0: kill: (5083) - No such process
sh: line 0: kill: (5107) - No such process
sh: line 0: kill: (5111) - No such process
sh: line 0: kill: (5115) - No such process
sh: line 0: kill: (5123) - No such process
sh: line 0: kill: (5131) - No such process
sh: line 0: kill: (5139) - No such process
sh: line 0: kill: (5142) - No such process
sh: line 0: kill: (5154) - No such process
sh: line 0: kill: (5160) - No such process
[rozaydin@RO ~]$
[rozaydin@RO ~]$ ps -e | grep chrome
[rozaydin@RO ~]$