Skip to content

Instantly share code, notes, and snippets.

View rogeralsing's full-sized avatar
😈
Feeling Awesome

Roger Johansson rogeralsing

😈
Feeling Awesome
View GitHub Profile
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
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
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
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
{
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{}
...
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);
}
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
@rogeralsing
rogeralsing / install.sh
Last active May 29, 2016 18:48
install.sh
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 -)"
@rogeralsing
rogeralsing / elixir_distributed.ex
Created June 11, 2016 16:53 — forked from jisaacstone/elixir_distributed.ex
programmatic node startup in elixir
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
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);