Skip to content

Instantly share code, notes, and snippets.

View ahjohannessen's full-sized avatar

Alex Henning Johannessen ahjohannessen

View GitHub Profile
#!/bin/bash
set -e
JAVA_HOME=${1-text}
[ $# -eq 0 ] && { echo "Usage: sudo $0 \$(/usr/libexec/java_home -v '1.8*')" ; exit 1; }
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
wget https://letsencrypt.org/certs/letsencryptauthorityx1.der
wget https://letsencrypt.org/certs/letsencryptauthorityx2.der
@ahjohannessen
ahjohannessen / install.sh
Created February 5, 2016 19:37
Installation of eventstore-ha
ES_USERNAME=YourUsername
ES_PASSWORD=YourPassword
curl https://apt-oss.geteventstore.com/eventstore.key | sudo apt-key add -
echo "deb [arch=amd64] https://$ES_USERNAME:$ES_PASSWORD@apt-commercial.geteventstore.com/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/eventstore.list
sudo apt-get update
sudo apt-get install eventstore-ha
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using EventStore.ClientAPI;
using EventStore.ClientAPI.Embedded;
@ahjohannessen
ahjohannessen / Flowz.scala
Last active August 29, 2015 14:27 — forked from DomBlack/Flowz.scala
Generic Akka stream operations for carrying extra information around operations
import akka.stream.scaladsl.Flow
import scala.concurrent.{ ExecutionContext, Future }
import scalaz._
import scalaz.std.scalaFuture.futureInstance // IntelliJ lies
/**
* Flowz provides Akka Stream Flow like methods for monadic types.
*
* You can define the `M` type and the input type, and let the compiler infer the output
@ahjohannessen
ahjohannessen / macros.scala
Last active August 29, 2015 14:26
Accessibility error in macro
/////////////////// GenClient.scala ///////////////////
package remotely
import scala.language.experimental.macros
import scala.annotation.StaticAnnotation
/**
* Macro annotation that generates a client. Usage:
* `@GenClient(remotely.Protocol.empty) object MyClient`
@ahjohannessen
ahjohannessen / ScalaPBSerializer.scala
Last active October 10, 2015 06:53
Reflection based serializer for ScalaPB generated case classes.
import java.lang.reflect.Method
import java.util.concurrent.atomic.AtomicReference
import akka.actor.ExtendedActorSystem
import akka.serialization.Serializer
import com.trueaccord.scalapb.GeneratedMessage
import scala.annotation.tailrec
/**
* This Serializer serializes `com.trueaccord.scalapb.GeneratedMessage`s
*/
#!/usr/bin/env bash
projections=(
"by_category"
"by_event_type"
"stream_by_category"
"streams"
"users"
)
import scala.language.implicitConversions
import scalaz.\/
trait WrappedValue[T] extends Any {
private def clazz = this.getClass
def value: T
override def toString =
// This should work with Scala 2.10.4 & scalaz 7.1, core, effect and concurrent packages
import scalaz.{ concurrent, Free, Functor, Monad, syntax }
import concurrent.Task
import Free.{freeMonad => _, _}
import syntax.monad._
// Describe the set of actions - which are functors
sealed trait RedisF[+A] {
def map[B](fn: A => B): RedisF[B]
#cloud-config
coreos:
update:
reboot-strategy: off
units:
-
name: custom-reboot.service
runtime: true
content: |