Synchronising Clocks

Few days back, I encountered the following error on my website saral.club. botocore.exceptions.ClientError: An error occurred (SignatureDoesNotMatch) when calling the SendEmail operation: Signature not yet current: 20250505T152002Z is still later than 20250505T151830Z (20250505T151330Z + 5 min.) By the looks of it, the error message is descriptive enough to guide you that there is some kind of time mismatch in the signature. Before sending a request to aws, the botocore library signs the request using your access keys. The signature also includes a timestamp. And the error message is saying that the request I am sending is probably 5 minutes later (in future) then the current time (time on aws servers). Of course, the two clocks (one on my server and the other on aws’s server) cannot have the same exact time, so aws allows for some time skew (5 minutes). ...

May 6, 2025 · 3 min · 485 words · Mohit Sharma

Time Saving Yaml Tricks

DRY: Don’t Repeat Yourself If you have a section that’s being repeated multiple times, you can create an anchor and then reference it. You use &name to create an anchor, and then *name to reference it. One example of it is defining environment variables for different services in docker-compose.yaml. env_vars: &env ENVIRONMENT: production LOGLEVEL: info AWS_REGION_NAME: us-east-1 services: api: environment: *env ... ... backend: ... ... environment: *env Reading environment variables While yaml doesn’t read environment variables, but if you pair it with parser, you can read the environment variables. The syntax depends on the parser you are using. The most common places, where I have a need for reading environment variables (or context variables) in yaml file is, cicd pipeline namely github action or circleci and docker-compose. ...

February 12, 2025 · 2 min · 293 words · Mohit Sharma

How to parse json in terminal using jq

A practical tutorial on jq So here’s the problem statement: Find the repository on github in which you have made most number of commits? And you need to do this on terminal (no python) Ofcourse, one can use python to find the answer, and it might be probably easy for you, if you have been using python for last many years. But let’s see if I can do this in terminal with jq and while doing so, let’s learn about it. ...

April 1, 2024 · 4 min · 787 words · Mohit Sharma

How to `find` files in terminal?

Manager: Hey, I need your help, I have couple of images that are taking a lot of space on my PC, I want to delete them. How can I do that? Developer: Well that should be simple. Here, you go. This looks for all files with .png extension in the current directory and its subdirectories (using -R flag), then pipes those file names to rm command to delete them. ls -R | grep ".png$" | xargs rm Manager: Nice, but wait. This will delete all the png files in the current directory and its subdirectories. I only want to delete in specific directories. ...

February 21, 2024 · 2 min · 363 words · Mohit Sharma