This file contains hidden or 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 "nuget: Akka.FSharp" | |
| open System | |
| open Akka.FSharp | |
| let system = Configuration.defaultConfig() |> System.create "test" | |
| type Messages = | |
| | Print of string | |
| | Crash |
This file contains hidden or 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
| using MongoDB.Bson; // MongoDB.Bson, MongoDB.Driver | |
| using MongoDB.Bson.IO; | |
| using MongoDB.Bson.Serialization; | |
| using MongoDB.Bson.Serialization.Serializers; | |
| using RZ.Foundation.Extensions; // RZ.Foundation | |
| using static LanguageExt.Prelude; // LanguageExt | |
| namespace YourNameSpace | |
| { | |
| public class MongoOptionSerializer<T> : SerializerBase<Option<T>> |
This file contains hidden or 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
| // reference MongoDB.Driver 2.11.0 | |
| using MongoDB.Bson.Serialization.Attributes; | |
| using MongoDB.Bson.Serialization.Conventions; | |
| using MongoDB.Driver; | |
| void Main() | |
| { | |
| var client = new MongoClient("mongodb://connection"); | |
| var collection = client.GetDatabase("test").GetCollection<Test>("test"); | |
This file contains hidden or 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
| void Main() | |
| { | |
| var itor = InfiniteOne(); | |
| var iter = itor.GetEnumerator(); | |
| iter.MoveNext(); | |
| Console.WriteLine("Value is {0}", iter.Current); | |
| iter.Dispose(); | |
| } | |
| static IEnumerable<int> InfiniteOne(){ |
This file contains hidden or 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 TiraxTech.Http | |
| open System | |
| open System.Threading.Tasks | |
| open System.Net | |
| open System.Net.Http | |
| open System.Net.Http.Json | |
| open System.Text.Json | |
| open System.IO | |
| open System.Net.Http.Headers |
This file contains hidden or 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 Microsoft.Win32 | |
| module Keyboard = | |
| let ThaiKeyboard = ["0000041e"] | |
| let USKeyboard = ["00000409"] | |
| let UKKeyboards = ["00000809"; "d0010409" ] | |
| let OurDesiredKeyboards = [ThaiKeyboard; USKeyboard] |> List.collect id | |
| let WellknownKeyboards = [ThaiKeyboard; USKeyboard; UKKeyboards] |> List.collect id | |
| let isUK v = UKKeyboards |> List.contains v |
This file contains hidden or 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
| using System.Net; | |
| using Microsoft.AspNetCore.Mvc; | |
| namespace SimpleSlidingWindow.Controllers; | |
| [ApiController] | |
| [Route("[controller]")] | |
| public class LimitController : ControllerBase | |
| { | |
This file contains hidden or 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 rec TiraxTech.Foundation | |
| open System | |
| open System.Collections.Generic | |
| open System.Threading.Tasks | |
| open IdentityServer4.Models | |
| open TiraxTech.Foundation | |
| module AsyncEnumerator = | |
| let Empty<'T>() = { new IAsyncEnumerator<'T> with |
This file contains hidden or 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 | |
| open System.Text.RegularExpressions | |
| let private encodingMatch (m: Match) = | |
| match m.Value[0] with | |
| | '+' -> "-" | |
| | '/' -> "_" | |
| | _ -> m.Value | |
| let private decodingMatch (m: Match) = |
This file contains hidden or 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 psi = new ProcessStartInfo | |
| { | |
| FileName = "mongo", | |
| Arguments = $"{tlsSupport} --quiet --eval \"{query}\"", | |
| CreateNoWindow = true, | |
| RedirectStandardOutput = true | |
| }; | |
| var procQuery = new Process | |
| { |