var today = DateTime.Now; // 2017-05-29
var birthday = new DateTime(1988, 2, 26);
var age = (int)(today - birthday / 10000); // 29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task WithRetry(Func<Task> action, int retryCount = 3) | |
{ | |
var retries = 0; | |
while(true) | |
{ | |
try | |
{ | |
await action().ConfigureAwait(false); | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Dalstroem | |
{ | |
public class Container | |
{ | |
private readonly ConcurrentDictionary<Type, ContainerEntry> _entries = new ConcurrentDictionary<Type, ContainerEntry>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
using System.Security.Cryptography; | |
using System.Text; | |
namespace Dalstroem | |
{ | |
public class Encrypter | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-Password ($Length=60) { | |
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
$random = 1..$Length | ForEach-Object { Get-Random -Maximum $characters.Length } | |
$characters[$random] -join '' | |
} |
I hereby claim:
- I am Dalstroem on github.
- I am dalstroem (https://keybase.io/dalstroem) on keybase.
- I have a public key whose fingerprint is DA04 A0B0 2F23 3FDC E5BF 1B05 5A49 1D19 E681 12D4
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir -p ~/.config/xmobar && cd ~/.config/xmobar | |
git clone https://github.com/jaor/xmobar | |
cd xmobar | |
------------------------------------------------------------- | |
$ sudo apt install libghc-aeson-dev libghc-async-dev libghc-extensible-exceptions-dev libghc-parsec-numbers-dev libghc-regex-compat-dev |