mongodump usage for MongoDB backup and restore

According to MongoDB Backup manual, mongodump is a very handy tools for MongoDB administrator to backup and restore full mongodb cluster or single database or single collection.

mongodump usage

Here is a very simple command to take backup or restore mongodb system.


sudo mongodump --host hostName -d databaseName --port portNumber --username userName --password passWord --out directoryLocation

with the above command you can take backup of your database. I don’t need to explain all parameters as I wrote variable name very clearly.


 sudo mongorestore --host hostName -d databaseName --port portNumber --username userName --password passWord backupSourceLocation 

I guess it will help you quickly.

MikroTik Simple queue script – add all IP

To add all IPs in your MikroTik Simple queue, just open your MikroTik RouterOS terminal and run the following script.

:for x from 1 to 254 do={/queue simple add name="queue-$x" max-limit=2M/2M target="192.168.1.$x"}

Here in max-limit variable you can define max speed upload/download. For example I used 2M for both download and upload. This simple loop script will easily add all of your IPs in your MikroTik Simple Queue. After that you can manually modify when you need for any specific IP.

Find all IP address with subnets of a specific organization

Let’s assume you want to find all IP address of Facebook with all of their subnets. Let’s see how you can get it easily. In you Linux machine install ‘whois’ package first with the following command:

sudo apt-get install whois

After installing, you can just find lots of network identification information for a specific company with it’s any IP address, AS (Autonomous System) Numbers.

In your terminal just type the following command with AS23956 number (Facebook’s AS number)

whois -h '!gAS23956'

(Note: AS23956 is the AS number of Facebook)

You will get all the IP lists with it’s subnets in a result something look like: ....

So if you know the AS number of any organization then you can be able to figure out all of it’s owned IP addresses with Subnet. Now let’s see how you can find the AS number of any organization.

whois -h

descr: Route object of Grameen Phone
origin: AS24389
changed: 20080731
source: APNIC

From the above output you can see the value of AS of GrameenPhone. That is AS24389. Now to see all the IP list with subnetting for this AS use the following command that I described above already.

whois -h '!gAS24389'

(Note: Any organization can have multiple AS number).

Exploring Kolkata, India – My first international journey

Since I started to planning international tour, it was little bit hard to get foreign country visa in your blank passport. So I planned to go to India first to kick the pain of blank passport. And here it is how I achieved and explored Kolkata, India. I had a very good relationship with United Consultancy & Tours who arrange your India Visa Application with e-Token and prepare papers for other country visa as well.

Recent days it takes a bit longer time to get e-token for Indian Visa Interview due to their technical limitations and over loaded e-token application. That’s why I submitted my papers to that consultancy to manage an e-token for me and after 2 weeks they provided me e-token. And after 7 days it was my interview date (papers submission with physical presence) in Indian Visa Application Center (IVAC). I chose Dhanmondi IVAC because it was only 5 mins away from my home. I prepared all the original papers with passport and went to that IVAC to submit passport and show legal papers so visa officer can verify all those information are correct. It tooks two hours to get in due to large queue (approx. 200 people in my same schedule) and I made that. They gave me a token to collect passport and I was very excited to have my first international visa. But sometimes to get Indian visa is a hardest thing if all of your papers, spellings are little mismatch. But after six days I went IVAC to collect my passport and I got the visa. Hurrreeee! It’s time to plan my tour.

When I started planning my Indian Visa, I started to look for Air Ticket, Hotel Ticket to fix my budgets and planning. Now it’s time to really purchase Air ticket and Hotel ticket. I am a smart boy and that’s why I didn’t go to any tourist consultancy office to purchase any package or tickets cause their price always little bit high. I spent 3-4 hours in Internet to find the best place and best air and I found Jet Airways and The Park Hotel, Kolkata. I purchased Jet Airways with $200 (return ticket) and purchased The Park Hotel for $300 by my international card. There are so many deals you can chose for your flight for India. Jet Airways has a very fantastic Privilege card so next time your boarding will be much quicker and they will serve you priority basis if you register for their Privilege card I applied for that and got approved.

I chose The Park Hotel because of it’s my first tour and tour to relax and that’s why I spent little much to be at 5 star hotel in Kolkata and it’s located in the center of The Park Street (heart of Kolkata city). You can also book The Park Hotel from here directly.

So it’s 21 November, time to fly. I enjoyed flight several times inside country but this will be my first international flight and I arrived at Shahjalal International Airport, Dhaka 2 hours prior to departure. First finish airport security checks for my baggage, then collected Boarding pass from Jet Airways counter and finished writing departure card (for Bangladesh Immigration). After taking boarding pass, I went to clear my simple Bangladeshi immigration desk to take a pass (that allows you to leave country for few days). Immigration officer checked my Passport, Visa and took a picture and gave a seal and I went for another security check to enter inside Airport lounge. I have more 1 hour to wait till my flight. It’s my first time inside Airport lobby so I explored the place a bit but it’s very large. I sat down in a coffee shop and started using their Wi-Fi and having tea. And after 30 minutes, according to screen I saw that Jet Airways in Gate # 9 and I went there and at last inside flight. Flying above the sky and it took 25 mins to land in Netaji Subhas Chandra Bose International Airport, Kolkata, India. I just finished their immigration check by filling out their arrival card, then custom clearence card to take my luggage and then I was looking for a mobile connection store to purchase a prepaid-sim card and I found one but I didn’t find Airtel (cheap call rates) and I purchased Vodafone (call rates higher) with 1GB internet package. New sim costs me 800 INR, 251 INR for internet and 35 INR to activate a package to talk to Bangladesh phone (it was good for me). To purchase new SIM you just need your 1 copy photograph and photocopy of your passport. They knew Bengali so everything went smooth. After I came out from Airport, there are plenty of Taxi waiting outside airport and I picked one to go to Kolkata Park Street, The Park Hotel. It took 350 INR but I didn’t bargain with driver repeatedly to arrive soon at hotel. It was 7 PM already. Driver told me if I pay 400 INR to him so he can arrive hotel via a short cut and I took that deal. Now I am in India.

After exploring Indian street, lighting I arrived at hotel. Hotel executives are so awesome. They welcomed me and they confirmed my booking by taking my passport photocopy. I got my room digital card. I went to room. It was amazing. Totally amazing. Temperature control, LED TV, nice bath, fabulous bed, desk, sofa, tea/coffee maker, and everything. Now it’s time to relax.

Note: Please keep 1 pen when you will be at airport to fill up departure and arrival card. It’s odd to ask pen from anybody else. Also keep 1 thin pin to change your SIM card from your smart phone if needed. Otherwise you will have to spend so far 20 mins of waiting to get another person’s pen and pin. 🙂

Web Server build in a minute on Ubuntu Machine

I guess, you want to make your Ubuntu server UP & running within few minutes with one click that will install all the essential packages for your web server. I created the following script that you can run right after installing your Ubuntu OS in your machine.

I tested this script over Ubuntu 14.04 LTS and nGinx as web server.

I created the following shell script for (a) Installing Common packages, (b) Configuring Virtual Host

You just need to run the installer. In your terminal just write down the following command and it will start installing all the essential thing and after that browse localhost or with server IP address and you are supposed to see the default nginx server page.

sudo wget
sudo chmod a+x
sudo ./

And browse ‘http://localhost’

You can explore the shell script from the following gist. First file is the shell script that you are installing in above command prompt. Second and third .conf file is for sample virtual host. I embeded those 3 files for you to look at. If you think that we can add any more things please write here in comment box so I will consider that for others.