Creating local apt repo from DVD ISOs on Debian

openlogo-100Recently I installed Debian 8.4.0 on my system. I installed it from DVD ISO downloaded from Debian’s site. After installation of basic system, I needed a faster way to install new packages and for that I setup local repo from the downloaded ISOs.

To do so, I followed the following steps:

1. Create mount points at your required locations e.g. /media/username/CD1, /media/username/CD2 etc.

2. Update /etc/fstab with entries for mounting ISO image every time on reboot:
/home/username/Debian/debian-8.4.0-amd64-DVD-1.iso /media/username/CD1/ iso9660 loop,ro,user,noauto 0

3. After saving changes, run mount -a as root to make sure your changes are done correctly in /etc/fstab. Once this is confirmed, you can now mount this point by running mount /media/username/CD1 as root.

4. Now Update /etc/apt/sources.list with the following:
deb file:///media/username/CD1/ jessie main contrib

Make sure you comment out any other line pointing to CD ROM mounting of same ISO image present in sources.list. Once this is done run apt-get update

This should now first contact your local repo and then go ahead to other repos you have listed in sources.list.

Resetting Pattern / Passcode on Android Phone

I have been using Android based smart phone from 2+ years. I use it for different activities both on personal and professional levels. It has now become a part of my life and has made my life very easy and fast in one way or another. Yes. There are some negative points as well but I am fortunate to have more positives for having a smart phone.

Now I will cut this intro short and get to purpose of this entry. Recently I went to a service center of my telephony services provider as as I had some issues with internet from the day I had switched from post paid to pre-paid connection. While they fixed the internet issue on my phone, stupidly they applied a security pattern on my phone and unfortunately in the service center I didn’t check this. When I reached office and got a call on my phone I noticed this.

After noticing this, certainly I was very irritated and didn’t know what to do. I searched on internet and found quite a few solutions. Mostly they were trying to tell the users to reset their phone via resetting the phone to factory setting by going into boot menu of Android with some specific commands. I certainly didn’t like that idea and was looking forward for something more.

Then I realized that, I had added my phone to Google Device Manager (I would highly recommend that every Android device should be connected to this by their users) so I went there and saw this on my screen:

Google Device Manager

I realized this is something I was looking for. Clicking on the Lock screen, it showed me the below screen using which I set a temporary pass-code on my cell phone.

Google Device Manager - Lock

Doing this saved me from wasting time on resetting / cleaning all my data via Android special command or procedures. I know for geeks that would be worth trying but for someone who is only interested in restoring his phone, this will be the fastest way.

Also, using device manager if I ever want to reset my phone to Factory Settings I can do this via the Erase button on single click or by going to Settings -> Backup and reset -> Factory data reset. I don’t need to boot into Android boot menu via any special commands.

I have found this to very easy to follow and apply so I thought to share it on this blog to save time for others.

PivotalSigns – Startup Story

This is an entry I have been aiming to write from the day first when I started with my start up.


I had been working in a well reputed software firm in a very good position from 2005 without any major issues. Everything was cool and I enjoyed being there. I loved what I had been doing. However things started changing for me from 2011 end, when for the first time I felt I was not a good fit. I tried to switch my job responsibilities with in same organization but that didn’t help that much in the long run but still managed to spend some more time there. It was in April 2014 when this decision of parting ways after 8+ years was taken.

It was certainly not an easy one. Both on professional and personal level but sometime one has to step up and do something.

PivotalSigns is born!


After leaving, I had two options: Look for a job, which would offer job security, a continuous stream of income and such but I may face the same situation as I had in previous organization after sometime.

I discussed with my friends who are already doing their businesses (most of my friends are doing their own business :)). They encouraged me to try on my own before heading for job hunting. I will especially mention Aamir Ansari of Think Enabled, Fawad Moon of DevEnhancedKhurram Zafar and Shah Khalid apart from many others who helped me in taking and finalizing this decision.

I acknowledge it was not an easy decision but it was something like now or never. So in May 2014 PivotalSigns was launched.

From the beginning when PivotalSigns was launched, we had decided that it will not be a merely outsourcing company, instead we will look forward for partnerships that last.

We are working on our own product ideas and working with clients to bring life to their ideas. Our core values are to provide quality services, work hard and remain honest with clients and customers throughout the project / product life style.

Going forward, I will try to share my experiences and learning on this journey.

AWS Volume Snapshot Automation

I am working on a small backup automation script for AWS (Amazon Web Services). Previously, I wrote this script shared on Github Gist here to take a snapshot of a specific volume for one user which is already being used in production.

Now I am thinking to add the following to this script:

  • Add support in script to be used by multiple AWS accounts in different regions.
  • Remove older snapshots and keep only the latest 3 copies for so.

I will share this script as a separate project on Github once complete.

Git Hands On Workshop

A friend requested to do a small hands on workshop on git. I prepared the following very brief introduction and tutorial  for him and his team.

