Skip to content

Instantly share code, notes, and snippets.

View blemale's full-sized avatar

Bastien LEMALE blemale

View GitHub Profile
import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations._
import org.openjdk.jmh.infra.Blackhole
import scala.util.Random
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.MICROSECONDS)
package net.courtanet.fm.core.editor;
import static org.fest.assertions.Assertions.assertThat;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.junit.Before;
@blemale
blemale / dhis.service
Created July 31, 2014 15:13
Handling /var/run with systemd
[Service]
Type=forking
PrivateTmp=yes
User=nobody
Group=nobody
# Run ExecStartPre with root-permissions
PermissionsStartOnly=true
ExecStartPre=-/usr/bin/mkdir /var/run/dhis
ExecStartPre=/usr/bin/chown -R nobody:nobody /var/run/dhis/
# Run ExecStart with User=nobody / Group=nobody
@blemale
blemale / TypeSafeBuilder.scala
Created July 28, 2014 18:23
Type-safe builder with path
object TypeSafeBuilder {
case class Foo(n: Option[String], a: Option[String], aa: Option[String], b: Option[String], bb: Option[String])
sealed trait Path
sealed trait NoPath extends Path
sealed trait APath extends Path
sealed trait BPath extends Path
class FooBuilder[P <: Path](val n: Option[String], val a: Option[String], val aa: Option[String], val b: Option[String], val bb: Option[String]){