Skip to content

Instantly share code, notes, and snippets.

View milanaleksic's full-sized avatar

Milan Aleksić milanaleksic

View GitHub Profile
@skeeto
skeeto / README.md
Last active December 20, 2021 14:00
AI driving simulation
#!/usr/bin/perl
use warnings;
use strict;
my $bin=$ARGV[0];
my @line = split /\s+/, `nm $bin |grep runtime.buildVersion`;
my $addr = hex($line[0]);
my $end = $addr + 16;
package org.iainhull.akka
import scala.concurrent.duration._
import akka.actor._
import akka.event.Logging
import akka.pattern.ask
import akka.util.Timeout
import akka.persistence.{PersistentView, AtLeastOnceDelivery, PersistentActor}
@jboner
jboner / PersistedGameOfPingPong.scala
Last active March 27, 2019 16:43
A game of ping pong using two Akka Actors, persisted using Event Sourcing through Akka Persistence
package demo
import akka.actor.{Props, ActorSystem}
import akka.persistence.PersistentActor
object PingPong extends App {
case object Ball // The Command
case object BallReceived // The Domain Event, represents a Fact, something that have already happened
class Ping extends PersistentActor {
@jboner
jboner / akka-cluster-implementation-notes.md
Last active March 4, 2023 22:30
Akka Cluster Implementation Notes

Akka Cluster Implementation Notes

Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.

Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.

Akka Gossip

Gossip state

This is the Gossip state representation:

@milanaleksic
milanaleksic / books.md
Last active March 21, 2024 17:42
Locus All Century Best SF/Fantasy Books (based on http://www.locusmag.com/2012/AllCenturyPollsResults.html)

20th Century SF Novel

Rank Author : Title (Year)

  • Herbert, Frank : Dune (1965)
  • Card, Orson Scott : Ender's Game (1985)
  • Asimov, Isaac : The Foundation Trilogy (1953)
  • Simmons, Dan : Hyperion (1989)
  • Le Guin, Ursula K. : The Left Hand of Darkness (1969)
  • Adams, Douglas : The Hitchhiker's Guide to the Galaxy (1979)
  • Orwell, George : Nineteen Eighty-Four (1949)
  • Gibson, William : Neuromancer (1984)
@helena
helena / ProvisioningActor.scala
Last active December 21, 2015 04:39
Rough, initial cut of a trait to mixin when an Actor requires initalization, where the initialization is long and arduous (for example, data initialization related). This strategy allows the implementing actor to delegate the work to another Actor, on a separate, dedicated Dispatcher, and not block any other related Actors in load-time.
import scala.collection.immutable
import scala.collection.immutable.Queue
import akka.actor._
/**
* Rough, initial cut of a trait to mixin when an Actor requires
* initalization, where the initialization is long and arduous (for
* example, data initialization related). This strategy allows the
* implementing actor to delegate the work to another Actor, on a
* separate, dedicated Dispatcher, and not block any other related
@aolshevskiy
aolshevskiy / build.gradle
Created January 21, 2012 15:35
Hello World Netty Http Server
apply plugin: "java"
apply plugin: "eclipse"
repositories {
mavenCentral()
}
dependencies {
compile (
"org.jboss.netty:netty:latest.integration",
@jbrisbin
jbrisbin / NioScalabilityTest.java
Created January 3, 2012 22:14
Pure Java NIO scalability test
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.StandardSocketOptions;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;