Skip to content

Instantly share code, notes, and snippets.

View mvillafuertem's full-sized avatar


View GitHub Profile
mvillafuertem / README
Created November 3, 2023 17:08 — forked from jmatsushita/README
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
View TestDispatcher.scala
import cats.effect.std.{Dispatcher, Queue}
import cats.effect.{IO, IOApp}
import com.typesafe.scalalogging.Logger
import fs2.{Pipe, Stream}
import java.util.concurrent.atomic.AtomicInteger
import scala.collection.mutable
import scala.concurrent.duration.DurationInt
object Subscriptions {
View zio-cats-tagless-final.scala
// scalaVersion := "3.2.0"
// libraryDependencies ++= Seq(
// libraryDependencies ++= Seq(
// "org.typelevel" %% "cats-core" % "2.8.0",
// "dev.zio" %% "zio" % "2.0.0",
// "org.typelevel" %% "cats-effect" % "3.3.14",
// "org.typelevel" %% "kittens" % "3.0.0",
// "dev.zio" %% "zio-json" % "0.3.0-RC10",
// "io.d11" %% "zhttp" % "2.0.0-RC10"
// )
mvillafuertem /
Created February 17, 2023 19:08 — forked from sdkks/
How to SSH to Kubernetes Pod with SSH ProxyCommand using socat


  1. socat
  2. kubectl with proper ~/.kube/config that can connect to your cluster
  3. Working knowledge of kubectl client
  4. OpenSSH client

How does it work?

  1. kubectl does port forwarding to sshd port of your pod. I'm using pm2 process managed to keep my services alive in my workstation container. If you have only sshd, easiest to use is dropbear
  2. ProxyCommand of OpenSSH client uses socat to redirect two way fd - to forwarded port of kubectl
  3. Voila! You are in
mvillafuertem / pod.yaml
Created February 16, 2023 18:32 — forked from matthewpalmer/pod.yaml
Example Kubernetes pod for the multi-container sidecar design pattern
View pod.yaml
# Example YAML configuration for the sidecar pattern.
# It defines a main application container which writes
# the current date to a log file every five seconds.
# The sidecar container is nginx serving that log file.
# (In practice, your sidecar is likely to be a log collection
# container that uploads to external storage.)
# To run:
mvillafuertem /
Created October 5, 2022 08:59 — forked from IgorBerman/
akka streams in java with kill switch, shutdown hook and error handling
package com.example;
import java.util.concurrent.CompletionStage;
import scala.concurrent.Await;
import scala.concurrent.duration.Duration;
import akka.Done;
import akka.NotUsed;
import akka.japi.Pair;
mvillafuertem /
Created September 28, 2022 14:16 — forked from lobster1234/
Working with localstack on command line

Starting localstack

C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
View print system and environment properties in sbt console
sbt> eval new scala.sys.SystemProperties().foreach(x => println(x))
sbt> eval scala.sys.env.foreach(x => println(x))
mvillafuertem /
Created March 16, 2022 13:08 — forked from rdump/
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews


The instructions below apply to older versions of Homebrew which still provide switch capability.

For current Homebrew, you'll likely need to keep Versions around, and build locally. Here's my versions repository

MacPorts is now keeping versioned installations available as well, by default.

mvillafuertem / Workshop.scala
Created October 17, 2021 18:20 — forked from calvinlfer/Workshop.scala
Day 1 and 2 ZIO async and concurrent workshop
View Workshop.scala
package net.degoes.zio
import zio._
import java.text.NumberFormat
import java.nio.charset.StandardCharsets
import zio.blocking.Blocking
import zio.console.Console