Featured post

How to keep your forked repositories in sync with the source repository

This blog post aims to answer the following questions.

  • How to contribute to Open Source Projects (Partially)?
  • How to keep forked repositories in sync with the source repository ?
  • How to pull the commits from source repository to the forked repository?

I often forked open source repositories found in github and also commit back to the repositories whenever I feel to. However, this may seem obvious who has been doing these kind of thing. But for someone who is completely new this is kind of mess and it’s hard to figure out the right way to do it at first. So, I do not claim that the way I show here is right. I am just showing how I do it my way and would like to share it with others.

I have forked repository from github repo. I already have it cloned in my local repository. I had forked it long ago. So, when I get back to the forked repo, I get a message saying that My repository is 3 commits behind.


Now, before I can contribute to the main repo I have to first sync up my repo with the forked one. To do that I have to bring in all the commits that are missing from my repo, those commits are as follows:

  • Add PHP School to intro FAQ
  • Add Snappy library
  • Add packages to work with screenshot APIs

I get inside my forked repository i.e. https://github.com/samundra/php-faq


is the folder that I have my forked repo on my local machine. So I use

$ cd php-faq

to get inside the folder. Inside the folder as you can see below “git remote -v” displays the “origin” as the remote.

To be able to pull in changes, I will add another remote which is my forked repository. I use

git remote add wwphp https://github.com/wwphp-fb/php-resources

Now when I do

$ git remote -v

it will display origin and wwphp under remote list.

Git Remote Add

Now, I fetch all the meta information from the newly added repo i.e. wwphp. I am only interested in the master branch and thus fetching information from that particular branch only.

git fetch wwphp master

Now, to see the commits that my repository is missing I use

$ git log --oneline origin/master..wwphp/master --left-right

Fetch metainformation from remote repository

It basically lists out all the commits that are in wwphp/master branch but no in origin/master (my forked repository).

We can see that we don’t have above 3 commits on my forked repository.
Commits on current repo

Just to confirm:
Commits on current repo

Now, to pull in the commits that my repo is missing I will use

$ git merge wwphp/master

Merge github commits from remote repo to forked repo

To confirm that we have successfully pulled in the commits we can see the “git log” output. The above output message “Your branch is ahead of ‘origin/master’ by 3 commits.” are shown because I haven’t pushed them to my forked repo on github. Once I push the currently made changes to my github repo then this message will stop showing up.

View merged commits

Finally push all the newly introduced commits to my forked repository.
Final push to the github

Now, the message has changed from “3 commits behind” to “branch is even” which means that we have successfully pulled in all the commits from remote repo to our forked repositories.


Instead of “git fetch wwphp master” we can also use “git fetch https://github.com/wwphp-fb/php-resources/ master” similarly we can use “git pull https://github.com/wwphp-fb/php-resources/ master”. However, I would suggest you use the fetch and then see the commits that will come in and whether you would like to merge or not.

Let me know if you have any confusions on this. I will try to answer them.

Happy forking :)

[Solved] Enable/Disable Touchpad in – Asus 510z (Ubuntu 16.04)

Machine Specification
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty

Board Information

sudo dmidecode | grep "Base Board"

Base Board Information
Product Name: X550ZE

My Touchpad information:

cat devices | grep Touchpad

N: Name=”ETPS/2 Elantech Touchpad”

Now copy this script to /usr/local/bin/touchpad.sh

Create file “/usr/local/bin/touchpad.sh” then copy and paste the above file contents into it.
change the file permission so it’s editable and executable by you.
sudo chmod u+x touchpad.sh

you might need to change the ownership of the file too.
sudo chown developer:developer /usr/local/bin/touchpad.sh

Here developer:developer is the user:group in linux.

Dash Menu

Now, we should bind a keyboard shortcut so that we can execute this script easily
through shortcuts. Open dashmenu and type keyboard. Open Keyboard settings.
In Keyboard settings window, navigate to shortcuts then to “custom shortcuts”.
Then click on the “+” sign shown and enter the following details:

Name: Touchpad
Command: /usr/local/bin/touchpad.sh

