Category: tech

How to get a random number in bash

Use the $RANDOM. $RANDOM returns a number between 0 and 32767. To get a random number between 0 and 50 you can use $ echo $[RANDOM%50] $ # or $ echo $((RANDOM%50)) To get a random number between 1 and 50 you can use $ echo $[RANDOM%50+1] $ # or $ echo $((RANDOM%50+1)) Read more...

How to solve Outlook cannot parse the property 'TRIGGER'

This errors is due to what seems to be an incompatibility between Google calendar reminders and Outlook. I guess that Google uses some proprietary content in the iCal that Outlook does not manage. Result: I do not have reminders in Outlook :( but the otherwise the calendar works well. Read more...

How to implement the AWS recommended exponential backoff and jitter in JavaScript (and Observable)

Also known as Solving “ThrottlingException: Rate exceeded” in Javascript with Exponential backoff + Jitter The ThrottlingException: Rate exceeded error is a frustrating one, mainly because it has a series of bad habits: it happens mostly in production, randomly (or so it seems), and often in the middle of a critical loop in the code. The error is an AWS protection mechanism to avoid being flooded with requests from buggy code, like an infinite loop, yet the responsibility is left to us, developers in the coding trenches, to get around the error. Read more...

How to create a multi-line string in JavaScript (and Observable)

While this post is triggered by working with Observable the solution works for Javascript ES6+. I use Observable to connect to the AWS pricing data, stored on a PostgreSQL instance on AWS. So far so good, Observable allows for easy connection to databases. When trying to write the code to query the database from Javascript data = db.query("SELECT * FROM amazonec2 LIMIT 10 ") I would get the error message “Unterminated string constant”. Read more...