This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.data.StateT | |
import cats.effect.{ IO, Resource } | |
import cats.syntax.traverse._ | |
import cats.instances.list._ | |
import Resources.StateInfo | |
final case class Resources[A](resources: List[Resource[IO, A]]) { | |
def executeAll: Resource[IO, List[A]] = | |
resources.sequence[Resource[IO, *], A] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.data.StateT | |
import cats.effect.{ IO, Resource } | |
import cats.syntax.traverse._ | |
import cats.instances.list._ | |
import Resources.StateInfo | |
/** | |
* Resources is a light weight stuff on top of `cats.Resource` | |
* to guarantee strong semantics of acquisitions and release for a collection of resources, | |
* while allowing you to maintain some state. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ val path = java.nio.file.FileSystems.getDefault().getPath("/Users/afsalthaj/telstra/cij-orchestration/target/cij-orchestration-1.0.0-GA.jar") | |
path: java.nio.file.Path = /Users/afsalthaj/telstra/cij-orchestration/target/cij-orchestration-1.0.0-GA.jar | |
@ val x = ammonite.ops.Path(path) | |
x: os.Path = root/'Users/'afsalthaj/'telstra/"cij-orchestration"/'target/"cij-orchestration-1.0.0-GA.jar" | |
@ interp.load.cp(x) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} }: | |
with import (builtins.fetchTarball { | |
# Descriptive name to make the store path easier to identify | |
name = "nixos-unstable-2019-10-04"; | |
# Commit hash for nixos-unstable as of Mon Sep 2 01:17:20 2019 -0400 | |
url = https://github.com/nixos/nixpkgs/archive/85b7d89892a4ea088d541a694addb2e363758e44.tar.gz; | |
# Hash obtained using `nix-prefetch-url --unpack <url>` | |
sha256 = "0wxv4jvv9gri8kjzijrxdd1ijprwbsgsnzmjk2n4yxi0j41jk2f6"; | |
}) {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Usage: | |
{{{ | |
val expr = CronExpr.mk("15 9 * * *") | |
expr flatMap (_.durationToNextExecution(ZonedDateTime.now())) | |
expr flatMap (_.durationFromPreviousExecution(ZonedDateTime.now()) | |
expr flatMap (_.nextExecutionTimeFrom(ZonedDateTime.now()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Equal[-A] extends EqualLaws[A] { | |
def equal(a: A, b: A): Boolean | |
} | |
object Equal { | |
implicit val equalInt: Equal[Int] = new Equal[Int] { | |
def equal(a: Int, b: Int) = a == b | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bloop server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- build.sbt | |
- src/main/scala | |
- project/build.properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
import logging | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
class ZeroClustersAvailable(Exception): pass | |
class MoreThanOneClusterAvailable(Exception): pass | |
def lambda_handler(event, context): | |
client = boto3.client('emr') | |
logger.info("Trying to list the clusters that are in either waiting or running state") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
import logging | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
class ZeroClustersAvailable(Exception): pass | |
class MoreThanOneClusterAvailable(Exception): pass | |
def lambda_handler(event, context): | |
client = boto3.client('emr') | |
logger.info("Trying to list the clusters that are in either waiting or running state") |