Keyboard custom shortcut
Click Apply.

Now this will be listed in the shortcut. But we are not done yet.
Now to assign the shortcut, click on the shortcut, it will change to “new accelerator”.
Hit any shortcut that you would like to assign to enable/disable touchpad. In my
case, I choose super+D, here super is “win” key in windows. This will save the
shortcut. If you already have assigned the shortcut to something else it will
ask you to reassign the shortcut.

Now try to enable/disable the touchpad with shortcut. You should see disable/enable
notification at the right corner. Hope you found this useful, let me know if you
found any difficulty in following this article.


Java installation in ubuntu in single screenshot

Java installation in ubuntu in single screenshot

Java Installation in single screenshot

tar xvfz jdk_source.tz -C /opt

cd /opt/jdk_source/

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk_source/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk_source/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javac" "/opt/jdk_source/bin/javaws" 1

[Solved] gulp watch error – ENOSPC

While I was working on one of my project, I got the following error while trying to run gulp watch.

[11:59:02] Using gulpfile ~/projects/gulpfile.js
[11:59:02] Starting 'watch'...
[11:59:02] 'watch' errored after 55 ms
[11:59:02] Error: watch /home/developer/projects/resources/assets/sass/ ENOSPC
    at exports._errnoException (util.js:870:11)
    at FSWatcher.start (fs.js:1234:19)
    at Object.fs.watch (fs.js:1262:11)
    at Gaze._watchDir (/home/developer/projects/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:289:30)
    at /home/developer/projects/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:358:10
    at iterate (/home/developer/projects/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
    at Object.forEachSeries (/home/developer/projects/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:66:3)
    at Gaze._initWatched (/home/developer/projects/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:354:10)
    at Gaze.add (/home/developer/projects/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:177:8)
    at new Gaze (/home/developer/projects/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:74:10)

After doing some google found the solution.

Why this issue occured? There is the limit in the number of files that can be watched in a system. We have to increase this number. The below command can be used to increase this number.

$ echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Related Links

Use phpmyadmin with nginx and php7

phpmyadmin page

Install the phpmyadmin following the normal application installation

Install phpmyadmin

sudo apt-get install phpmyadmin

Follow the normal installation process of phpmyadmin. Once the
phpmyadmin configuration is finished, we need to configure the
nginx configuration.

Nginx Configuration

Edit the nginx configuration (/etc/nginx/sites-available/default)
and add the following configurations to it.

# Phpmyadmin Configurations
    location /phpmyadmin {
       root /usr/share/;
       index index.php index.html index.htm;
       location ~ ^/phpmyadmin/(.+\.php)$ {
               try_files $uri =404;
               root /usr/share/;
               #fastcgi_param HTTPS on; # <-- add this line
		       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
               fastcgi_index index.php;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               include fastcgi_params;
       location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
               root /usr/share/;
   location /phpMyAdmin {
       rewrite ^/* /phpmyadmin last;

php7 and php-gettext symbolic links

Since php7 by default do not come with php-gettext we will need to install
these packages too.

sudo apt-get install php-gettext

If this package is not available then you will see following error messages
in your nginx error logs in /var/log/nginx/error.log

2016/04/28 10:22:30 [error] 17184#0: *6 FastCGI sent in stderr: “PHP message: PHP Fatal error: require_once(): Failed opening required ‘./libraries/php-gettext/gettext.inc’ (include_path=’.:/usr/share/php’) in /usr/share/phpmyadmin/libraries/select_lang.lib.php on line 395” while reading response header from upstream, client:, server: localhost, request: “GET /phpmyadmin/ HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php7.0-fpm.sock:”, host: “localhost”

Once php-gettext is installed use the below command to reconfigure the
symbolic links to gettext.

rm /usr/share/phpmyadmin/libraries/php-gettext/*
ln /usr/share/php/php-gettext/* /usr/share/phpmyadmin/libraries/php-gettext

Restart the nginx server

sudo service nginx restart

Browse http://localhost/phpmyadmin and it should show up the phpmyadmin login page.
– You may have to hard refresh to get to the page, since browser caches this page.