Skip to content

Instantly share code, notes, and snippets.

Charith Ellawala charithe

Block or report user

Report or block charithe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mapbench.go
package mapbench
import (
"sync"
log "github.com/sirupsen/logrus"
)
type MapBench struct {
objects sync.Map
@charithe
charithe / grpc_test.go
Created Oct 27, 2018
Using Toxiproxy for resilliency tests
View grpc_test.go
import (
"net"
"strconv"
"testing"
"time"
"github.com/Shopify/toxiproxy"
toxiclient "github.com/Shopify/toxiproxy/client"
)
@charithe
charithe / redis_test.go
Created Oct 27, 2018
Using Dockertest to launch Redis
View redis_test.go
import (
"net"
"testing"
"github.com/go-redis/redis"
"github.com/ory/dockertest"
)
func TestRedisStore(t *testing.T) {
addr, destroyFunc := startRedis(t)
View keybase.md

Keybase proof

I hereby claim:

  • I am charithe on github.
  • I am charithe (https://keybase.io/charithe) on keybase.
  • I have a public key ASCum6rRJhYWxdWnYYXRfmrfD6a7-q3wBP80FSKiO5NaPgo

To claim this, I am signing this object:

@charithe
charithe / BuildEnvPlugin.scala
Created Aug 13, 2017
SBT Build Environment Dependent Docker Image
View BuildEnvPlugin.scala
import BuildEnvPlugin.autoImport.BuildEnv
import com.sun.xml.internal.ws.api.config.management.policy.ManagementAssertion.Setting
import sbt.PluginTrigger.AllRequirements
import sbt.{AutoPlugin, Def, PluginTrigger, Plugins}
import sbtdocker.DockerPlugin
import sbt._
import sbt.Keys._
object BuildEnvPlugin extends AutoPlugin {
override def trigger: PluginTrigger = AllRequirements
@charithe
charithe / frequency.erl
Created Apr 14, 2017
Concurrent Programming in Erlang: Week 2
View frequency.erl
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(frequency).
-export([start/0,allocate/0,deallocate/1,stop/0,spawn_client/1]).
@charithe
charithe / frequency.erl
Created Apr 8, 2017
Concurrent Programming in Erlang: Week1
View frequency.erl
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(frequency).
-export([start/0,allocate/0,deallocate/1,stop/0]).
@charithe
charithe / client.go
Created Mar 26, 2017
GRPC Opentracing Interceptors
View client.go
package otgrpc
import (
context "golang.org/x/net/context"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/opentracing/opentracing-go/log"
"google.golang.org/grpc"
)
@charithe
charithe / index.erl
Created Mar 5, 2017
FutureLearn Erlang MOOC Week 2: Indexing a file
View index.erl
-module(index).
-export([do_index/1, show_file_contents/1]).
%% Main entrypoint
%% In the Erlang shell, execute: rp(index:do_index("path_to_file")).
%% Reads the contents of the file using the provided functions, builds up a map
%% of words to their locations, compresses the locations to ranges and returns a
%% list sorted in alphabetical order
do_index(Name) ->
Lines = get_file_contents(Name),
@charithe
charithe / assignment.erl
Created Feb 25, 2017
FutureLearn Erlang MOOC: Assignment 1
View assignment.erl
-module(assignment).
-export([perimeter/1, area/1, enclose/1, bits/1]).
perimeter({circle, {_X, _Y}, R}) -> 2 * math:pi() * R;
perimeter({rectangle, {_X, _Y}, H, W}) -> 2 * (H + W);
%% A triangle is defined by its' three coordinates.
perimeter({triangle, {X1, Y1}, {X2, Y2}, {X3, Y3}}) ->
A = distance({X1, Y1}, {X2, Y2}),
You can’t perform that action at this time.