GlusterFS - Replicate a volume over two nodes
When you are using a load balancer with two or more backend nodes(web servers) you will probably need some data to be mirrored between the two nodes. A high availability solution is offered by GlusterFS. Within this article, I am going to show how you can set volume replication between two CentOS 7 servers. Let's assume this: node1.domain.com - 172.31.0.201 node2.domain.com - 172.31.0.202…
Mysqldump Command - Useful Usage Examples
One of the tasks a sysadmin will always have on their list is backing up databases. These backups are also called dump files because, usually, they are generated with mysqldump command. I am going to share a few tricks on mysqldump that will help when handling servers with many relatively small databases. The most simple way to backup databases would be using mysqldump command with the the…
OOP in Golang vs C++
Before I started to learn Go, every online opinion I would read about the language complained about the lack of generics and how OOP was dumbed down and so on. It made me put off learning it for quite some time, more than I would like to admit. Coming from a C++ background, OOP, generics and meta-programming was my daily bread. It wasn't until I had to actually learn Go that I saw what it…
How to save a file in Vim after forgetting to use sudo
Many of you probably experienced this. You edit a file in Linux with Vim or Nano or whatever else text editor you might be using and when you try to save, you realise you forgot to launch the editor with sudo privileges, and file can't be written. Exiting without saving and editing again with sudo privileges is not always an option, especially if you lose a lot of work. Solutions There are some…
Emulating a Redis Failover with Docker
Reading the Redis documentation can be a bit confusing without the hands-on experience. You could in theory create multiple processes of the Redis Server on your machine and configure each of them in part, but what if you could do it in a few commands? Not only that but emulate the network they’re connected to as well. I’ve been looking into this and there’s a few examples out there on Web, the…
Why Should Your Online Business Offer API
There are several ways to extend a business model but API is a hot topic right now as the online world is expanding very fast. If you’re a developer or at least interacted with APIs before, you probably know why public APIs are so important, but there’s a big chance you didn’t hear or care about them before and now you’re wondering why everyone talks about them. What is an API In computer…
Counting lines and words using Go
For those who need to count words and lines in text files, an easy approach for this matter is to use bufio.ScanWords and bufio.ScanLine in order to quickly solve the problem. To count words: [crayon-643b82c844f13668190501/] ScanWords is a split function for a Scanner that returns each space-separated (checks unicode.IsSpace) word of text, with trimmed whitespace. To count lines:…
Debugging Golang apps in Docker with Visual Studio Code
Context We’ve recently had some problems with a Go application that was running inside a Docker container in a very big Docker Compose setup. After getting fed up with writing console prints and rebuilding the Docker image for that container and spinning up all the containers to debug things, we started investigating how we could speed up our debugging process. Enter Visual Studio Code and its…
Start writing tests in Ruby: useful gems
Being a QA engineer is a continuous struggle in finding the right resources in order to get the job done easier and more efficiently. If you are planning to write automated tests in RSpec (Ruby's testing framework), then you should take a look over these gems. Please notice that I am most of the time automating backend tests only, so the libraries I am using are for this purpose mainly. 1.…
Build a Face Detector on OS X Using OpenCV and C++
Building and using C++ libraries can be a daunting task, even more so for big libraries like OpenCV. This article should get you started with a minimal build of OpenCV and a sample application written in C++. This application will get images from the webcam, draw rectangles around the faces in the images and show them to you on screen. Requirements I've built this on a MacBook Pro running OS…