Index ¦ Archives ¦ Atom

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 …


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 

[Unit]
Description=OpenVPN service for %I
After=syslog.target network-online.target …

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 …


Tip: MySQL - Too many connections

If you are getting the "Too many connections" error, couple of things worth checking on the MySQL server:

mysql> show processlist;
..

The above will show the currently open connections. The second is:

mysql> show variables like "max_connections";
..

The above will show the configured max_connections allowed. When you get this error …


Using Travis CI to publish to GitHub pages with custom domain

As of yesterday, this blog is automatically being published via Travis CI. When I push a new commit to my GitHub repository it triggers a new build in Travis CI. The build completes and the the git repository is then updated with the generated output (mostly HTML with some static …


Tip: Rotating video frames using iMovie

I had to rotate a few video frames using iMovie. The instructions for rotating the frames were working, but the rotation was being applied to "neighboring" frames as well. It turns out the trick is to use "split clip" to split a frame so that you can isolate the exact …


Getting started with gRPC and Python

My article on getting started with gRPC in Python is up on the codeship blog:

I build upon it in the next article:

The demos can be found in the python-grpc-demo repository.


Brief overview of using consul tags

consul allows a service to associate itself with tags. These are arbitrary metadata that can be associated with the service and can be used for different purposes. Below I outline a few examples of making use of tags and discuss some related topics.

Use case #1: Dedicated service instances based …


Add an additional host entry to docker container

Problem

Let's say a program in a container should be able to resolve a custom hostname.

Solution

When using docker run:

$ sudo docker run --add-host myhost.name:127.0.0.1 -ti python bash
Unable to find image 'python:latest' locally
latest: Pulling from library/python
Digest: sha256:eb20fd0c13d2c57fb602572f27f05f7f1e87f606045175c108a7da1af967313e
Status …

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