Skip to content

Instantly share code, notes, and snippets.

View fabiob's full-sized avatar

Fábio D. Batista fabiob

View GitHub Profile
@wingrime
wingrime / backoff.cs
Created May 27, 2019 08:59
C# exponential backoff
public static class Retry
{
public static async Task<T> DoAsync<T>(Func<Task<T>> action,
Func<T, bool> validateResult = null,
int maxRetries = 10, int maxDelayMilliseconds = 2000, int delayMilliseconds = 200)
{
var backoff = new ExponentialBackoff(delayMilliseconds, maxDelayMilliseconds);
var exceptions = new List<Exception>();
@kern
kern / save-sqs-queue.py
Created February 22, 2016 20:59
Saves all messages from an AWS SQS queue into a folder
import argparse
import boto.sqs
import json
import os
parser = argparse.ArgumentParser(description='Saves all messages from an AWS SQS queue into a folder.')
parser.add_argument(
'-q', '--queue', dest='queue', type=str, required=True,
help='The name of the AWS SQS queue to save.')