Skip to content

Instantly share code, notes, and snippets.

#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"
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
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)
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
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=
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()
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
type Card=Card of string
type Domain=
|Card
|Id
|UserAccount
type Action=
|Add of Card
|GetUserAccount of Card
}
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
namespace LiteDB.FSharp
open System.Reflection
open Newtonsoft.Json
open TypeShape.Core.Core
module Shaper=
open LiteDB
open System