Skip to content

Instantly share code, notes, and snippets.

View Havret's full-sized avatar
🎯
Focusing

Krzysztof Porebski Havret

🎯
Focusing
View GitHub Profile
services.AddTransient<ISomeService, SomeService>();
services.AddSingleton<BooksManagerActorProvider>(provider =>
{
var actorSystem = provider.GetService<ActorSystem>();
var someService = provider.GetService<ISomeService>();
var booksManagerActor = actorSystem.ActorOf(Props.Create(() => new BooksManagerActor(someService)));
return () => booksManagerActor;
});
@Havret
Havret / gist:5b46753ad1f26b4a3b6c5adee10b58b7
Created October 11, 2018 16:51
tiredofit/freepbx logs
λ docker-compose up
Starting freepbx-app ... done
Starting freepbx-db ... done
Starting freepbx-db-backup ... done
Attaching to freepbx-db, freepbx-db-backup, freepbx-app
freepbx-db | s6-supervise 03-cron: warning: unable to spawn ./run - waiting 10 seconds
freepbx-db | s6-supervise (child): fatal: unable to exec run: Permission denied
freepbx-db | s6-supervise (child): fatal: unable to exec run: Permission denied
freepbx-db | s6-supervise 10-mariadb: warning: unable to spawn ./run - waiting 10 seconds
freepbx-db | s6-supervise (child): fatal: unable to exec run: Permission denied
@Havret
Havret / RepeatedScheduleTest.cs
Created January 10, 2019 22:39
RepeatedScheduleTest
using Akka.Actor;
using Akka.TestKit;
using Akka.TestKit.NUnit;
using NUnit.Framework;
using System;
using System.Linq;
namespace akkaSchedulerTest.Test
{
public class RepeatedScheduleTest_Standard_Scheduler : TestKit
public class ArtemisBucketHelper
{
public int GetBucket(string groupId, int bucketCount)
{
var bytes = ToBytes(groupId);
var hashCode = ToHashCode(bytes);
return (hashCode & int.MaxValue) % bucketCount;
}
private byte[] ToBytes(string groupId)
@Havret
Havret / Arguments.cs
Created February 25, 2022 10:21
Arguments - class
var alice = new Person { Name = "Alice", Age = 17 };
Console.WriteLine($"Inside main => {alice.Name}'s age before function call: {alice.Age}");
IncrementAge(alice);
if (alice != null)
{
Console.WriteLine($"Inside main => {alice.Name}'s age after function call: {alice.Age}");
}
else
{
Console.WriteLine("Inside main => Object reference not set to an instance of an object");
@Havret
Havret / Arguments.cs
Last active October 14, 2022 09:35
Arguments - struct
var alice = new Person { Name = "Alice", Age = 17 };
Console.WriteLine($"Inside main => {alice.Name}'s age before function call: {alice.Age}");
IncrementAge(alice);
if (alice != null)
{
Console.WriteLine($"Inside main => {alice.Name}'s age after function call: {alice.Age}");
}
else
{
Console.WriteLine($"Inside main => Object reference not set to an instance of an object");