Skip to main content

Emacs: Auto-format strings to a max column width in `python-mode`

I use blacken-mode (uses black) to auto-format Python code on save -- it works great but not much helpful while dealing with strings. For example, if I want to set a max limit on columns (characters) per line when writing a string, black is of no help. So I needed to come up with something in emacs that does the auto-format of strings -- set a max limit on-the-fly on number of columns per line for writing strings.

Read more…

Emacs: Dynamic buffer-local fringes

Emacs has a global fringe-mode for fringes, which I always keep disabled as it takes a bit of space in the frame and I like to start typing the first character on a line to the very left. But there are some cases where fringes are quite useful e.g. when flycheck shows different checker warnings/errors in code, it uses fringes (if enabled) to have a nice arrow to indicate the line(s) with the warnings/errors -- great to have a quick glance at everything.

Read more…

Emacs: Browse HTTPS web pages using `eww`

The eww browser of emacs (GNU Emacs 29.3) uses gnutls-cli to setup TLS connections to web servers. And on my Linux Mint 21.3 (based on Ubuntu 22.04), it wasn't installed; so whenever I was trying to visit any HTTPS site, the following error was shown (truncated):

Opening TLS connection with ‘gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt -p 443 ’...failed

Read more…

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…