Skip to content

Instantly share code, notes, and snippets.

// wrapper function over TestKit.ActorOfAsTestActorRef
let spawnAsTestRef (tck:Tck) (props: Props<'T>) : IActorRef<'T> =
typed (tck.ActorOfAsTestActorRef<FunActor<'T>>(props.ToProps(), tck.TestActor) :> IActorRef)
[<Fact>]
let ``Parent should create child`` () = testDefault <| fun tck ->
// child actor definition
let child (ctx: Actor<_>) msg = ctx.Sender() <! "hello" |> ignored
// parent actor defintion
let rec parent (ctx: Actor<_>) =
@ingted
ingted / gist:c20752361ede0967d8d4e2739cf4cf94
Created September 17, 2020 15:59 — forked from rstackhouse/gist:1162357
Configure NLog Programmatically
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NLog.Common;
using NLog.Targets;
using NLog.Config;
namespace ConsoleApplication1
@ingted
ingted / AkklingPersistence.txt
Created September 2, 2020 06:20 — forked from object/AkklingPersistence.txt
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
import pytds
import pandas as pd
import credentials as cred
conn = pytds.connect(dsn=cred.newserver, database=cred.newdb, user=cred.user, password=cred.passwd)
pid = '716cfb8f'
begin = '2020-04-15'
@ingted
ingted / async.py
Created August 14, 2020 01:51 — forked from konpatp/async.py
Python turn sync functions to async (and async to sync)
import functools
def force_async(fn):
'''
turns a sync function to async function using threads
'''
from concurrent.futures import ThreadPoolExecutor
import asyncio
pool = ThreadPoolExecutor()
@ingted
ingted / gist:06a79ff4f579d95ceaf1a28501aa1dca
Last active June 14, 2020 03:54
Akka.net C# example to F#
#if INTERACTIVE
#r "nuget: Akka.Cluster"
#r "nuget: Akka.Cluster.Sharding"
#r "nuget: Akka.FSharp"
#r "nuget: Hyperion"
#r "nuget: Akka.Serialization.Hyperion"
#else
module akkaTest
#endif
@ingted
ingted / main.fs
Created April 4, 2020 09:31 — forked from granicz/main.fs
Running WebSharper on Suave
module SelfHostedServer =
open global.Owin
open System.Net
open Suave
open Suave.Types
open Suave.Http.Successful
open Suave.Web
open Suave.Owin
open WebSharper.Owin
@ingted
ingted / WebSocketServer.cs
Created April 3, 2020 16:12 — forked from wildbook/WebSocketServer.cs
Very simple websocket server in C#
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Threading;
public class WebSocketServer
{
public readonly List<WebSocketSession> Clients = new List<WebSocketSession>();
@ingted
ingted / app.fs
Created April 3, 2020 11:46 — forked from bradphelan/app.fs
problem with websharper suave integration
namespace bookman
open WebSharper
open WebSharper.Sitelets
open WebSharper.UI.Next
open WebSharper.UI.Next.Server
type EndPoint =
| [<EndPoint "/">] Home
| [<EndPoint "/about">] About
@ingted
ingted / app.fs
Created April 3, 2020 11:46 — forked from bradphelan/app.fs
problem with websharper suave integration
namespace bookman
open WebSharper
open WebSharper.Sitelets
open WebSharper.UI.Next
open WebSharper.UI.Next.Server
type EndPoint =
| [<EndPoint "/">] Home
| [<EndPoint "/about">] About