Docker get private ip address of container

In order to access other containers from a container it's needed to get the private IP address of the other containers. The following command is able to get the private ip address of the container.

$ docker inspect --format="{{.NetworkSettings.IPAddress}}" $CONTAINER_ID_OR_NAME
172.17.0.15

Continue reading »

Docker Multiple websites/domains on single ip/host tutorial using a HAproxy as reverse proxy

This post will describe how to expose multiple docker containers running websites on port 80 using HAproxy as a reverse proxy. This makes it possible to run multiple websites on different domains on a single public ip of the host.

The basic setup is to create 1 container for haproxy …

Continue reading »

Move first word to end of line (Linux/awk)

Move the first word of a line to the end of line on Linux using AWK. We first store the first column(first word) in the variable t. Then we set the first column to be empty. At last we add a new column after the last column of the …

Continue reading »

SSH to server behind a firewall via an SSH tunnel

A server behind a firewall was unaccesible from my home, but another server which is on the same local network had public SSH access from my home. So we can create an SSH tunnel via this public server to the server behind a firewall.

For example the public ssh server …

Continue reading »

Recursive karatsuba multiplication in Python

I'm currently taking the class Algorithm: Design and Analysis of Stanford via Coursera and in the class the Karatsuba algorithm got mentioned. I went ahead and implemented it based on the lecture slides.

The Karatsuba algorithm is a fast multiplication algorithm. It's special because it was the first multiplication algorithm …

Continue reading »

Using nested tmux over ssh and how to detach a nested tmux

Today I logged in to my laptop at home from work which was already running a tmux session, so thought yea just attach cool can continue with what I was looking at at home. I forgot that the keys would be the same ofcourse, and was unable to use the …

Continue reading »

Remove/detach a PCI device linux (kvm VGA passthrgough Nvidia Quadro 2000)

Answer:

echo -n "1" > /sys/bus/pci/devices/0000:02:00.0/remove

Where 0000:02:00.0 is related to your pci device address which can be obtained from the command lspci

Related story:
Was working on KVM vga passthrough and encountered problems with the graphics card nvidia Quadro …

Continue reading »

Install PyQt in a virtualenv with Pip

Noticed that pip install pyqt isn't working? At least at the time of writing this blog it isn't..

This is the error that I got:
IOError: [Errno 2] No such file or directory: setup.py

It seems they didn't package it well and it's using configure.py to install. So …

Continue reading »

Ignoring every channels join/part/quit messages in IRSSI

Tired of all those join part messages?

/ignore \* joins  
/ignore \* parts  
/ignore \* quits  
/save

Read more about ignore /help ignore

Taken from Archwiki: https://wiki.archlinux.org/index.php/Irssi

Continue reading »

Create tar archive of changed/added files in a git commit

The following command first gets the changed and added files of a git commit and then creates a tar archive of those changed files.

git show {{COMMIT_ID}} --name-status | grep -Ew '^M|A' | awk '{ print $2 }' | xargs tar czf usb-passthrough.tar.gz

Continue reading »