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 "System" | |
#r "System.IO" | |
#r "mscorlib.dll" | |
open System.Linq | |
open System.Collections | |
open System.Text.RegularExpressions | |
System.IO.Directory.SetCurrentDirectory (__SOURCE_DIRECTORY__) | |
let data=System.IO.Directory.EnumerateFiles("Data","*.sql") | |
let file=System.IO.File.Open("""Commands.fs""",System.IO.FileMode.Create) | |
printfn "file created" |
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 RequestBuilder()= | |
member this.Combine (a,b) = a>>b | |
member this.Yield (())=fun r->r | |
member this.Yield (f)=f | |
member this.Delay(f)=f() | |
[<CustomOperation("method")>] | |
member this.Method(f:HttpRequestMessage->HttpRequestMessage,m:HttpMethod)= | |
f>>fun r-> | |
r.Method<-m |
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 getPrimes (str:string)= | |
let one=BigInteger.One | |
let two=new BigInteger(2) | |
let zero=BigInteger.Zero | |
let decomposePq(n: BigInteger): (BigInteger* BigInteger) = | |
let f(x: BigInteger, c: BigInteger):BigInteger = ((x * x) % n + c) % n | |
let rec rho(x: BigInteger, y: BigInteger, g: BigInteger, c: BigInteger): BigInteger = | |
if (g.Equals(one)) then | |
let xx = f(x, c) |
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
module MessageProcessing= | |
open System.IO | |
type private DataMsg= | |
|Raw of byte[] | |
let empty (msg:ArraySegment<byte>)= | |
let length=readInt msg.Offset msg.Array|>fst | |
let stream=new MemoryStream(length+4) | |
stream |
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 addPriceOverride (zodConfig: ZodConfigs) (toJson: IJsonSerializer): HttpHandler = .. | |
let updatePriceOverride (zodConfig: ZodConfigs) (toJson: IJsonSerializer): HttpHandler = .. | |
let cancelPriceOverride (zodConfig: ZodConfigs) (toJson: IJsonSerializer): HttpHandler = .. | |
let addDeal (zodConfig: ZodConfigs) (toJson: IJsonSerializer): HttpHandler = .. | |
let updateDeal (zodConfig: ZodConfigs) (toJson: IJsonSerializer): HttpHandler = .. | |
let cancelDeal (zodConfig: ZodConfigs) (toJson: IJsonSerializer): HttpHandler = .. | |
let zodWebApp (zodConfig: ZodConfigs) (toJson: IJsonSerializer): HttpHandler = | |
let addRoute path auth data= |
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 Msg= | |
|Add of List<int> | |
|Get of AsyncReplyChannel<int list> | |
let evt=new Event<string>() | |
let queueBox=MailboxProcessor.Start (fun inbox-> | |
let rec loop state= | |
async{ | |
let! msg=inbox.Receive() |
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
module Channel= | |
type Msg= | |
|Add of string | |
|AddSub of Event<string> | |
let messages=new List<string>() | |
let inbox=MailboxProcessor.Start (fun b-> | |
let rec loop state= | |
async{ | |
let! msg=b.Receive() | |
match msg with |
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 Card=Card of string | |
type Domain= | |
|Card | |
|Id | |
|UserAccount | |
type Action= | |
|Add of Card | |
|GetUserAccount of Card |
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 inline sendRequest< ^a,^b | |
when ^a:(static member encode: ^a -> seq<byte>) | |
and ^b:(static member decode: Seg -> ^b)> (request:^a) (filteredIds: int seq) (callbackFn:MessageData-> ^b) = | |
let rec send payload evt callback=async{ | |
Channel.sendEncrypted payload | |
let! res=evt | |
let! result=res |> Async.map callback | |
match result with |
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
namespace LiteDB.FSharp | |
open System.Reflection | |
open Newtonsoft.Json | |
open TypeShape.Core.Core | |
module Shaper= | |
open LiteDB | |
open System |
OlderNewer