Credits: source

semaphores are a little asymmetric, let’s see how.

Semaphore is a synchronization construct in concurrent programming. But do you know about the asymmetric behavior of semaphores?

Let’s see some definitions.

A semaphore is an object with two methods Wait and Signal, a private integer counter and a private queue (of threads)

wait: Decrements the value of the semaphore variable by 1. If the new value of the semaphore variable is negative, the process executing wait is blocked (i.e., added to the semaphore’s queue). Otherwise, the process continues execution.

signal: Increments the value of semaphore variable by 1. After the increment…

Let’s make Boomerang ( by Instagram) like gifs.

Photo by Jakob Owens on Unsplash

Knowledge grows exponentially. The more we know, the greater our ability to learn, and the faster we expand our knowledge base — Dan Brown

True it is!

If you haven’t read Part1 of the series, go read it here.

This time let’s learn a few more handy and elegantly powerful methods from Moviepy.

We will do it via an example. Say we want to make a funny gif which plays forwards and backwards ( just like Boomerang from Instagram)

I love cats ( just like everyone else 😅). I found a funny…

Moviepy is a video editing library in python.

Photo by Jakob Owens on Unsplash

If you deal with a lot of videos, you must have came across a case where you either needed to process a video at frame level or compose (JARGON) small video clips into a larger one or add some subtitles to a video, manipulate existing audio and what not! You can do all of it with Moviepy.

In this series I’ll try to explain how to use Moviepy to get things done.

To get started you need to have python installed on your system. You can refer to this article for setting up python on mac, this one for linux based systems. Once you have python on our system, you can install Moviepy with the instructions on it’s github page.

Let’s get started with some basic terms related to videos.

A Video in general, is a sequence of image frames played at a certain fps. Every video has certain…

Credits : Unsplash

This article explains an example of how to use numpy indexing efficiently.

Let’s start with a simple example of transforming elements of an array by an arbitrary transformation rule.

Say you have a 1D array of integers named source which you want to transform into 1D array of integers named result using the lookup table named lookup_table.

source = [0,2,3,1,4,5]lookup_table = [11,22,33,44,55,66]

How to perform lookup?

To find the mapping of an integer n read nth element in lookup_table.

If we apply above transformation rule to source array, we would get

result = [11,33,44,22,55,66]

A naive python code for…

Tejas Bobhate

HPC Engineer @ R&D Lab

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store