Skip to content

Instantly share code, notes, and snippets.

View TheAngryByrd's full-sized avatar
🐦
😠 🐦

Jimmy Byrd TheAngryByrd

🐦
😠 🐦
View GitHub Profile
@TheAngryByrd
TheAngryByrd / ChildEvents.cs
Created September 18, 2015 21:18
ChildEvents
public class Passenger : ReactiveObject
{
public IObservable<bool> SelectedObs;
public Passenger()
{
SelectedObs = this.WhenAny(x => x.IsSelected, x => x.Value);
}
bool _isSelected;
public bool IsSelected
{
@TheAngryByrd
TheAngryByrd / IdentityResult.fs
Created October 1, 2015 19:58
IdentityResult.fs
type Rop<'TSuccess,'TError> =
| Pass of 'TSuccess
| Fail of 'TError list
type IdentityError = { Code : string; Message: string; }
type UserAuthErrors<'CustomError> =
| DefaultError of IdentityError
| ConcurrencyFailure of IdentityError
| PasswordMismatch of IdentityError
| InvalidToken of IdentityError
| LoginAlreadyAssociated of IdentityError
@TheAngryByrd
TheAngryByrd / build.fsx
Last active September 18, 2016 01:52
Visual Studio Code mono debugging launch.json
//http://www.navision-blog.de/blog/2015/12/21/adding-background-tasks-to-suave-io-websites/
let startApp path =
let info = ProcessStartInfo(FileName = path)
let proc = new System.Diagnostics.Process(StartInfo = info)
start proc
proc
@TheAngryByrd
TheAngryByrd / .gitlab-ci.yml
Last active April 8, 2016 13:03
gitlab ci yml platforms
Linux:
script:
- mono -V
- bash build.sh
tags:
- mono
Windows:
script:
- CALL build.cmd
tags:
@TheAngryByrd
TheAngryByrd / LogaryConsoleColors.fs
Last active June 15, 2016 02:43
Logary Console Colors
module Helpers =
let (|StartsWith|_|) s (v : string) =
if v.StartsWith s then Some ()
else None
open Helpers
type ConsoleColorWriter(consoleTextWriter : IO.TextWriter, colorMap) =
inherit IO.TextWriter()
override this.Encoding = System.Text.Encoding.Default
override this.WriteLine(value : string) =
@TheAngryByrd
TheAngryByrd / Eventstore.Hopac.fs
Created June 15, 2016 02:33
Eventstore Hopac
module EventstoreHopac
open Hopac
open System
open EventStore.ClientAPI
let rec private retryBase work (handleResult : Choice<_,_> -> Job<_>) = job {
let! result = work |> Job.catch
return! handleResult result
}
@TheAngryByrd
TheAngryByrd / gitlab-windows-ci-runner.json
Last active January 5, 2017 15:52
gitlab-windows-ci-runner
{
"homepage": "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner",
"license": "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/LICENSE",
"version": "1.4.1",
"architecture": {
"64bit": {
"url": "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v1.4.1/binaries/gitlab-ci-multi-runner-windows-amd64.exe",
"hash": "173c0e16144fa0ad07e8926074343c62438d74b9ea1135a1308ee24f6f154528",
"bin": [
"gitlab-ci-multi-runner-windows-amd64.exe",
@TheAngryByrd
TheAngryByrd / debian-jessie.md
Last active May 27, 2017 16:36
dotnet-web-benchmarks
Debian/jessie docker


 WebServer | WebFramework | Iteration | IsMono | TargetFramework | TotalRequests | Duration | RequestsPerSecond
 --------- | ------------ | ---------:| ------ | --------------- | -------------:| --------:| -----------------:
 Kestrel   | Plain        |        10 | False  | netcoreapp1.1   |       1294342 |       10 |            129434
 Kestrel   | Plain        |         6 | False  | netcoreapp1.1   |       1248139 |       10 |            124813
 Kestrel   | Plain        |         7 | False  | netcoreapp1.1   |       1221932 |       10 |            122193
 Kestrel   | Plain        |         1 | False  | netcoreapp1.1   |       1211157 |       10 |            121115

Kestrel | Plain | 2 | False | netcoreapp1.1 | 1167274 | 10 | 116727

We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 19 columns, instead of 13 in line 7.
WebServer,WebFramework,TargetFramework,IsMono,Route,Iteration,TotalRequests,Duration,RequestsPerSecond,Bytes,LatencyMax,LatencyMin,LatencyMean,LatencyStdDev,ErrorConnect,ErrorRead,ErrorStatus,ErrorTimeout,ErrorWrite
Kestrel,Giraffe,netcoreapp1.1,False,/,1,887373,10,88737,128669085,329531,110,7342.9801634115,19138.344069651,0,0,0,0,0
Kestrel,Giraffe,net462,True,/,1,153984,10,15398,22327680,294471,222,26264.452617098,21807.159263844,0,0,0,0,0
Kestrel,Giraffe,netcoreapp1.1,False,/test,1,874103,10,87410,121500317,283714,163,7189.4004897156,18176.153002238,0,0,0,0,0
Kestrel,Giraffe,net462,True,/test,1,172632,10,17263,23995848,276254,134,26526.639932259,26937.693047257,0,0,0,0,0
Kestrel,Giraffe,netcoreapp1.1,False,/about,1,917803,10,91780,126656814,278670,70,6498.1732761596,17336.042294214,0,0,0,0,0
Kestrel,Giraffe,net462,True,/about,1,173173,10,17317,23897874,218568,137,26413.802995485,26204.854981098,0,0,0,0,0
Kestrel,Giraffe,netcoreapp1.1,False,/wheretofindus,1,897850,10,89785,122107600,251761,91,6700.4892163818
@TheAngryByrd
TheAngryByrd / SemaphoreSlimDisposableLock.fs
Last active July 12, 2017 17:41
SemaphoreSlimDisposableLock.fs
open System
open System.Threading
type SemaphoreSlimDisposableLock ( s : SemaphoreSlim ) =
static member CreateAndWaitOne (s : SemaphoreSlim) = async {
do! s.WaitAsync() |> Async.AwaitTask
return new SemaphoreSlimDisposableLock(s)
}
interface IDisposable with
member x.Dispose() = s.Release() |> ignore