Skip to content

Instantly share code, notes, and snippets.

View baralong's full-sized avatar

Doug Paice baralong

View GitHub Profile
@niik
niik / RetryWithBackOffStrategy.cs
Last active October 2, 2021 01:42
An Rx retry operator with a customizable back off strategy.
// Licensed under the MIT license with <3 by GitHub
/// <summary>
/// An exponential back off strategy which starts with 1 second and then 4, 9, 16...
/// </summary>
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Func<int, TimeSpan> ExponentialBackoff = n => TimeSpan.FromSeconds(Math.Pow(n, 2));
/// <summary>
/// Returns a cold observable which retries (re-subscribes to) the source observable on error up to the
@da9l
da9l / Install-Chocoaltey
Last active February 6, 2017 13:40
Install chocolatey behind proxy with system settings in Internet Explorer.
$wc=new-object net.webclient
$wp=[system.net.WebProxy]::GetDefaultProxy()
$wp.UseDefaultCredentials=$true
$wc.Proxy=$wp
iex ($wc.DownloadString('https://chocolatey.org/install.ps1'))