Skip to content

Instantly share code, notes, and snippets.

View object's full-sized avatar

Vagif Abilov object

View GitHub Profile
@object
object / Program.fs
Created July 20, 2017 06:26
Code demonstrating TypeLoadException when using FSharp Result with Visual Studio 2015
open System
[<EntryPoint>]
let main argv =
let result = Result.Ok "Hello"
printfn "%A" result
0
// Instructions:
// Create an F# project, add latest FSharp.Core package using NuGet or Paket.
@object
object / TypedActorAndBoxing.fs
Created July 21, 2017 18:29
Script showing that typed actors in F# are unable to receive system messages
#r "../src/Akkling/bin/Debug/Akka.dll"
#r "../src/Akkling/bin/Debug/Akkling.dll"
open System
open Akkling
open Akka.Actor
let system = System.create "basic-sys" <| Configuration.defaultConfig()
let untypedActor (m:Actor<_>) =
@object
object / AkklingPersistence.txt
Created May 20, 2018 07:29
Akkling persistence example
1. Yaml configuration section
<?xml version="1.0" encoding="utf-8"?>
<akka.persistence>
<hocon>
<![CDATA[
akka {
persistence{
query.journal.sql {
max-buffer-size = 10000
@object
object / GuaranteedDeliveryActor.fs
Created September 9, 2020 15:16
Guaranteed delivery actor in Akka.NET/F#
module GuaranteedDelivery =
open Akka.Actor
open Akka.Persistence
open Akkling
open Akkling.Persistence
type Payload = string
type DeliveryEnvelope = { Payload: Payload; DeliveryId: int64 }
@object
object / SockerServer.fs
Last active October 15, 2024 18:45
Fable workshop - NRK - Stage 9
module SocketServer
open System
open System.IO
open Microsoft.AspNetCore.Http
open Giraffe
open Elmish
open Elmish.Bridge
open Thoth.Json.Net
@object
object / AdventOfCode2020.12.01.fsx
Last active December 1, 2020 15:23
AdventOfCode 2020, December 1
let expenses = [
1768
1847
1905
1713
1826
1846
1824
1976
1687
@object
object / AdventOfCode2020.12.02.fsx
Created December 2, 2020 07:48
AdventOfCode 2020, December 2
open System
let text = """
15-16 l: klfbblslvjclmlnqklvg
6-13 h: pghjchdxhnjhjd
4-13 n: nnznntzznqnzbtzj
10-16 r: nrrrrkrjtxwrrrwx
1-6 t: rttftttttttttmdttttt
4-12 l: zhllfxlmvqtnhx
6-8 d: wxpwgdbjtffddkb
@object
object / AdventOfCode2020.12.03.fsx
Created December 3, 2020 11:12
AdventOfCode 2020, December 3
open System
open System.IO
let area =
File.ReadAllLines("input03.txt")
|> Array.filter (not << String.IsNullOrEmpty)
|> Array.map Seq.toArray
|> Array.map (fun line -> line |> Array.map (fun x -> if x = '#' then 1 else 0))
let rec go steps (area : (int array) array) current_pos count =
@object
object / AdventOfCode2020.12.04.fsx
Created December 4, 2020 06:23
AdventOfCode 2020, December 4
open System
open System.IO
let input =
File.ReadAllLines("input04.txt")
|> Seq.toList
let expected_fields_without_country = ["byr"; "iyr"; "eyr"; "hgt"; "hcl"; "ecl"; "pid"] |> Set.ofList
let expected_fields = expected_fields_without_country |> Set.add "cid"
@object
object / AdventOfCode2020.12.05.fsx
Created December 5, 2020 06:13
AdventOfCode 2020, December 5
open System
open System.IO
let input =
File.ReadAllLines("input05.txt")
|> Seq.toList
|> Seq.filter (not << String.IsNullOrEmpty)
let getPosition nums = nums |> List.fold (fun (acc, n) x -> acc + x * n, n * 2) (0, 1) |> fst