Autocompile Protobuf Files


Add the plugin,

addSbtPlugin(“com.github.gseitz” % “sbt-protobuf” % “0.6.3”)

to the plugins.sbt under the project[root-build] directory.

Add the following libraries to the build.sbt in the library dependencies: “” % “protobuf-java” % (version in ProtobufConfig).value %, and

“com.googlecode.protobuf-java-format” % “protobuf-java-format” % “1.4”

Next add the following statements out side the library dependencies:

—- Changing the default generated source directory location from ‘src_managed’ in ‘target’ to ‘generated-source’ under ‘app’ directory —-

javaSource in ProtobufConfig := baseDirectory.value / “app” / “generated-source”

— Enable the Protobuf Plugin using the below statement–


Note: Make sure the name of the folder residing *.proto files is ‘protobuf’, since it is the default name to identify the *.proto files location to compile & generate protobuf classes. Finally run the `sbt shell` or `SBTConsole` to clean & compile in order to generate the protobuf classes in “generated-source” directory.

NOTE: Any changes made to the build.sbt file will not take effect until we kill the current process in `sbt shell` or `SBTConsole` & start a new one again.

Replacing proto path using REGEX

Replacing proto path using REGEX

Find & replace “import paths” in .proto files:

The following command will replace the text ‘enums/’ to ‘enums’ removing the forward slash in the entire directory consisting of .proto files.

NOTE: Make sure to give the complete text while searching to replace appropriately at the desired locations.

find ./ -name \*.proto -exec sed -i “s;enums/;\\enums;g” {} \;


The text ‘enums/’ is the text to find in the proto files & the ‘enums’ text after the double back slash is the one to be replaced.

Git working with branches

List all branches:

git branch -a

Create a local branch

git checkout -b dc-server-modification

switch to master after creating branch

git checkout master

switch to branch

git checkout dc-server-modification

Create a remote branch under origin/master

git branch -t dc-server-modification origin/master

Checkout locally remote branch

git checkout -b dc-server-modification

Push to remote branch

How do you merge your changes performed on the branch with the master, while you are there on the branch?
git branch -a : “check the branch on which you are on”
git checkout dc-server-bug-fixes : “checkout the branch”
//Make changes
git add -A && git commit -m “bug fixes”
git status : “check up to date”
git rebase master : Rebase on master happens
git checkout master
git merge dc-server-bug-fixes: “merges all changes master”
git push -u origin master

The following steps might help anyone who are new to git rebase and wanted to do it without hassle

Step 1: Assuming that there are no commits and changes to be made on YourBranch at this point. We are visiting YourBranch.

git checkout YourBranch
git pull –rebase
What happened? Pulls all changes made by other developers working on your branch and rebases your changes on top of it.

Step 2: Resolve any conflicts that presents.

Step 3:

git checkout master
git pull –rebase
What happened? Pulls all the latest changes from master and rebases master on latest master.

Step 4: Resolve any conflicts that presents.

Step 5:

git checkout YourBranch
git rebase master
What happened? Rebase on master happens

Step 6: Resolve any conflicts, if there are conflicts. Use git rebase –continue to continue rebase after adding the resolved conflicts. At any time you can use git rebase –abort to abort the rebase.

Step 7:

git push –force-with-lease
What happened? Pushing changes to your remote YourBranch. –force-with-lease will make sure whether there are any other incoming changes for YourBranch from other developers while you rebasing. This is super useful rather than force push. In case any incoming changes then fetch them to update your local YourBranch before pushing changes.

Why do I need to push changes? To rewrite the commit message in remote YourBranch after proper rebase or If there are any conflicts resolved? Then you need to push the changes you resolved in local repo to the remote repo of YourBranch

Yahoooo…! You are succesfully done with rebasing.

You might also be looking into doing:

git checkout master
git merge YourBranch : “merges the branch with your master”
git push -u origin master : “pushes to master”

Setting up MYSQL in CENTOS 6.9 Command Line


Whilst using MYSQL SERVER 5.7 or above kindly ensure to comment the line

#thread_concurrency = 8

 in the file (“/etc/my.cnf “  or “/etc/mysqld/my.cnf “ ) as its deprecated from version 5.7.

Installation Commands:

yum remove mysql57-community-release.noarch
yum clean all
yum install
yum install mysql-community-server

Now Start the Server using the following commands:

/etc/init.d/mysql start ## use restart after update

## OR ##

service mysql start ## use restart after update

chkconfig –levels 235 mysqld on

service mysql status

Note: IF service doesn’t start check logs for error using command ‘cat /var/logs/mysqld.log’, if table is damaged kindly run commands to fix

            /etc/init.d/mysqld start –skip-grant-tables && mysql_upgrade

            ## OR ##

            service mysqld start –skip-grant-tables && mysql_upgrade

        /etc/init.d/mysqld status

          ## OR ##

         service mysql status

If the UserName & Password for the server already exists then use command,

            mysql -u root -p

and enter the password to login.

If it’s a first time installation then use the following command to generate “temporary password” to login,

            sudo grep “temporary password” /var/log/mysqld.log

Example Output:

[Note] A temporary password is generated for root@localhost: -et)QoL4MLid


Next Follow the steps below to set up the server database (Optional):

 MySQL Secure Installation

  • Change root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  • Reload privilege tables

Start MySQL Secure Installation with following command



Securing the MySQL server deployment.

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new password:

VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0

Using existing password for root.

Estimated strength of the password: 100

Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password:

Re-enter new password:

Estimated strength of the password: 50

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production


Remove anonymous users? (Press y|Y for Yes, any other key for No) : y


Normally, root should only be allowed to connect from

‘localhost’. This ensures that someone cannot guess at

the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y


By default, MySQL comes with a database named ‘test’ that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

 – Dropping test database…


 – Removing privileges on test database…


Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y


All done!

Note: If you don’t want some reason, do a “MySQL Secure Installation” then at least it’s very important to change the root user’s password

mysqladmin -u root password [your_password_here]

## Example ##

mysqladmin -u root password myownsecrectpass

  1. Connect to MySQL database (localhost) with password

mysql -u root -p

## OR ##

mysql -h localhost -u root -p

  1. Create Database, Create MySQL User and Enable Remote Connections to MySQL Database

This example uses following parameters:

  • DB_NAME = webdb
  • USER_NAME = webdb_user
  • PASSWORD = password123


mysql> CREATE DATABASE webdb;


mysql> CREATE USER ‘webdb_user’@’’ IDENTIFIED BY ‘password123’;


mysql> GRANT ALL ON webdb.* TO ‘webdb_user’@’’;

##  FLUSH PRIVILEGES, Tell the server to reload the grant tables  ##




Uninstalling & Installing MYSQL on Ubuntu

Uninstalling MySql :

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean


sudo apt-get update
sudo apt-get install mysql-server

Note:- Incase you encounter an ‘error:alternative path /etc/mysql/mysql.cnf’ then purge the unconfigured mysql using the

command:’sudo apt-get remove –purge mysql-\*’

& reinstall with the following command below

command:’sudo apt-get install mysql-server mysql-client’