This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.{Actor, Props, ActorRef, ActorSystem} | |
import com.typesafe.config.ConfigFactory | |
import scala.concurrent.duration._ | |
object Program { | |
def main(args: Array[String]): Unit = { | |
val conf = ConfigFactory.load(ConfigFactory.parseString(""" | |
akka{ | |
stdout-loglevel = WARN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Runtime.Serialization; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using Akka.Actor; | |
using Akka.Util; | |
namespace SerializerPoC | |
{ | |
internal class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Akka.Util | |
{ | |
//This is a cache based on the ConcurrentQueue | |
//The idea is to remove stale entries after a certain amount of operations | |
//Once the operation limit is reached, start purging stale items in the background |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Akka.Actor; | |
using Akka.Dispatch.SysMsg; | |
namespace ConsoleApplication43 | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestStreamClient(t *testing.T) { | |
const address = "127.0.0.1:8090" | |
lis, err := net.Listen("tcp", address) | |
if err != nil { | |
log.Fatalf("failed to listen: %v", err) | |
} | |
defer lis.Close() | |
s := grpc.NewServer() | |
server := Server{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
var jobs = db.GetJobs(..); | |
var aggregator = sys.ActorOf(Props.Create(() => new AggregatorActor(jobs.Count)); | |
foreach(var job in jobs) | |
{ | |
workerRouter.Tell(new JobMessage(job.Data, aggregator); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(), do: eval('5 * 5 + 2-2 + 10 *20*0') |> IO.inspect | |
def eval(input), do: _tokenize(input, []) |> _eval1([]) |> _eval2() | |
defp _tokenize([32 | input], result), do: _tokenize input, result | |
defp _tokenize([char | input], [{:num, num} | result]) when char >= ?0 and char <= ?9, do: _tokenize input, [{:num, num * 10 + (char - ?0)} | result] | |
defp _tokenize([char | input], result) when char >= ?0 and char <= ?9, do: _tokenize input, [{:num, (char - ?0)} | result] | |
defp _tokenize([?* | input], result), do: _tokenize input, [:mul | result] | |
defp _tokenize([?/ | input], result), do: _tokenize input, [:div | result] | |
defp _tokenize([?+ | input], result), do: _tokenize input, [:add | result] | |
defp _tokenize([?- | input], result), d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-add-repository ppa:numix/ppa | |
sudo apt-get -qq update | |
sudo apt-get -qq install git | |
sudo apt-get -qq install golang | |
sudo apt-get -qq install zsh | |
sudo apt-get -qq install numix-icon-theme numix-icon-theme-circle | |
sudo apt-get -qq install autojump | |
cd ~ | |
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExDistUtils do | |
def start_distributed(appname) do | |
unless Node.alive?() do | |
local_node_name = generate_name(appname) | |
{:ok, _} = Node.start(local_node_name) | |
end | |
cookie = Application.get_env(appname, :cookie) | |
Node.set_cookie(cookie) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var expressions = new List<Expression>(); | |
var newExpression = Expression.New(defaultCtor); | |
var targetObject = Expression.Variable(typeof(object),"target"); | |
var assignTarget = Expression.Assign(targetObject, newExpression); | |
var streamParam = Expression.Parameter(typeof(Stream)); | |
var sessionParam = Expression.Parameter(typeof(DeserializerSession)); | |
expressions.Add(assignTarget); |