Skip to content

Instantly share code, notes, and snippets.

@vasilkosturski
vasilkosturski / RDSRecoverability.yaml
Created September 17, 2023 06:34
Cloud Formation template for RDS Recoverability Demo
Description: RDS Recoverability Demo - Design for Availability, Resilience, and Reliability
Parameters:
VpcName:
Description: A name that is prefixed to resource names
Type: String
VpcCIDR:
Description: Please enter the IP range (CIDR notation) for this VPC
Type: String
{
"title": "Root Schema",
"type": "object",
"default": {},
"required": [
"checked",
"dimensions",
"id",
"name",
"price",
@vasilkosturski
vasilkosturski / KafkaClientWireshark.cs
Created November 7, 2022 06:22
Source code for the blog post "Kafka Networking via Wireshark"
using Confluent.Kafka;
using Confluent.Kafka.Admin;
namespace KafkaConnectivity;
public static class Program
{
private const int PartitionsCount = 2;
private const string TopicName = "my_topic";
private const string BootstrapServers = "localhost:9092,localhost:9093";
public struct AsyncTaskMethodBuilder
{
private IAsyncStateMachine _stateMachine;
private Action _moveNextRunner;
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : ICriticalNotifyCompletion
where TStateMachine : IAsyncStateMachine
{
if (_stateMachine == null)
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
public static class MyClass
{
[StructLayout(LayoutKind.Auto)]
[CompilerGenerated]
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace StateMachineConceptual
{
class Program
{
static async Task Main()
{
@vasilkosturski
vasilkosturski / DoubleDispatchMultimethods.cs
Created September 23, 2020 12:46
An example of Double Dispatch for the Multiple Dispatch (Multimethods) article.
using System;
namespace CSharpDoubleDispatch
{
class Program
{
static void Main(string[] args)
{
var op1 = new MyInt(5);
var op2 = new MyRational(2, 3);
@vasilkosturski
vasilkosturski / Visitor.cs
Last active August 9, 2020 07:32
clash-of-styles-the-visitor
using System;
namespace Visitor
{
class Program
{
public static void Main(string[] args)
{
var expression = new Addition(
new MyInt(1),
@vasilkosturski
vasilkosturski / OperationsMatrixViaOop.cs
Created July 7, 2020 12:27
clash-of-styles-operations-matrix-via-oop
using System;
namespace OOPvsFP
{
class Program
{
static void Main(string[] args)
{
var expression = new Addition(
new MyInt(3),
@vasilkosturski
vasilkosturski / DoubleDispatch.cs
Last active July 7, 2020 12:21
clash-of-styles-double-dispatch
using System;
namespace DoubleDispatch
{
class Program
{
static void Main(string[] args)
{
var expression = new Addition(
new MyInt(3),