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
| def identity(x): return x | |
| def side_effect(f): | |
| def _from(x): | |
| f(x) | |
| return x | |
| return _from | |
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 TravelMode = | |
| | Walk | |
| | Bus | |
| | MRT | |
| | BTS | |
| | Motorbike | |
| | Taxi | |
| [<Measure>] type baht | |
| [<Measure>] type minute |
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 Microsoft.FSharp.Quotations | |
| open Microsoft.FSharp.Quotations.Patterns | |
| open Microsoft.FSharp.Quotations.DerivedPatterns | |
| let rec testQuote (tab: int) (expr: Expr) = | |
| let p = printfn "%s%s" (String(' ',tab*2)) | |
| match expr with | |
| | Int32 i -> p <| sprintf "Int %d" i |
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
| declare module "data.task" { | |
| type Func<A,B> = (_:A) => B | |
| class Task<TFail,TOk> { | |
| constructor(f: (reject: Func<TFail,any>, resolve: Func<TOk,any>) => void) | |
| static of<TFail,TOk>(v: TOk): Task<TFail,TOk> | |
| static rejected<TFail,TOk>(v: TFail): Task<TFail,TOk> | |
| map<C>(f: Func<TOk,C>) :Task<TFail,C> |
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
| cd W3SVC1 | |
| $now = Get-Date | |
| $today = $now.Date | |
| $date_groups = Get-ChildItem *.log | where { $_.Length -gt 0 -and $_.LastWriteTime.Date -lt $today } | group { $_.LastWriteTime.Date } | |
| cd .. | |
| foreach($g in $date_groups){ | |
| $date = $g.Values[0] | |
| $name = "iis_logs-$($date.Year)$($date.Month.ToString("D2"))$($date.Day.ToString("D2"))" | |
| $files = $g.Group | |
| $cmd = "7z a -t7z -mx=9 -mmt=4 -sdel $($name) $($files)" |
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.Net | |
| open System.IO | |
| type LogLine = | |
| { Timestamp: DateTime | |
| Method: string | |
| Path: string | |
| Query: string | |
| HttpVersion: string |
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
| namespace Akka.FSharp.Extensions | |
| open Akka.Dispatch | |
| open System.Threading.Tasks | |
| // source: https://github.com/tjaskula/akka.net-fsharp.extensions/blob/master/src/Akka.FSharp.Extensions/FsApi.Extensions.fs | |
| module Actor = | |
| open Akka.Actor |
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 RZ.FSharp.Akka.Extension | |
| open System.Threading.Tasks | |
| open Akka.Actor | |
| open Akka.FSharp | |
| open System.Runtime.CompilerServices | |
| type ReceiveActorFs() = | |
| inherit ReceiveActor() |
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 |