github reference

For home projects, the most likely workflow is to first create the project in some computer, then modify it continuously until it becomes fit enough to publish. At this stage, we have a project in the local machine and we wish to upload it in a new repository on

For people coming from different version control systems, git offers some challenge as the terminology is different for same functions. The following steps will push local changes to a remote repository.

1. On, create a new repository (empty) using the web interface, without specifying any files.┬áNote the URL for repository once created. Say for example, the URL is for the repository ‘project-name’.

2. On the local machine, navigate to the project folder and run

$ git init

This will create a blank repository in the folder, whose details are stored in .git subfolder.

3. Now, create a readme file and add files of the project to the repository:

$ echo "# project-name" >>
$ git add pom.xml src/

4. Add files to the local branch by running

$ git commit -m "initial commit message"

5. Hook up the local repository to the remote one (created on

$ git remote add origin

where user is the username on git, and URL is the same as the one mentioned by git at the end of creating the repository in the first step.

6. Push the local changes to remote repository:

$ git push origin master

Now the local changes will be available on the remote repository to be used by others.


Quick fstab reference

The /etc/fstab file is used to set permissions on disk drives when mounted at boot. Based on this, one is able to read/ write/ execute files on the disk. The /etc/fstab is general permissions file for disk partitions, so it works on any Linux distribution.

Below is the typical contents of /etc/fstab for a 2-disk setup (OS installed on primary, applications/ media on secondary, both internal), which enables the user to run executable files. [Note that UUID values have been removed; actual fstab entries should have these values].

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# / was on /dev/sda5 during installation
UUID= / ext4 errors=remount-ro 0 1
# /home was on /dev/sda6 during installation
UUID= /home ext4 defaults 0 2
# swap was on /dev/sda8 during installation
UUID= none swap sw 0 0
# s33 on /dev/sdb5 (Secondary Drive)
UUID= /media/user/s33 ntfs-3g defaults 0 0
# s34 on /dev/sdb6 (Secondary Drive)
UUID= /media/user/s34 ntfs-3g defaults 0 0

The last 2 entries (lines starting with ‘#’ are comments) are for 2 NTFS partitions (/dev/sdb5, /dev/sdb6) on a secondary internal hard drive. These were added manually after the OS install on primary, which automatically added the first 3 entries (root, home, swap).

The options column above decides which permissions to be set for the drive. The value defaults contains the options rw, suid, dev, exec, auto, nouser, and async. This is a typical usage of a file system, where the user will be able to read, write, execute files. The contents specified by defaults can be checked in the manual for mount, towards the end:

$ man mount

For more restrictive permissions, we can individually set permissions via fmask (for files), dmask (for directories), and umask (for both) by providing the bitwise inverse of the actual chmod permission number we want to set, since these are bit masks. More details can be found in the community guide for fstab in Ubuntu here.

One thing to note is the UUID for these drives, which for a partition can be obtained by running

$ sudo blkid

as suggested in the fstab header above.

fix linux mint audio stuttering

With certain Intel HD audio cards, Linux Mint is found to stutter when sound volume is high. The exact threshold of the volume varies with the application/ media being played, but the stuttering is definite and bad enough to the point of being unusable. The issue is similar to what we often get in a sound system when we try to insert a audio jack to a socket, with the speaker volume set high. It may also occur in other Linux systems.

The problem is that in case the motherboard has a front headphone socket, the Linux audio driver tries to send output to that channel also (even though that socket is not connected to any audio jack, and the only output is the speakers connected to the back). If we disable this socket, then the issue is resolved. This is an issue with Linux only, since the same motherboard/ audio setup works fine with Windows.

To resolve the issue, we need to install hda-jack-retask, and override the front audio socket to disable it.

1. Install alsa-tools-gui package, which contains hda-jack-retask:
sudo apt-get install alsa-tools-gui

2. Open hda-jack-retask (Menu > Sound & Video > HdaJackRetask) and scroll down to ‘Green Headphone – front side’. Select ‘Override’ and from the choice list, select ‘Not Connected’. This means we override the front audio socket using a front end of the audio driver.

3. Apply the settings and test whether the audio issues are resolved – e.g. play a Youtube video at very high volume. The stuttering should be gone now.

4. Install boot override (in the same UI) to persist the setting across reboots.

setup mysql on linux

To use MySQL DB on a linux system, we need the MySQL server, client, and optionally, a UI client. For the UI Client, we will use DBeaver, which is a free universal DB client supporting MySQL, SQLite, Postgres, Oracle, and many more. We will create the DB using command line MySQL client, then connect to it using the UI client.

To setup MySQL GA (General Availability version) on Linux (Ubuntu and derivatives), below are the simple steps. Currently, the GA version is 5.6.

1. Download and install the .deb that adds MySQL repository to APT sources:
Download the .deb that corresponds to the version of Ubuntu. While installing the .deb, select the latest versions for all MySQL components (like Server, Workbench, Utilities), then select Apply from the same component list to end the selection.

2. Update the repository
$ sudo apt-get update

3. Install MySQL server and client
$ sudo apt-get install mysql-server mysql-client-core-5.6

Add root password when prompted during the installation. Also, MySQL server is automatically started at the end of installation. To stop it,
$ sudo service mysql stop

To start/ restart,
$ sudo service mysql start

To check whether started,
$ sudo service mysql status

4. Open MySQL client to create a database. We’ll later connect to this DB from DBeaver.
$ mysql -u root -p

Enter root password when prompted (the same one specified in the previous step).

5. Create the DB. In this example, we create the admissions DB that is used in Stanford’s Databases course.
mysql> create database admissions

Note that the database name is case sensitive in Unix.

6. Quits the MySQL prompt
mysql> \q

7. Install DBeaver as MySQL UI-based client
Download the 64-bit archive (assuming 64-bit OS), not the .deb file, because the .deb requires JRE 7 in PATH, whereas there may be a more recent version of Java in the system (say Java 8). Extract the archive, then add to PATH the base directory (which contains the dbeaver executable).

8. Open DBeaver
$ dbeaver

9. In DBeaver UI, create new MySQL connection with all defaults, user = root, and pwd = root pwd (for MySQL given in step 3). Put database name as the one created in step 5.

10. Connect to the DB, then run any scripts to create schema and data using the SQL Editor inside DBeaver (right-click on connection -> SQL Editor)

Now we are ready to run any queries against this database.

Install rJava in Ubuntu with Oracle Java

Ubuntu does not come with any Java installed, unlike Linux Mint which comes at least with openJDK. The rJava package in R requires a JDK to exist in the system. If one uses Oracle Java, then at this point, he may want to install Oracle Java instead of openJDK. This process is very simple:
1. Download Oracle JDK archive
2. Extract to a location with user access, say $HOME/apps/jdk1.7
3. Add/ modify 2 environment variables: Create/ open $HOME/.bashrc and add to the end:

export PATH

export JDK_HOME

4. Since this is the only java, we dont need the update-alternatives. That would be required in Mint, since the default /usr/bin/java would be provided by the pre-installed openJDK.

Now, we want to configure Java for R, using

$ sudo R CMD javareconf

This searches for java in the PATH, then configures R to use that Java (does not modify any system environment variable). The problem with this command is that by default, it picks JAVA_HOME as $JDK_HOME/jre, instead of $JDK_HOME. Because of this, R thinks that only JRE exists in the system, and not JDK (which it requires). Hence, instead of above command, we give

$ sudo R CMD javareconf JAVA_HOME=/home/user/apps/jdk1.7

where ‘user’ is the username. This is the JAVA_HOME that we want R to have in its javaconf, because this is the JDK_HOME and not JRE_HOME.

Also, the JAVA_HOME system environment variable takes precedence over the one in R javaconf, hence we must remove it. If

$ echo $JAVA_HOME

returns something, it means at some point we had set the variable, so we must remove it. The command for R javareconf earlier would not set it, because as mentioned it does not create/ modify any system environment variables. To remove it,

$ unset JAVA_HOME

At this point, we have configured R javaconf, and ensured that JAVA_HOME is not set in the system. It therefore exists only in R javaconf. Open R (or RStudio), and install rJava:

> install.packages("rJava")

If behind a proxy, we can set R env var http_proxy. Open $HOME/.Renviron (create if does not exist) and add the line having format: