Blog

2024-04-12

Browser Hub

Open sourcing a small utility that made my life easier.

2024-04-12

Evolution of Programming Resources

As a teenager, I stumbled upon my passion for computers when my family got our first PC. Without internet access, I had to rely on books to feed my curiosity, but finding resources in Farsi was a challenge.

2023-07-23

Make FastAPI CPU-bound Endpoints 2X Faster

FastAPI is built on top of Starlette, which is an ASGI framework. That makes it ideal for building async web services in Python.

Async code can be more efficient only when it comes to IO operations like reading from a database – that's like 99% of web use cases. But you might be surprised to know that even for non-IO operations, async functions will perform better in FastAPI.

2023-07-17

What's a Fractional Head of Engineering

In the fast-paced world of startups and business initiatives, finding the right technical expertise and leadership can be a daunting task. Whether you're starting from scratch with an MVP, scaling a successful product, or embarking on a new venture within an established company, the need for experienced engineering talent is crucial. However, the traditional routes of hiring full-time employees or relying solely on freelancers may not be enough. That's where a Fractional Head of Engineering steps in, offering a unique blend of expertise, strategic guidance, and flexible commitment.

2020-10-18

Using Docker Volumes for Development, The Right Way

Running Docker containers in production normally doesn't need mounting local files or dirs. But when using Docker for development, it makes sense to mount the source code to avoid re-building the Docker image on every change. That looks straight forward except for some cases.

Some files or directories are generated by package managers or compilers during the compile time. They should be generated as part of the Docker image build and should stay untouched during runtime. On the other hand, mounting other files that need to be changed constantly during development is necessary.

This post uses an example app to experience different ways of using Docker volumes and learn about their pros and cons.

2020-08-23

List Trello Cards After a Specific One

List the cards contents after a given card content inside the browser. Useful to generate a quick report from your Trello board.

2020-08-09

Quick Guide for Migrating a DigitalOcean Droplet to AWS EC2

I needed to move a DigitalOcean Droplet to AWS which was running a Docker application using Docker Compose and had its SSL configured using Let's Encrypt. I couldn't find an easy way to convert the DigitalOcean disk snapshots to AWS EBS ones, otherwise, the whole disk could be cloned in AWS with much less effort since Linux configuration is all about the filesystem. I ended up installing needed packages on the target machine and move the configurations. Since I tested everything and it was successful I figured it might be useful to put all the commands and steps in the same place as a quick step-by-step guide. Also, the exact same steps apply to any other cloud as well as the other way around, from AWS to DigitalOcean.

2020-07-01

Rails Mailer Smoke Test

Use this code snippet when you need to see the generated HTML by active mailer in the browser.

2020-06-20

List AWS Users Without MFA

To list users who haven't enabled MFA on their AWS accounts:

2020-06-10

Covert Single Quoted YAML to Double Quoted

You can use these regular expressions and replacement expressions inside your favorite editor when you need to unify your YAML file to use double quote for all strings.

For example converting:

key1: value 1
key2: 'value 2'
key3: 'value "3"'

To:

key1: "value 1"
key2: "value 2"
key3: "value \"3\""
2020-05-02

Tips on Dealing with Distractions for Software Engineers

Focusing on the same task for a long time has always been a big challenge for me. Based on my online research I've convinced that I might suffer from ADD, though I find many in the software industry who look like suffering from ADD, OCD, or both.

Whether we suffer from ADD or developed a similar behavior as a symptom of our lifestyle, we can build new habits that not only keep us calm and relaxed but also improve our productivity and quality of work that leads to creating better software and ultimately a better world!

In this post, I'm going to share my experience, methods, and habits that helped keep myself calm, focused, and available, especially at my job as a software engineer particularly, in this pandemic situation where we work remotely.

2019-04-07

How I learned about event-driven design in the late 90's

The event-driven design has already been around for a while. Like many other trendy patterns, it's far older than what we think. Before the web era, it was quite normal to design stand-alone desktop applications using this design. But it is even older than that. It has already been used massively since the mainframe era (and probably even before).

This is the story of how I learned about event-driven design without even knowing what it's called in the late 90s when I was just getting started to learn how computers work.

2018-12-15

Kubernetes translated to AWS

