Skip to content

Instantly share code, notes, and snippets.

View randomstatistic's full-sized avatar

Jeff Wartes randomstatistic

View GitHub Profile
@randomstatistic
randomstatistic / MGet.scala
Last active October 9, 2018 18:10
Get 200 random keys from a redis cluster
import io.lettuce.core.RedisURI
import io.lettuce.core.cluster.{ ClusterClientOptions, ClusterTopologyRefreshOptions, RedisClusterClient }
import scala.util.Random
object MGet {
def main(args: Array[String]): Unit = {
val host = args(0)
val port = args(1).toInt
@randomstatistic
randomstatistic / ConfigMask.scala
Created June 21, 2019 18:54
Mask sensitive TypeSafe-Config values for rendering
import java.util.Map.Entry
import com.typesafe.config.{ Config, ConfigRenderOptions, ConfigValue, ConfigValueFactory }
import org.mindrot.jbcrypt.BCrypt
import scala.io.{ Codec, Source }
import scala.collection.JavaConverters._
import scala.util.Try
import scala.util.matching.Regex
@randomstatistic
randomstatistic / Performance
Last active October 7, 2019 21:44
Tool notes
Java:
http://java-performance.com/
Linux:
perf (https://perf.wiki.kernel.org/index.php/Main_Page)
perf can be a bit finicky to set up though, One of the most interesting payoffs for the effort is getting cool flame graphs of cpu usage, like this example:
http://www.brendangregg.com/FlameGraphs/cpu-mixedmode-flamegraph-java.svg (from the blog post http://techblog.netflix.com/2015/07/java-in-flames.html)
Install perf:
@randomstatistic
randomstatistic / AsyncFunctionAction.scala
Created December 9, 2016 18:09
Gatling classes for testing an arbitrary async function
import io.gatling.commons.stats.{KO, OK}
import io.gatling.commons.util.TimeHelper._
import io.gatling.core.Predef._
import io.gatling.core.action.{Action, ExitableAction}
import io.gatling.core.action.builder.ActionBuilder
import io.gatling.core.stats.StatsEngine
import io.gatling.core.stats.message.ResponseTimings
import io.gatling.core.structure.ScenarioContext
import io.gatling.core.util.NameGen