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
#I "../hopac/Libs/Hopac/bin/Release/net7.0/" | |
#r "Hopac.Core" | |
#r "Hopac.Platform" | |
#r "Hopac" | |
#load "./Bench.fs" | |
open System | |
open System.Threading | |
open Hopac.Extensions | |
open Hopac.Infixes |
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
type Meta = interface end | |
type U<'ty>() = | |
class | |
interface Meta | |
end | |
type K<'ty, 'x>(elem: 'x) = | |
interface Meta | |
member x.Elem = elem |
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
open System.Net | |
open System.Diagnostics | |
let netsh arguments = | |
ProcessStartInfo("netsh", arguments, WindowStyle = ProcessWindowStyle.Hidden) | |
|> Process.Start | |
let rec loop source dest = | |
async { | |
use _ = netsh "interface portproxy reset" |
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
let await (timeout: int) task = | |
async { | |
let evt = Event<_>() | |
let! _ = | |
async { | |
do! Async.Sleep timeout | |
evt.Trigger None | |
} |> Async.StartChild | |
let! _ = |
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
#I @"C:\Projects\Lib" | |
#r "Hopac.dll" | |
#r "Hopac.Core.dll" | |
open System | |
open Hopac | |
open Hopac.Job.Infixes | |
open Hopac.Alt.Infixes | |
open Hopac.Extensions |
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
var objUserInfo = new ActiveXObject("WScript.network"); | |
if (objUserInfo.UserName == "dgrenier") | |
debugger; |
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
#r @"C:\Projects\Streams\src\Streams.Core\bin\Release\Streams.Core.dll" | |
open Nessos.Streams.Core | |
let data = | |
[| | |
let rnd = System.Random().NextDouble >> (*) 1e3 | |
for x in -10.0 .. 10.0 do | |
yield System.DateTime.Now.AddDays (rnd()) | |
|] |
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
type T = T with | |
static member (<@>) (x, y: int) = x * y | |
static member (<@>) (x, y: float) = x * int y | |
let inline helper (_: ^o) (left: ^t) (right: ^u) = ((^o or ^t): (static member (<@>): ^t * ^u -> int) (left, right)) | |
let inline (<@>) left right = helper T left right | |
1 <@> 2 | |
1 <@> 2.3 |
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
[<Inline "$v.toString(16)">] | |
let toHex (v: int) = X<_> | |
let guid() = | |
let rx = EcmaScript.RegExp("[xy]", "g") | |
EcmaScript.String("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx").Replace(rx, As (fun c -> | |
let r = EcmaScript.Math.Random() * 16.0 |> int | |
let v = |
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
#if INTERACTIVE | |
let (++) a b = System.IO.Path.Combine(a, b) | |
let source = __SOURCE_DIRECTORY__ ++ __SOURCE_FILE__ | |
let args = sprintf "--platform:x86 %s -o:%s" source <| source.Replace("fs", "exe") | |
System.Diagnostics.Process.Start(System.AppDomain.CurrentDomain.BaseDirectory ++ "fsc", args) | |
#endif | |
let time f x = | |
let ts = System.Diagnostics.Stopwatch.StartNew() | |
let result = f x |
NewerOlder