Skip to content

Instantly share code, notes, and snippets.

View yoeluk's full-sized avatar

Yoel Garcia Diaz yoeluk

  • Toronto
View GitHub Profile
@yoeluk
yoeluk / GNU-Make.md
Created November 28, 2020 16:38 — forked from rueycheng/GNU-Make.md
GNU Make cheatsheet

Keybase proof

I hereby claim:

  • I am yoeluk on github.
  • I am yoeluk (https://keybase.io/yoeluk) on keybase.
  • I have a public key ASBoiUiScWL-j_naJTu4XVwAuyUDKjF9okPNOckwDWMKcQo

To claim this, I am signing this object:

# PLEASE DON'T RUN THIS AS SCRIPT AS SOME STEPS NEED MANUAL INTERVENTION
# start minishift with a reasonable resources for your system but large enough
# the lower values that I test it were --cpus 4 --memory 18GB
minishift start --cpus 6 --memory 20GB --disk-size 80GB --openshift-version v3.11.0 --profile sample
# login as the system's admin and create a user
oc login -u system:admin -n default
object Model {
sealed trait CartCommand
final case class GetCart(replyTo: ActorRef[State]) extends CartCommand
}
package com.ereactive.examples.akka.alarm
import akka.actor.typed.{ActorRef, Behavior}
import akka.actor.typed.scaladsl.Behaviors
import com.ereactive.examples.akka.alarm.Alarm._
class Alarm {
def anAlarm[S <: AlarmState](pinCode: Int, state: S = InactiveAlarm)
: Behavior[AlarmCommand] =
Behaviors.receiveMessage {
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Tagless
(
tf1,
tfm1,
viewTf1,
tf1_tree,
tf1'',
@yoeluk
yoeluk / BTree.scala
Created December 25, 2017 05:25 — forked from fomkin/BTree.scala
Simple immutable B-tree with Scala
case class BTree[K, V](root: BTree.Node[K, V], order: Int)(implicit keyOrdering: Ordering[K]) {
import keyOrdering.mkOrderingOps
private type N = BTree.Node[K, V]
private type E = BTree.Entry[K, V]
def get(key: K): Option[V] = {
def aux(node: N): Option[V] = {
val mayBeEntry = node.entries.find(_.key == key)
@yoeluk
yoeluk / build_multi.md
Last active March 21, 2024 14:41
build multi stages docker images

Build And Deploy Docker Containers

Linux Alpine docker image is based on super tiny Linux kernel BusyBox and features and package manager, apk, making easy to install build dependencies. This is particularly important for static compile languages like haskell and go as example but also for java and scala.

Scala is also a statically compiled language for the jvm and although we think of it as requiring just the jdk the typical way to build a scala application is with sbt which requires the jvm but the build also downloads a considerable number of sbt core dependencies. Hence, the safe and reliable way for reproducing build a project anywhere is to start from equal sbt installation. The best way to ensure that is to start from a pre-loaded sbt docker image.

Ideally we shouldn't deploy the build system but just the artifact in a reliable and reproducible way. Here, I'll describe two ways to do just that.

Sbt Base Image

@yoeluk
yoeluk / TimerGraphStage.scala
Created October 25, 2017 14:49
polling graph stage for akka stream
package akka.stream.alpakka
import akka.NotUsed
import akka.stream.{Attributes, Outlet, SourceShape}
import akka.stream.scaladsl.Source
import akka.stream.stage.{GraphStage, OutHandler, TimerGraphStageLogic}
import scala.concurrent.duration.FiniteDuration
import scala.util.Try
// Generated by <a href="http://scalaxb.org/">scalaxb</a>.
package generated
case class SKUList(SKU: Seq[generated.SKU] = Nil)
case class SKU(basic_data: generated.Basic_data,
product: generated.ProductType,