Skip to content

Instantly share code, notes, and snippets.

View bojanrajkovic's full-sized avatar

Bojan Rajkovic bojanrajkovic

View GitHub Profile
Some(TimeSpan.FromSeconds(1)).AndThen<double>(async ts => {
await Task.Delay(ts);
return ts.TotalDays;
})
Some(TimeSpan.FromSeconds(1)).AndThen<double>(async ts => {
await Task.Delay(ts);
return ts.TotalDays;
})
@bojanrajkovic
bojanrajkovic / option.cs
Last active March 14, 2024 20:13
Quick and dirty Rust-like Option<T> in C#. Basically untested, use at your own risk!
public static class Option
{
public static Option<T> None<T>() => new None<T>();
public static Option<T> Some<T>(T value) => new Some<T>(value);
}
public class Option<T> : IEquatable<Option<T>>
{
public static Option<T> None => new None<T>();
public bool IsNone => !hasValue;
```
pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools"
cmd /c "VsDevCmd.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
```
00007FFE12D7311D cmp r11d,r10d
00007FFE12D73120 jae 00007FFE12D731E1
00007FFE12D73126 vmovupd ymm0,ymmword ptr [r9+rcx+10h]
00007FFE12D7312D cmp edx,dword ptr [r8+8]
00007FFE12D73131 jae 00007FFE12D731E1
00007FFE12D73137 lea r9d,[rdx+1Fh]
00007FFE12D7313B cmp r9d,r10d
00007FFE12D7313E jae 00007FFE12D731E1
00007FFE12D73144 vmovupd ymm1,ymmword ptr [r8+rdx+10h]
00007FFE12D7314B vpsubb ymm0,ymm0,ymm1
using System;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Attributes.Jobs;
using BenchmarkDotNet.Mathematics;
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Running;

Keybase proof

I hereby claim:

  • I am bojanrajkovic on github.
  • I am brajkovic (https://keybase.io/brajkovic) on keybase.
  • I have a public key ASAiTiipnu9zWUK392Wi03MZtRlfXPQLZkJoD0mpLZ5I4Qo

To claim this, I am signing this object:

SELECT "g.Gif"."Id", "g.Gif"."AddedAt", "g.Gif"."FirstFrame", "g.Gif"."LastUsed", "g.Gif"."Url", "g.Gif"."UsedCount"
FROM "tags" AS "g"
INNER JOIN "gifs" AS "g.Gif" ON "g"."GifId" = "g.Gif"."Id"
WHERE lower("g"."Tag") = lower(@__tag_0)
import util from './utils.js';
console.log(util.doSomething({ bar: "baz" }));
  mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)	Unknown
 	mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout)	Unknown
 	mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.AspNet.Server.Kestrel.dll!Microsoft.AspNet.Server.Kestrel.Http.FrameResponseStream.Write(byte[] buffer, int offset, int count)	Unknown
 	Microsoft.AspNet.Mvc.Core.dll!Microsoft.AspNet.Mvc.HttpResponseStreamWriter.FlushInternal(bool flus