What is Git?
Git is a distributed revision control and source code management (SCM) system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005.
What are forks?

When you are cloning a git repo on your local workstation, you cannot contribute back to the upstream repo unless you are explicitly declared as contributor.

So that clone (to your local workstation) isn’t a fork. It is just a clone.

Basic Git Operations
To initialize an existing project in Git, go to that directory and type this command.
In order to work with code, you will get a copy of it. The path to clone could be copied from bitbucket / github etc shown at top e.g. git clone

Once you have made changes to the code, before committing doing git status will show a list of modified files for analysis.

If there are any files, you don’t want to include in your project on git create a file named .gitignore with names of those files e.g. out put of a .gitignore file:

In git you have to add files / folders which are not yet part of project before you could commit them. To add an individual file git add filename (this concept is also called staging in git)

To add all modified and deleted files in your project, run this command:

This records a snapshot of your changes. With every commit it is recommended to include a comment so in future it could be easily tracked and know what changes were done and why. 

The commits don’t push the changes immediately to the remote repository. To push them to remote repository, use this command:

To see the differences between between your changes (not yet committed or pushed) and your last changes already committed run this command:

To remove a file in git first you remove the file from local, then run the following command, which will communicate this change to staging. In next commit, it will remove this file completely from repository as well.

To rename a file, use this command. 

By default, with no arguments, git log lists the commits made in that repository in reverse chronological order. There is a comprehensive list of options available to utilize with this git log command to make it more useful. Some common scenarios are comparison of history word by word, line by line etc.

If changes have been pushed to your fork by other users, you will need to pull them in before you can push. This pulls those changes in and applies your changes on top of them.

Above I have listed only a few common scenarios / commands, while git provides many more options and it will take time to master them all.

There are many resources available which would help in learning and exploring git further. Following are the two links which I found pretty useful:

Linux Training Workshop

In last few months, I conducted Linux Training Workshop for my colleagues in groups. It was aimed at our developers who were developing LAMP projects on Windows machines.

The presentation gives a very basic summary but in workshop I provided them examples and later also distributed a document which contains useful Linux commands.

Coding Standards

I have been programming from last 8+ years. I worked on different platforms and languages. Every language has its own power and beauty. But there are some global standards (or principles) which if followed could increase the ease of maintenance and scalability of code. Also, these standards greatly help in environments where multiple people are working on same project.

Another plus point for such code is that if a developer leaves, then a new developer could very easily follow and start from where he left due to good readability and clear code. In this regard a very good read is Code Complete by Steve McConnell. I follow a few rules taken from Code Complete, other sources and my experience:

Naming Conventions:

Variable names should be in all lower-case, with words separated by an underscore, example:

Names should be descriptive, but concise. We don’t want huge sentences as our variable names, but typing an extra couple of characters is always better than wondering what exactly a certain variable is for.

Function Names:

Functions should be named descriptively. Function names should preferably have a verb in them somewhere.

Function Arguments:

Arguments should be treated same as variable names. In most cases, we’d like to be able to tell how to use a function by just looking at its declaration. And also when we generate documentation via script, these will help us understand it better.

Include the braces:

One should use complete syntax for conditional / loop structures. Even if the body of some construct is only one line long, do not drop the braces. Examples:


Each function should be preceded by a comment that tells a programmer everything they need to know to use that function.

The meaning of every parameter, the expected input, and the output are required as a minimal comment. The function’s behaviour in error conditions (and what those error conditions are) should also be present. Nobody should have to look at the actual source of a function in order to be able to call it with confidence in their own code.

Especially important to document are any assumptions your code makes, or preconditions for its proper operation. Any one of the developers should be able to look at any part of the application and figure out what’s going on in a reasonable amount of time.

Kashmir Tour

From my childhood I had been hearing about Kashmir Janat Nazeer (Kashmir a paradise like place), so I always had dreams of going there but haven’t got a chance to visit these areas since I started travelling in 2000. In year 2012 beginning when I started planning for my tour in June , I had in mind Kaghan and surrounding areas. I discussed about this with Shujaat and he immediately asked me to change this to Kashmir.

I started researching and studying about our plan to Kashmir. In this regard, I like to take help from  PakWheels Forums, which has been very helpful for me in planning my trips in Pakistan. I got to know about a Tour Group who were helping in touring. I finalized and booked a plan with them.

9th June – Saturday: Left Karachi with my friends via Daewoo Bus to Rawalpindi.

