Skip to main content

Find the actual webcam device (`/dev/videoX`) in Linux

In Linux, V4L (Video4Linux) dictates how a video-capture device (as character node) is created in the device tmpfs filesystem (devtmpfs specifically, mounted on /dev). The webcam devices are usually created as /dev/video<index> e.g. /dev/video0. Different udev rules are then used to give these devices locations in /dev based on their ID (in /dev/v4l/by-id/), bus path (in /dev/v4l/by-path/) and so on.

Read more…

Add a custom program/command launcher to Linux Mint panel

Panel is the perfect place in Linux Mint to put the launchers for programs/commands that are used most often. To create a launcher we need a .desktop file that describes some attributes of the program. Most installed GUI programs come with their launchers (.desktop files), but when we have a custom command/program of our own that we want to create the launcher for, the only thing we need to do is create a .desktop file.

Read more…

Emacs recipe for starting tensorboard server

tensorboard is a quite popular among deep learning practitioners for experiment tracking. I also use it often, but what was bothering me for a while was to start the server (using tensorboard command) on one emacs buffer every time I want to track something. It gets tedious very quickly considering restarts as well. So, I've written a tiny elisp recipe to start/restart tensorboard directly from the (Python) file buffer (python-mode) in emacs.

Read more…

Patching decorators in Python

Being a syntactic sugar decorators are essentially a usually callable (e.g. a function or a class) that wraps another callable. And essentially they are applied/called when the module is being read.

For example, the following two chunks of codes are identical:

@decorator
def function():
    return 42
def function():
    return 42

function = decorator(function)

As we can see the decorator in this example is called when the file/module containing the above would be read. So how do we patch such an object?

Read more…