A simple approach to creating an AWS Lambda layer for Python’s OpenCV wrapper

Coding desk setup
Coding desk setup
Photo by Farzad on Unsplash.

Lambda is a serverless offering by AWS that enables running scalable code without needing to configure servers. Each Lambda environment (corresponding to different versions of the compatible languages) comes with a selection of packages pre-installed.

However, what happens when we require a package that is not provided? There are a few approaches to addressing this shortcoming, one of which is the use of a Lambda layer.

In the next section, we will go over a programmatic solution to create a Lambda layer for a Python 3.7 application that requires OpenCV.

1. Install the Library in a Compatible OS

Lambda functions run on Amazon Linux (AMI). Therefore, to ensure that our version of OpenCV will run on the Lambda, we need to compile it for AMI. One way to do this is to install the library on an EC2 instance. …

I joined Robinhood in 2018. In 2020, I began to actively trade. Having had strong returns, I decided to share here some of the lessons I learnt along the way so other small retail investors like me may also benefit.

Image for post
Image for post

Disclosure: This article is not investment, tax, or legal advice, nor is it a solicitation for investment. I may have an affiliate relationship with some of the companies listed below. Furthermore, I am not a financial expert and offer this only as a way to share my experiences.


I spent the first 2 years after opening my Robinhood account dabbling semi-passively in trading to gain an intuition for how the markets moved. After this learning period, I decided to take on a more aggressive investment stance. …

As a society, we laud the work of generalists but our processes simply are not meant to recognize them.

Image for post
Image for post
Photo by Mika Baumeister on Unsplash. Featuring the Mona Lisa by Leonardo Da Vinci an engineer, philosopher and artist.

What is a Generalist?

Engineering and our educational systems as a whole are designed towards specialization.

At elementary school everyone learns the basics on which further knowledge will be built. In middle school, the division of knowledge into subjects starts to appear. As students are allocated individual time blocks to learn math, sciences, social studies and others. Up to this point, despite the already visible division of subjects, all students are still expected to learn the same subjects and to the same level of depth.

In high school, specialization starts to take place. Teenagers with only a superficial knowledge of different subjects are expected to choose the ones they want to further specialize in. …

For when .includes is not enough.

Image for post
Image for post
Photo by Paul Smith on Unsplash

Basic Rails Associations

Rails’ ActiveRecord associations permits relating one model to another. Take the example below:

class Post < ApplicationRecord
has_many :comments
class Comment < ApplicationRecord
belongs_to :post

A Post has many Comments. This allows us to call Post.first.comments to get all the comments associated with a post! ActiveRecord internally generates our required SQL queries:

SELECT "posts".* FROM "posts" WHERE "posts".id = 1
SELECT "comments".* FROM "comments" WHERE "comments".post_id

N+1 Queries and .includes

However, imagine we are serializing this data to return as part of a controller for the /posts index. In that case, instead of getting the comments for just one post, we would get it for multiple posts: Post.all.each { |p| puts p.comments }. …

The same curiosity that drove us to spread across our planet now drives us to reach out towards the stars.

These 6 incredible missions are teaching us more about our neighboring planets and sun while pushing our engineering capabilities to the limit.

1. Chang’e 4 — Lunar Lander and Rover

Image for post
Image for post
Panoramic Photo from Lander

The Chang’e 4 lander and rover are part of the Chinese Lunar Exploration Program which aims to develop the required technologies in preparation for crewed missions to the moon in the 2030's.

The current lander and rover are part of phase 2 of the program and demonstrated the ability to successfully land and navigate on the lunar surface.

Landing took place on January 3rd 2019 in the Von Kármán crater being the first to make a soft landing on the far side of the moon. …

A simple setup to programmatically enqueue jobs in a SLURM cluster.

Image for post
Image for post
Titan 3 Supercomputer Image from Pixabay


For those that have worked with a super computer cluster before, you know that scheduling batches of jobs where each job may not only have different settings (Ex: Hyper-parameters) but also different code can be a cumbersome task. Moreover, keeping track of all the different versions of code when analyzing the results can be tricky and a simple note taking error can result in many hours rerunning jobs.

Here, I demonstrate how to setup a Github Actions based approach to deploying jobs to a supercomputing cluster managed by SLURM. …

I finally got around to implementing my first Forex trading robot!

Image for post
Image for post
Photo by Clemens Van Lay on Unsplash


For years, I have fantasized about building a Forex trading robot that would slowly and consistently increase its account balance. However, I was never really sure where to start. What company to use? How do I access the APIs? Is it safe?

Recently, I blocked off some time to learn what would be needed to develop such a system and it culminated in a very simple to implement python script. In the remainder of this article, I will detail how it works.

Disclosure: This article is not investment, tax, or legal advice, nor is it a solicitation for investment. Furthermore, I am not a financial expert and offer this only as a way to share my experiences. …

Let’s face it, working at a startup is inherently different than working at a large company. However, what exactly is different and how can you work to increase the chances of your startup succeeding?

Image for post
Image for post
Photo by ThisisEngineering RAEng on Unsplash


We often hear the tales of the great entrepreneurs that with minimal resources managed to displace a behemoth incumbent with nothing but a clever idea. However, what is often unheard is the years of hard (and effective) work put in by the founding team to make their story a reality.

In the next section, we will go over key points that can often differentiate a great startup engineer. …

Quickly start sending Slack messages from your Ruby on Rails backend without the need for any third party libraries!

Image for post
Image for post
Photo by Scott Webb on Unsplash


Slack provides several ways to integrate with the platform. Among these integration options are the Slack Workflows. In this article, we will go over setting up one of these workflows and use it to provide a Ruby on Rails backend a way to post messages to Slack.


  1. From the Slack Desktop client click on your workspace name, select tools and then “Workflow Builder”.
  2. Click “Create” on the top right corner.
  3. Type a name for your workflow such as: “My First Workflow”. This name will appear as the title of messages created by the workflow. …

Quickly create serverless microservices using Lambdas

A scenic mountainside view
A scenic mountainside view
Photo by Philipp Lehmann on Unsplash

By using Amazon API Gateway, it’s possible to quickly create serverless microservices backed by Lambda. We’ll review one such deployment and use the AWS Serverless Application Model (SAM) to deploy it.


With ever-growing cloud systems, many companies have opted to move away from monoliths into a distributed architecture composed of microservices. AWS allows the development of such services without the need to manage the underlying server infrastructure.

We’ll go over an infrastructure-as-code (IaC) approach to deploying one such service using SAM. The deployment will assume that a virtual private cluster (VPC) is already in place and that only VMs on specific subnets within the cluster should be able to access the private service. …


Paulo Carvalho

A curious minded engineer.

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