Skip to content

Instantly share code, notes, and snippets.

View mvillafuertem's full-sized avatar
💭
😏

mvillafuertem

💭
😏
View GitHub Profile
@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)

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
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
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
// 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
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
@mvillafuertem
mvillafuertem / solving_spark_signature_error.md
Created November 21, 2020 18:43 — forked from hkhamm/solving_spark_signature_error.md
Solving a Spark Invalid signature file digest for Manifest main attributes error

##Solving a Spark error: Invalid signature file digest for Manifest main attributes

When using spark-submit to run a jar, you may encounter this error:

Invalid signature file digest for Manifest main attributes

The error occurs when one of the included libraries in the jar's META-INF directory has a bad signature.

Works in git 2.28
git clone --filter=blob:none --no-checkout --depth 1 --sparse <project-url>
cd <project>
git sparse-checkout init --cone
Specify the files and folders you want to clone
git sparse-checkout add <folder>/<innerfolder> <folder2>/<innerfolder2>
git checkout
def nodeSpecs(List specs, Closure callback) {
def nodes = [:]
for (item in specs) {
def spec = item
nodes["Spec ${spec}"] = { callback.call(spec) }
}
return nodes
}
@mvillafuertem
mvillafuertem / gatling-simple.sc
Created May 8, 2020 13:51 — forked from dacr/gatling-simple.sc
Just ONE ammonite script file to execute a load performance test using gatling ! #ea7a4259-9461-44a8-99fa-1ec6ec3c48ed/cb9ae6dd7c07d7f534a416c586bc5182a8244daa
// summary : Just ONE ammonite script file to execute a load performance test using gatling !
// keywords : scala, gatling, ammonite, scala, load-test, performance
// publish : gist, snippet
// authors : David Crosson
// id : ea7a4259-9461-44a8-99fa-1ec6ec3c48ed
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc'
/*
A performance load script file directly executable using ammonite, run on all OS (linux / Mac / Windows), just install ammonite REPL (http://ammonite.io).
@mvillafuertem
mvillafuertem / build.sbt
Created May 8, 2020 13:44
run h2 console from sbt
// Method 1 Create a task
// It can throw java.util.NoSuchElementException: head of empty list if you don't have h2 dependency
lazy val h2Console = taskKey[Int]("Init H2 console task")
h2Console := (Compile / dependencyClasspathAsJars)
.value
.map(_.data)
.filter(_.getPath.contains("h2database"))
.map(h2database => Process(s"java -jar ${h2database} org.h2.tools.Server").!)
.head