Index ¦ Archives ¦ Atom

Resource Acquisition Is Initialization (RAII) in C

GCC's C compiler allows you to define various variable attributes. One of them is the cleanup attribute (which you can also write as __cleanup__) which allows you to define a function to be called when the variable goes out of scope (for example, before returning from a function). This is …

Data in C

In C, the data you use in your programs will usually fall into one of the three basic categories: int, char and float. Data in C has no existence without an associated memory location labeled by an identifier, usually referred to as a variable (the term variable is a bit …

Data in CPython

When writing programs in Python (CPython), you have access to data types such as a int, str, tuple, list and a dict. It is fairly obvious what each of these data types would be used to represent: an int data type would represent an integer and a list would represent …

Quick and dirty debian packages for your Golang application

In this post, we will learn about a quick and easy workflow for building and deploying your golang applications as Debian packages. The packages produced will not be official quality DEB packages.


I have been using dep for dependency management, and I assume that you are doing the same …

Your options for monitoring multi-process Python applications with Prometheus

In an earlier article, Monitoring Your Synchronous Python Web Applications Using Prometheus, I discussed a limitation of using the Python client for prometheus.

Limitation of native prometheus exporting

prometheus was built with single process multi-threaded applications in mind. I use the term multi-threaded here to also include coroutine based concurrent …

Linux System Mining with Python

In this article, we will explore the Python programming language as a tool to retrieve various information about a system running Linux. Let's get started.

Which Python?

When I refer to Python, I am referring to CPython 2 (2.7 to be exact). I will mention it explicitly when the …

Doing something before systemd shuts your supervisord down

If you are running your server applications via supervisord on a Linux distro running systemd, you may find this post useful.

Problem Scenario

An example scenario to help us establish the utility for this post is as follows:

  • systemd starts the shutdown process
  • systemd stops supervisord
  • supervisord stops your processes …

Setting up OpenVPN client with systemd template unit files

First, I installed openvpn:

$ sudo dnf  -y install openvpn

Then, I used the following systemd unit file from here to create a systemd service for creating a new VPN connection on Fedora 27:

$ cat /etc/systemd/system/openvpn@.service 

Description=OpenVPN service for %I …

Tip: Terraform and AWS Security Group rules in EC2 classic

When using Terraform's aws_security_group_rule with EC2 classic, you may get an error saying that the source security group doesn't exist, even though it does. That's probably because you (like me and others) used the source security group ID and not the security group name, like so:

resource "aws_security_group_rule" "my_sg_rule" {
  type …

Compilation and Interpretation in C and CPython

It is common knowledge that programs written in high level languages have to be translated into a low level language using programs referred to as translators. This low level language is either in a native form, in the sense that it is understood by the operating system itself, or in …

© Amit Saha. Built using Pelican. Customised theme based on the one by Giulio Fidente on github.