Skip to content

Instantly share code, notes, and snippets.

@limansky
limansky / Test.scala
Created March 11, 2021 08:59
Akka issue demo
import akka.actor.ActorSystem
import akka.stream.scaladsl.{ Flow, Framing, Source, Tcp }
import akka.util.ByteString
import scala.concurrent.{ ExecutionContext, Future }
object Test {
def logic(s: String)(implicit ec: ExecutionContext): Future[String] = {
Future {
sealed trait Expression {
type Out
}
object Expression {
type Aux[T] = Expression { type Out = T}
}
case class Const[T](t: T) extends Expression {
override type Out = T
@limansky
limansky / build.sbt
Created June 11, 2019 18:02
sbt cross build issue demo
lazy val root = project.in(file("."))
.aggregate(core, moduleA, moduleB)
.settings(
crossScalaVersions := Nil
)
lazy val core = project.in(file("core"))
.settings(
crossScalaVersions := Seq("2.11.12", "2.12.8")
)
@limansky
limansky / tinymount-0.2.8-r1.ebuild
Created September 2, 2018 18:03
Tinymount Qt5 ebuild
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PLOCALES="ru uk"
inherit qmake-utils l10n
if [[ ${PV} == *9999 ]]; then
EGIT_REPO_URI=("https://github.com/limansky/${PN}.git")
inherit git-r3
@limansky
limansky / MapReader.scala
Last active June 25, 2017 09:39
Read Map[String, String] to case class
package me.limansky
import cats.Monoid
import shapeless.labelled.{FieldType, field}
import shapeless.{::, HList, HNil, LabelledGeneric, Lazy, Witness}
trait MapReader[T] {
def read(m: Map[String, String]): T
}
@limansky
limansky / Linear.scala
Created January 12, 2017 09:23
Linear type class
package me.limansky
import shapeless.ops.hlist.Prepend
import shapeless.{::, <:!<, Generic, HList, HNil, LabelledGeneric, Lazy}
trait Linear[L] {
type Repr <: HList
def linear(t: L): Repr
}
@limansky
limansky / conf.d
Created September 12, 2013 18:30
Initscript for headless virtualbox
# Virtual machine name
VMNAME="guest"
# User, owing virtual machine
VMUSER="vboxuser"
# Stop mode. One off acpipowerbutton | savestate
VMSTOP="savestate"
@limansky
limansky / gitlab
Last active December 21, 2015 15:58
GitLab initscript for 6-0
#!/sbin/runscript
# GitLab 5.2 and 5.3 init script for Gentoo Linux
# see https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md
GITLAB_BASE=/mnt/data/gitlab/gitlab
GITLAB_USER=gitlab
depend() {
need net redis
}
name := "Testmail"
version := "0.0.1"
scalaVersion := "2.9.1"
// you can also add multiple repositories at the same time
resolvers ++= Seq(
"Scala Tools Releases" at "https://oss.sonatype.org/content/groups/scala-tools/"
)
@limansky
limansky / gist:4262706
Created December 11, 2012 22:04
using bind1st
#include <vector>
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
bool gt(int a, int b)
{
return a < b;