Some useful stuff.

  • Auto-Format Your Python Code in VSCode

    I always prefer to keep the code following the standards and style guides defined by the language or the community that has become popular. Doing so will improve readability, and consistency when coding collaboratively. Ultimately we can focus on actual code and not spend time and worry about styling. For Python, my favorite one is…

  • Download YouTube videos using yt-dlp

    Installation yt-dlp is a powerful command line tool, to install on Mac, run `brew install yt-dlp`. Install ffmpeg dependency using `brew install ffmpeg`, which is used for merging audio and video files. Usage Listing available formats Get available audio and video formats of a video. yt-dlp -F https://www.youtube.com/watch?v=xxxxxxxxxxx Download specific formats By default, yt-dlp downloads…

  • AWS EventBridge Rule for S3 Uploads

    Below EventBridge rule will be triggered based on the following conditions: You can test the invitation by setting a Lambda function as the target and printing the `event`.

  • Build AMD64 Docker Image in Mac Apple Silicon

    When you build: When you run:

  • Essential Configurations for Visual Studio Code (VSC)

    I find the below basic settings very useful and hope it will be useful for you too to keep your code nice and tidy. 1. Insert Final Newline It is recommended to add an empty line at the end of the file as some old tools might misbehave without it and also it helps clean…

  • GitHub Actions: Map Key/Values Based on Input

    Let’s say we have an input in our GitHub Actions workflow for the environment like the one below. Based on the environments we selected, we need to pass the below three key/values to a job, let’s call it the Deploy job. Three values are: GitHub Actions doesn’t have a native feature for value mapping, so…

  • Use nohoist for Yarn Workspace in Monorepo

    We have some mono repos containing a couple of Lambda NodeJS packages. As the repo is configured to use yarn workspace. When we run, yarn install by default node_modules are saved in the root directory of the repo. In our use case, we must save the node_modules in each package directory. For that, we can…

  • Customize GitHub Actions OIDC Claim for AWS IAM Authentication

    OIDC subject claim GitHub Actions OIDC token contains useful claims that you can check in Understanding the OIDC token. But AWS only supports what’s included in sub claim and cannot use any other claims in the token. Example subject claims such as branch, pull_request, and environment. The default subject claim is very limited and if…