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.Collections | |
open System | |
open System.Text | |
open System.Diagnostics | |
module Trits = | |
type Trit = Bit of bool | Split | |
let isNullable (x:Type) = x.IsGenericType && x.GetGenericTypeDefinition() = typedefof<Nullable<_>> |
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 | |
// Learn more about F# at http://fsharp.org | |
// See the 'F# Tutorial' project for more help. | |
module Consoler = | |
open System.Reflection | |
open NReadability | |
open ReadSharp |
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
//based on https://github.com/LindaLawton/Google-Dotnet-Samples/tree/master/Google-Analytics | |
using System; | |
using System.Threading.Tasks; | |
using System.Security.Cryptography.X509Certificates; | |
using Google.Apis.Analytics.v3; | |
using Google.Apis.Analytics.v3.Data; | |
using Google.Apis.Auth.OAuth2; | |
using Google.Apis.Util; |
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
// Step 0. Boilerplate to get the paket.exe tool | |
open System | |
open System.IO | |
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ | |
if (File.Exists "paket.exe") then | |
File.Delete "paket.exe" | |
let url = "https://github.com/fsprojects/Paket/releases/download/3.18.2/paket.exe" |
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 | |
[<AutoOpen>] | |
module Common = | |
open System.Collections.Generic | |
type Result<'TSuccess,'TFailure> = | |
| Success of 'TSuccess | |
| Failure of 'TFailure | |
let isInvalidString min max str = |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Numerics; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Ack | |
{ |
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
type RequestUser = | |
| Authenticated of id : int | |
| Anonymouse | |
type UserEntity = { | |
name : string | |
isAdmin : bool | |
} | |
open System.Collections.Generic | |
type Db = Dictionary<int,UserEntity> |
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
import json | |
import datetime | |
import pytz | |
from random import randint | |
import logging | |
import time | |
import redis | |
main_prefix = "bqueues:" |
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
[<AutoOpen>] | |
module Helpers = | |
let time name f a = | |
let stopWatch = System.Diagnostics.Stopwatch.StartNew() | |
let r = f a | |
stopWatch.Stop() | |
printfn "%s %f" name stopWatch.Elapsed.TotalMilliseconds | |
r | |
let arraySize arr = Array2D.length1 arr, Array2D.length2 arr | |
let safeGet i' j' (arr:_[,]) = try arr.[i',j'] with | ex -> Unchecked.defaultof<'a> |
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
type ExpAlg<'a> = | |
abstract member lit: int -> 'a | |
abstract member Add: 'a -> 'a -> 'a | |
type Algebra<'alg,'a> = 'alg -> 'a | |
let lit i (alg:ExpAlg<'a>) = alg.lit i | |
let add a b (alg:ExpAlg<'a>) = alg.Add a b | |
type AlgebraBuilder() = |