Home
Alexandra Zaharia
Cancel

Getting the most out of your webcam on Linux

[UPDATE February 26 2021: This webcam didn’t fare so well after all. I switched to a Logitech C920 after three months due to unacceptable random disconnects.] So… I bought a Chinese webcam. And ...

How to check the SSH host key fingerprint

When using SSH to authenticate to a remote machine, password authentication can and should be replaced with SSH key pairs. To generate your public and private SSH key, run: $ ssh-keygen -t rsa En...

Multiprocessing in Python with shared resources

The problem In the previous post on parallelism in Python, we have seen how an external Python script performing a long computation can be ran in parallel using Python’s multiprocessing module. If...

Run a Python script as a subprocess with the multiprocessing module

The problem Suppose you have a Python script worker.py performing some long computation. Also suppose you need to perform these computations several times for different input data. If all the comp...

Bitwise nuggets: rotate a number to the left using bit precision

Here we discuss how to rotate a number to the left by k positions, using bit precision. (In a previous post we’ve seen the same problem, but the rotation involved byte precision.) What does that e...

Bitwise nuggets: clear the first k most significant bits

Here we discuss how to clear the first k most significant bits (MSB) in an integer. This is a more intuitive variation of the clear MSB up to a given position problem that we have seen earlier. Wh...

Bitwise nuggets: check if a number is a power of 2

Here we discuss how to determine whether a given number is a power of 2. As we know, a number is a power of 2 if it has only one of its bits set to 1. Such numbers have a very interesting property...

Bitwise nuggets: insert a number inside another one

Here we discuss how to insert a number m into a number n between positions i and j. Let us see an example to better visualize what this means. Suppose we have the number n = 1040 and that we want ...

Bitwise nuggets: rotate a number to the left using byte precision

Here we discuss how to rotate a number to the left by k positions, using byte precision. (In a following post we’ll see the same problem when bit precision is used.) What does that even mean? We w...

Bitwise nuggets: clear the least significant bits up to a given position

Here we discuss how to clear the least significant bits (LSB) in an integer up to a given position pos (including pos). (Check out this post for clearing the MSBs up to a given position.) What doe...