Rewriting a Python script as a Bash one-liner

In this post, I will describe how I went about replacing a Python with a bash liner and how it decreased the runtime from 30 seconds to 1 second Background For this blog, I used to have a Python script which I would use to generate open graph images. These are images you sometimes see in apps when you share a link. For example: Essentially, what it would do is go through every post in my blog repository. ...

TIL: How to Use Default Values in docker-compose.yml

TIL: How to Use Default Values in docker-compose.yml Sometimes we want to use env variables in our docker-compose files like so: services: client: image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/nginx ports: - 8000:80 Here we are going to use the GitLab CI dependency proxy to pull our Nginx image, so we can speed up our pipelines but also avoid being rate limited by docker hub. However, when running this locally, we will need to make sure the CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX env variable is set. ...

TIL: How to Use Clipboard Data as File Input in Bash

TIL: How to Use Clipboard Data as File Input in Bash Recently, I wanted to run a bash script where it needed to receive a JSON file as input. However, the JSON I had was taken from somewhere on the internet. In this case, it was taking a JSON blob and converting it to a nix attribute set. However, I didn’t want to save the contents to a file beforehand. ...

 2023-11-01 129 words 1 min