Skip to content

Instantly share code, notes, and snippets.

View Aaronontheweb's full-sized avatar
🚀
Shipping!

Aaron Stannard Aaronontheweb

🚀
Shipping!
View GitHub Profile
@Aaronontheweb
Aaronontheweb / grafana-loadbalancer.yaml
Last active June 13, 2024 14:02
MicroK8s observability load balancers
apiVersion: v1
kind: Service
metadata:
name: grafana-loadbalancer
namespace: observability
spec:
type: LoadBalancer
selector:
app.kubernetes.io/name: grafana
ports:
@Aaronontheweb
Aaronontheweb / configure-docker-drives.sh
Last active June 12, 2024 16:23
Raspberry PI External SSD Scripts
#!/bin/bash
# create the docker data drive
mkdir /mnt/docker-base
# allow the root service account, which docker runs as, to own this directory and have write permissions
chown -R root:root /mnt/docker-base
chmod 701 /mnt/docker-base
# create a `daemon.json` file for the docker runtime
@Aaronontheweb
Aaronontheweb / HOWTO.md
Last active June 6, 2024 19:23 — forked from ramonsmits/HOWTO.md
Install .NET 8 on Raspberry pi
@Aaronontheweb
Aaronontheweb / Program.cs
Created April 12, 2024 13:23
Akka.NET - Deleting Older Snapshots in Akka.Persistence actors that ONLY use the SnapshotStore
async Task Main()
{
var actorSystem = ActorSystem.Create("Sys");
var persistentActor = actorSystem.ActorOf<ExamplePersistentActor>("exampleActor");
var watch = persistentActor.WatchAsync();
// Sending multiple "save" commands to create snapshots
persistentActor.Tell("save-1");
await Task.Delay(TimeSpan.FromSeconds(1)); // spacing out snapshots, time-wise
@Aaronontheweb
Aaronontheweb / docker-compose.yml
Created March 8, 2024 19:21
Jaeger docker compose
version: '3.7'
services:
jaeger:
image: jaegertracing/all-in-one:1.55
hostname: jaeger
restart: always
ports:
- '16686:16686'
- '5775:5775/udp'
@Aaronontheweb
Aaronontheweb / projections.cs
Last active March 5, 2024 16:08
Read Journal Provider
Command<ProjectionStarting>(_ =>
{
// TODO: seeing multiple of these being logged, which makes me think there's a problem with our Akka.Streams graph
_log.Info("Projection for Tag [{0}] is starting from Offset [{1}] - instance [{2}] rand [{3}]", NuGetPersistenceTags.NuGetProductTag,
CurrentState.LastOffset.AsLong(), Self.Path.Uid, Random.Shared.Next());
Sender.Tell(ProjectionAck.Instance);
});
Command<ProjectionCompleted>(_ =>
{
@Aaronontheweb
Aaronontheweb / genericparent.cs
Last active March 4, 2024 16:52
GenericChildPerEntityParent Actor
// -----------------------------------------------------------------------
// <copyright file="GenericChildPerEntityParent.cs" company="Akka.NET Project">
// Copyright (C) 2015-2023 .NET Petabridge, LLC
// </copyright>
// -----------------------------------------------------------------------
using Akka.Actor;
using Akka.Cluster.Sharding;
namespace Sdkbin.NuGet.Actors.Utility;
@Aaronontheweb
Aaronontheweb / delivery.linq
Last active February 15, 2024 18:05
Akka.Delivery stream
async Task Main()
{
var actorSystem = ActorSystem.Create("Sys");
var producerSettings = ProducerController.Settings.Create(actorSystem);
using var cts = new CancellationTokenSource();
var (queue, producerController) = StreamConstruction.CreateProducerStream<IMessageProtocol>(actorSystem, producerSettings, "myproducer", cts.Token);
var myConsumer = actorSystem.ActorOf(Props.Create(() => new ConsumerActor(producerController)), "consumer");
@Aaronontheweb
Aaronontheweb / killFunc.ps1
Created February 1, 2024 15:28
Cleanup Script for Azure Functions Local Debugging
$processNameContains = "func"
try {
# Get all processes where the name contains 'func'
$processesToKill = Get-Process | Where-Object { $_.ProcessName -like "*$processNameContains*" }
# Check if there are any processes to kill
if ($processesToKill) {
# Kill each process
foreach ($process in $processesToKill) {
@Aaronontheweb
Aaronontheweb / badpipeto.cs
Created January 10, 2024 17:26
Akka.Analyzer demos
using Akka.Actor;
using System.Threading.Tasks;
public sealed class MyActor : ReceiveActor{
public MyActor(){
Receive<string>(str => {
async Task<int> LocalFunction(){
await Task.Delay(10);
return str.Length;