I use analogy whenever I need to explain something in the clearest and fastest possible way. Gaining knowledge in an abstract manner is hard and costly. Using existing knowledge as a foundation speeds up the learning process and prevents misunderstandings. When a C# developer, for instance, asks me what's flatMap in Scala, I'll ask if they know what's SelectMany? If they do, explaining how flatMap works on non-list types would be far faster and easier.

Now let's do this with Kubernetes and AWS. Let's see what are the Kubernetes components closest equivalents in AWS.

The point is that an analogy doesn't provide a deep understanding of a new concept, but it provides the foundation to speed up the learning process. So don't expect a conclusive 1:1 mapping from Kubernetes elements to AWS.

2018-11-13

Chromium to Firefox Experience (Setup Multiple Profiles)

A while ago, I decided to give Firefox a try. Here I'm going to share why and how it happened. Also I'll share how I configured my work and personal browser profiles on my Gnome desktop.

Screenshot of Firefox profile launchers

2018-01-29

Don’t listen to them, learn Cats this way

OK, you came to the conclusion that type-safety is good. It helps you get things done in a safer manner, at least for whatever you’re working on at the moment. So you started using types more than before to describe what a piece of code does without the need to run. In another word, to bring forward unwanted errors.

2017-11-01

Learning about the way we learn

Sometimes, we need to invoke our own brain to describe some facts about itself but in a more pleasant way to help ourselves move on. It’s not a bad thing at all, but I prefer to know the scientific facts, no matter what’s the cost.

2017-05-17

How to apply settings to multiple projects using SBT triggered plugins

SBT is the main build tool for Scala projects. It's simply one of the most powerful build tools available. You're not limited to a single method for doing a specific job and there is no predefined and restricted rules. You can automate things as much as you want. And the good news is that SBT tries to run the tasks in parallel as much as possible.

2017-01-27

Comparing Scala Editors

Choosing the best editor/IDE for your favorite programming language is not as easy as it seems to be. Obviously, that's not the case if you work with the main-stream technologies or if you don't consider yourself a geek programmer!

Right now, Scala is my favorite language and fortunately, contrary to what most developers think, there are a good number of available choices as editor/IDE. This post is about my experiences of using these tools.

2016-10-20

Back to Ubuntu from Arch

Several month ago, I left Ubuntu for Arch. This post is about my experiences and the reasons that led me to move back to Ubuntu.

Update 2017-01-21: As the VirtualBox bug, which made me go back to Ubuntu, is resolved, I couldn't resist going back to Arch. This time I tried i3 instead of a full fledged DE and I'm very happy so far.

2016-03-11

Type Injection in Scala

I'm not sure if it's a good name but as we inject types into our classes, type injection seems a good name. I used this technic in my latest project to build a database-agnostic data-access layer on top of Slick 3.

2016-02-26

Running SBT on a Linux encrypted home

If you use Linux and encrypt your home folder, you may get the following error when compiling a SBT project:

[error] File name too long
[error] one error found
[error] (compile:compile) Compilation failed
2015-12-07

The hacker scripts in Scala

You may have read or heard about that amazing true story about a hacker scripts which inspired hackers who enjoy living inside the terminal!

2015-11-29

How to run 32-bit Andorid SDK on 64-bit Arch Linux

Andorid SDK is a 32-bit application and needs some extra works to run on a 64-bit Arch Linux.

2015-10-11

Non-verbose SEO friendly internationalization for Play framework

Default internationalization support in Play works with cookies which is not SEO-friendly. It would be very nice if it was possible to use route parameters instead of cookies but as Play routes are (nicely, truly and correctly) type-safe, this will come at some cost; verbosity. Albeit it's not true for smart people who code in Scala :D

2015-09-03

Akka: Integration Tests for Single Node Cluster Sharding

Multi-JVM tests are the default way of testing an Akka cluster sharding application. But sometimes you just need the sharding functionality where multi-JVM tests are just overkill. I didn't find any sample or guide describing the best practices for this situation.

2015-08-27

How I Deploy My Play! Apps

I don't use services like Heroku as deployment infrastructure. They are amazing but I have my reasons.

2015-08-19

Installing RVM on Ubuntu Desktop

RVM installation is clearly described at rvm.io, but I've always had problem loading the Ruby after installing RVM.

2015-08-17

Why Functional Programming?

There are plenty of reasons why functional programming are becoming mainstream, but I came across the one I think is the most visible.