Recently I had been studying C++ and Unit Testing (C++ from this Udemy course and Unit Testing from this book). Finally I landed on this Test Driven Development in C++ course. From this articular onward I will share my experiences with these. In this post, I will describe what is a Unit test and how to add googletest to your project.

Unit Test

A unit test simply verifies the behavior of a small piece of code (simply a function). It does not verify your coding standards right, you validated inputs ,you used proper syntax etc. It simply a black-box test.

Image :

I had learned C++ few years ago at university. But, I was not happy with OOP concepts. Even during Java Data structures subject , I often heard about setters and getters . I was literally completing assignments with the help of friends.

From that time, when someone says OOP, I feel uncomfortable. Recently I got my annual leaves and decided to complete some C++ on Udemy as my original plans got destroyed by Covid-19. Even there I felt the same when I am about to take OOP.

Somehow after seeing same video few times, finally I understood getters and setters

I recently watched this OWASP Top-10 talk from Jim Manico and tried this sample using basic golang. I am not a security expert, but by doing this I understood how parameterized queries would keep us safe from basic level SQL-injection attacks. And also how golang’s go-sql-driver automatically make decisions based on our parameterized queries.

For this I had used golang with docker and docker-compose, Wireshark to monitor packets and MySQL.

First lets see how non-parameterized queries would behave with SQL-injection.

badEmail := "'sac'or'1'!=''"results, err := db.Query("SELECT password FROM users where email=" + badEmail)

As ’sac’or’1'!=’’ this is a legit…

This will be the part 3 of my Nginx series. If you havent read first two, please read them before start this. Hope they would give you an idea about nginx (if you are not familiar with nginx). Part -1, Part-2.

Lets get into the topic. Nginx can work as a Layer 7 and layer 4 load balancer. Here I will mostly focus on Layer-7 . First lets see about how to configure nginx as layer-4 load-balancer. Which is not kind of full load balancer we have nginx working in layer-7.

TCP packets are the things in OSI layer 4…

I hope you have basic understanding about Nginx. What it is and how we can use it as a proxy. I have explained them in my previous port. Today lets talk about some other benefits we can get from Nginx (before going to LoadBalancing). This will be a shorter description.

Regular Expressions

We can use regular expressions in our nginx configuration to do simple routing. ~ is used to indicate we are going to use regex in our nginx config. Following config can be used to block serving .jpg images to users.

location /images {
root /home/project/images/;
# check…

Today lets talk about, How to write a simple Linux kernel module. Lets write a simple hello world module, and try to understand all the basic things defined in that program. For this guide, I assume you have basic understanding about.

  • C programming language
  • Makefiles

As you already know, we use C — Programming language to write Linux kernel modules. But we can not use normal C syntax for some cases in kernel module programs. All official guide can be found here. Please go through it if you are not familiar.

This is one of the basic hello-world type Linux…

Today I am gonna talk about something I started to learn recently. I have used nginx many times, but didnt have much deeper understanding. So I decided to dig deeper. Luckily I found Hussein Nasser’s Nginx series. I highly recommend you to follow it. Here in this post, I will try to give you a briefer description about nginx and simplest configuration to run and serve our sites. So lets get started.

What is Nginx

Nginx basically has two main features.

  • Web Server
  • Proxy (Layer 7 and Layer 4)

But here we will focus on the most important part of…

I got a chance to look at some online courses during covid-19 lockdown, most of following things were learned from Usable Security — Coursera course and my personal experiences. I highly recommend anyone who reads this to follow this course as its taught by academic experts and interviews with industrial experts.

Requirement Gathering

This is the first time we meet our client and get his/her requirements for the system we are about to develop for them.

  • We MUST agree and get a full list of client expectation from the system. What is should do and what shouldn't.
  • Make notes for…

Tea plantation — Near Nuwaraeliya

This is part two of our journey to Hill sides of Sri Lanka. If you have missed you can read part-1 of this series.

From NanuOya we took a public trasport bus to come to NuwaraEliya. It takes around 30–40 minutes and cost only 23 rupees per person ( early 2020). If you took Tuk tuk, it would be much different story. Also buses are not jammed packed. We got seats easily and there were plenty of room left.

We got off from NuwaraEliya bus stand at about 2pm, then we were looking for a place to have lunch. There…

Re-inventing the wheel, is it good or bad? Here I am going to list things as I understood.

Why its bad idea :

  • It takes a lots of time to design and implement a new thing.
  • No independent security analysis.
  • Testing, you wont get many edge cases during tests.
  • Lack of resources.

This is why many companies always use already developed and tested libraries to their products. When it comes to security, if you plan to develop your own security schema means, the probability you fail is much more than a hacker breaching a well known security library.

Especially when…

Sachith Muhandiram

DevOps who is willing to learn and try new things.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store