Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
😏

mvillafuertem

💭
😏
View GitHub Profile
@mvillafuertem
mvillafuertem / README.md
Created February 17, 2023 19:08 — forked from sdkks/README.md
How to SSH to Kubernetes Pod with SSH ProxyCommand using socat
View README.md

Requirements

  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
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
mvillafuertem / ExceptionHandlingExample.java
Created October 5, 2022 08:59 — forked from IgorBerman/ExceptionHandlingExample.java
akka streams in java with kill switch, shutdown hook and error handling
View ExceptionHandlingExample.java
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.actor.ActorSystem;
import akka.japi.Pair;
@mvillafuertem
mvillafuertem / localstack.md
Created September 28, 2022 14:16 — forked from lobster1234/localstack.md
Working with localstack on command line
View localstack.md

Starting localstack

C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
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
mvillafuertem / kubectl-multi-version-brews.md
Created March 16, 2022 13:08 — forked from rdump/kubectl-multi-version-brews.md
kubectl multi-version brews (kubernetes-cli formula)
View kubectl-multi-version-brews.md

kubectl multi-version brews

Applicability

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 https://github.com/rdump/homebrew-versions

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

@mvillafuertem
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 java.io.IOException
import zio._
import java.text.NumberFormat
import java.nio.charset.StandardCharsets
import zio.blocking.Blocking
import zio.console.Console
@mvillafuertem
mvillafuertem / ArgsOps.scala
Created July 3, 2021 21:52 — forked from gwenzek/ArgsOps.scala
Scala parser for programm args
View ArgsOps.scala
import scala.language.implicitConversions
/**
* @author gwenzek
*
*/
class ArgsOps(ops: Map[String, OptionalParam], val args: Array[String]){
def apply(op: String) = ops(op)
}
@mvillafuertem
mvillafuertem / day-3.scala
Created June 21, 2021 12:09 — forked from calvinlfer/day-3.scala
Functional Scala: Toronto edition
View day-3.scala
// Copyright(C) 2018 - John A. De Goes. All rights reserved.
package net.degoes.effects
import scalaz.zio._
import scalaz.zio.console._
import scala.annotation.tailrec
import scala.concurrent.duration._
@mvillafuertem
mvillafuertem / MLToyApp.scala
Created December 13, 2020 22:00 — forked from abomm/MLToyApp.scala
Machine Learning application design with Pure Functional ZIO in Scala
View MLToyApp.scala
package ziomlscoring
import zio._
import ziomlscoring.SizeMyShirt.moduleExperimentFramework.ExperimentFramework
import ziomlscoring.SizeMyShirt.moduleInferenceLogger.InferenceLogger
import ziomlscoring.SizeMyShirt.moduleTShirtSizer.TShirtSizer
import ziomlscoring.SizeMyShirt.sizeMyShirtMicroService
object SizeMyShirt {
case class UserId(value: Long) extends AnyVal