Skip to content

Instantly share code, notes, and snippets.

@vigoo
vigoo / build.zig
Created May 9, 2024 15:54
WASM Component using Zig
const std = @import("std");
const Builder = std.build.Builder;
const CrossTarget = std.zig.CrossTarget;
pub fn build(b: *Builder) !void {
const bindgen = b.addSystemCommand(&.{ "wit-bindgen", "c", "--autodrop-borrows", "yes", "./wit", "--out-dir", "src/bindings" });
const optimize = b.standardOptimizeOption(.{
.preferred_optimize_mode = .ReleaseSmall,
});
@vigoo
vigoo / workflow.json
Created May 21, 2023 20:02
zio-flow serialization example
{
"Fold": {
"value": {
"Input": {}
},
"successCase": {
"input": {
"identifier": "244cdfef-1c83-4ea1-99ce-f683138ef78f"
},
"result": {
@vigoo
vigoo / model.scala
Created November 12, 2020 09:28
zio-aws-sqs generated source
package io.github.vigoo.zioaws.sqs
import scala.jdk.CollectionConverters._
import java.time.Instant
import zio.{ Chunk, ZIO }
import software.amazon.awssdk.core.SdkBytes
package object model {
object primitives {
type Binary = Chunk[Byte]
type BoxedInteger = Int
type MessageAttributeName = String
@vigoo
vigoo / prox_3_14.scala
Created November 22, 2019 17:19
prox 3/14
def run(args: List[String]): ZIO[Environment, Nothing, Int]
@vigoo
vigoo / prox_3_13.scala
Created November 22, 2019 17:19
prox 3/13
import zio.interop.catz._
Blocker[RIO[Console, ?]].use { blocker =>
for {
// ...
_ <- console.putStrLn("Starting external process...")
_ <- (Process[Task]("echo", List("Hello world!")) > tempFile.toPath).start(blocker)
// ...
} yield ()
}
@vigoo
vigoo / prox_3_12.scala
Created November 22, 2019 17:18
prox 3/12
def >[F[_], To, NewOut, NewOutResult, Result <: ProcessNode[_, _, _, Redirected, _]]
(to: To)
(implicit
contextOf: ContextOf.Aux[PN, F],
target: CanBeProcessOutputTarget.Aux[F, To, NewOut, NewOutResult],
redirectOutput: RedirectOutput.Aux[F, PN, To, NewOut, NewOutResult, Result]): Result = {
redirectOutput(processNode, to)
}
@vigoo
vigoo / prox_3_11.scala
Created November 22, 2019 17:17
prox 3/11
trait ContextOf[PN] {
type Context[_]
}
object ContextOf {
type Aux[PN, F[_]] = ContextOf[PN] {
type Context[_] = F[_]
}
def apply[PN <: ProcessNode[_, _, _, _, _], F[_]](implicit contextOf: ContextOf.Aux[PN, F]): Aux[PN, F] = contextOf
@vigoo
vigoo / prox_3_10.txt
Created November 22, 2019 17:16
prox 3/10
[error] prox/src/test/scala/io/github/vigoo/prox/ProcessSpecs.scala:95:63: diverging implicit expansion for type cats.effect.Concurrent[F]
[error] starting with method catsIorTConcurrent in object Concurrent
[error] running <- (Process[IO]("echo", List("Hello world!")) > tempFile.toPath).start(blocker)
@vigoo
vigoo / prox_3_9.scala
Created November 22, 2019 17:16
prox 3/9
running <- (Process[IO]("echo", List("Hello world!")) > tempFile.toPath).start(blocker)
@vigoo
vigoo / prox_3_8.scala
Created November 22, 2019 17:15
prox 3/8
implicit class ProcessNodeOutputRedirect[PN <: ProcessNode[_, _, _, NotRedirected, _]](processNode: PN) {
def >[F[_], To, NewOut, NewOutResult, Result <: ProcessNode[_, _, _, Redirected, _]]
(to: To)
(implicit
target: CanBeProcessOutputTarget.Aux[F, To, NewOut, NewOutResult],
redirectOutput: RedirectOutput.Aux[F, PN, To, NewOut, NewOutResult, Result]): Result = {
redirectOutput(processNode, to)
}
}