Skip to content

Instantly share code, notes, and snippets.

@philiplaureano
philiplaureano / ReceiveActor.cs
Created July 1, 2017 11:09
A base class for Proto.Actor that makes it easier to migrate actors between Akka.NET and Proto.Actor
public abstract class ReceiveActor : IActor
{
private List<(Func<object, bool>, Action<object>)> _handlers = new List<(Func<object, bool>, Action<object>)>();
public async Task ReceiveAsync(IContext context)
{
if (context.Message is Restarting)
PreRestart(null, context.Message);
if (context.Message is Started)
PreStart();
open System
open System.Threading.Tasks
open Proto
open Proto.Mailbox
type Actor with
static member SpawnFromFunc handler =
Actor.FromFunc(fun c-> handler(c)) |> Actor.Spawn
[<EntryPoint>]
@philiplaureano
philiplaureano / IFetchInstance.cs
Created June 16, 2019 12:06
The most minimalistic actor system interface for fetching/creating actors
public interface IFetchInstance<TKey, TItem>
{
Option<TItem> Fetch(TKey key);
}
@philiplaureano
philiplaureano / putin_feb_2023_speech.md
Created February 21, 2023 22:12
A ChatGPT-generated summary of Putin's "State of the Nation" speech that was given on 21 Feb 2023

Summary of Vladimir Putin's 2022 State of the Nation Address

In his annual State of the Nation address, Russian President Vladimir Putin addressed a range of topics, including the country's response to the COVID-19 pandemic, economic recovery, social issues, foreign policy, and military power. The following is a breakdown of each topic and some sub-bullet points of his speech:

Foreign Policy

  • Putin discussed the need to protect Russia's sovereignty and security in the face of foreign aggression and pressure. He criticized Western nations for their attempts to weaken Russia through sanctions, propaganda, and military pressure.
  • Putin emphasized Russia's commitment to peaceful cooperation with other nations, including its efforts to combat terrorism, promote disarmament, and address climate change.
  • In regards to Ukraine, Putin accused Western nations of interfering in the country's internal affairs and supporting anti-Russian policies. He called for an end to the conflict in eastern Ukraine and critic
@philiplaureano
philiplaureano / llm-chat-demo.csx
Created August 17, 2024 05:02
A simple ChatGPT 4o-mini client, written with fsEnsemble in C# script. All you need to do is bring your own OpenAI key.
#r "nuget: OpenAI, 1.11.0"
#r "nuget: fsEnsemble, 0.1.5"
using System;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;
using OpenAI_API;
using OpenAI_API.Chat;
using OpenAI_API.Models;