10th June – Sunday : We reached Rawalpindi at afternoon and met our friends who were joining us from Mardan. From there we left for Murree. Unfortunately when we reached there Rawalpindi there was some CNG strike due to which it took quite sometime for us to reach Murree. And then the Taxi we hired from Rawalpindi also cheated us and dropped us in mid-way instead of dropping us closer to Mall Road as we agreed upon. The reason as he used was an Urs due to which all roads were blocked in Murree hill. However, soon we had to hire another Taxi and were able to reach Mall Road. Here I learned an important lesson that don’t show sympathy to such people (which I always show :() who cheat you. It was first visit of my friends to Murree and they liked it very much, they really liked roaming on Mall Road. It was an experience worth remembering for them 🙂

11th June – Monday: We visited Kashmir Point in morning and it was very peaceful at that time. Usually in evening time that area gets very crowded. We left Murree at noon and again we faced the same traffic blockage and less traffic on Motorway due to that Urs (as such Urs usually remains for 2-3 days). It took time but finally we reached Muzafarabad around 6PM. There I contacted the Tour Group people and they helped us took a room in a Hotel in Muzafarabad.

12th June – Tuesday: We left Muzafarabad in morning for Kutton. I would say now its Kashmir. The journey we started for Kutton was an extra ordinary one. I watched River Neelum flowing, Indian border, breath taking sceneries and acknowledged that it was not wrong to say this Janat Nazeer. We reached Jagiran Resort House in evening, while stopping at Kondal Shahi and other areas for taking pictures, doli rides etc. It was a pleasant journey.

Staying in Jagiran Resort House was an experience in itself. This resort house has been built by Govt. of Azad Kashmir and is an extra ordinary place. The surrounding areas and views from resort house are simply majestic.

Jaigran Resort House

View From Resort House

Outside Resort House

13th June – Wednesday: Early in the morning we left resort house for Keran / Kel. We went till Sharda and couldn’t go to Kel as we had to come back for night stay at Jagiran rest house.

This whole journey from Kutton to Sharda was very good. The roads were clear and views were fantastic. I had been to some other Pakistan’s NA areas e.g. Swat, Dir, Chitral and liked Kumrat, Dir the most till then. But after visiting Kashmir, I just fell in love with it and we enjoyed every bit of our journey there.

After visiting some old ruins and other areas in Sharda, we started our journey back to Kutton. On our way back it started to rain and when reached Kondal Shahi it was completely dark and raining cats and dogs. We took some stuff from the Bazar and left Kondal Shahi.

Keran Sharda

14th June – Thursday: We had plan to go to Jagiran Power house by doing a trek. So except for one friend all 4 others left for it. We did a trek for an hour or two so and then had to get into a Jeep which was going there as it was very steep :). There at Power house we spent some time and got back (once again by walk and some Jeep ride).

Jagiran Power House On way to Jagiran House

Upon reaching the resort house, a bad news was waiting for us. The van which was given to us by the Tour Group was called back by them without giving us any reason / update. I inquired from the resort house people and confirmed no body from Tour Group had approached them to update us about it. They just called the driver and driver told our friend who was in resort house and left. It was totally unprofessional. We had already paid 70% of amount agreed upon to Tour Group and rest was supposed to be paid when reach back to Muzafarabad. This incident really disturbed us.

As that same day we were supposed to leave for Muzafarabad. After discussing with my friends, we decided to go ahead with the actual plan and don’t wait for the Tour Group people. This descision was quite risky as we were far away in an area where finding rides were not easy but we took the risk and were hoping to find something on our way till Kundal Shahi, from where we were expecting to get a Taxi to Muzafarabad. So we left resort house and fortunately walking for an hour or less we found a ride which dropped us at Kundal Shahi. From there we took a Taxi till Muzafarabad, where it dropped us around at 6 PM.

As per our original plan we were supposed to stay in Muzafarabad for night but one of our friend suggested that we should leave and see if we could reach on time to Rawalpindi and then Mardan. Fortunately we found seats in last Qadri Coach which was leaving for Rawalpindi. We took the Coach and started our journey back to Rawalpindi. While travelling in that Coach one of the person from Tour Group contacted us and excuse for whatever happened. But I strongly feel whatever they did was very unprofessional. And I would certainly not recommend them to anyone. This incident also taught me a lesson to trust only trustworthy people.

We reached Rawalpindi at 11 PM and were amazed to see life in full swing at that time which is now quite rare for Karachi people 🙁 due to certain reasons. We easily hired Hiroof and reached our friend’s house at around 2AM or so in Takhte Bhai. We tried to look for famous Chapal Kebab but they said they were finished so just had some tea.

15th June – Friday: I left Mardan for my village and from there flew to Karachi on Sunday 17th June.

Overall it was a memorable trip and I look forward to go again to Kashmir and visit the areas which I couldn’t in this trip. I regret not having more days to explore these areas but inshAllah very soon I will be able to compensate for that 🙂

I believe Kashmir is a place to visit again and again. I see there are two routes which one could take: One is via Muzafarabad and then areas coming on that route and the other is Bagh and then areas coming on that route. So I will try to explore areas on both routes.

I also found the roads in Kashmir well built (as compare to Swat and Dir), people are friendly (as compare to Murree and Kaghan but not better than Swat). So I would say it is accessible, affordable and beautiful. Both family and with friends one could enjoy this.