Skip to content

Instantly share code, notes, and snippets.

View andreasmischke's full-sized avatar

Andreas Mischke andreasmischke

View GitHub Profile
@ca057
ca057 / retryAsync.js
Created February 8, 2018 15:02
Asynchronously retry a given task until it resolves or the maximum amount of retries is reached
/**
* Asynchronously retry a given task the given times, but as least as long as the task does not
* throw an error or returns the first time. The return value is a promise with the value
* of the rejected/resolved task.
*/
export const retryAsync = (times, task) => {
if (!task || typeof task !== 'function' || times < 0) {
throw new TypeError(
'No task passed or task is not of type function or times is a negative value.'
);
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 6, 2024 08:48
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub