Skip to content

Instantly share code, notes, and snippets.

@mpujari
mpujari / docker-jvm-JFR
Last active February 15, 2019 07:15
JFR from JVM running inside docker
sudo docker exec 2c4267705051 jcmd 1 VM.unlock_commercial_features
sudo docker exec 2c4267705051 jcmd 1 JFR.start name=MyRecording settings=profile delay=20s duration=12m compress=true filename=/tmp/recording01.jfr
sudo docker exec 2c4267705051 jcmd 1 JFR.check
sudo docker cp 2c4267705051:/tmp/recording01.jfr .
sudo docker exec 2c4267705051 rm /tmp/recording01.jfr
@mpujari
mpujari / dockerJvmFlightRecording.sh
Last active November 27, 2018 04:50
JVM flight recording in docker container
# To do JVM's flight recording, we need pass "-XX:+UnlockCommercialFeatures -XX:+FlightRecorder" as JVM cmd line options
#
# Below is an example to run a container with the above option
# docker run -d -e JAVA_OPTS="-XX:+UnlockCommercialFeatures -XX:+FlightRecorder" DOCKER_IMAGE_NAME
DATE=$(date +%d%m%Y_%H_%M_%S)
FILENAME=$1_recording_${DATE}.jfr
# delay is set to 0 sec, pls changed as you like
# duration is set to 1 min, pls changed as you like
@mpujari
mpujari / Graal GraalVM Truffle
Last active July 26, 2018 04:53
Graal GraalVM Truffle
https://dzone.com/articles/learning-to-use-the-graalvm
http://chrisseaton.com/truffleruby/jokerconf17/
@mpujari
mpujari / Related to Docker
Last active June 14, 2018 03:05
docker helpers
@mpujari
mpujari / SimpleEchoServer.scala
Created March 15, 2018 10:55
Simple Echo server in scala
import java.net.ServerSocket
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import java.io.Closeable
import java.util.Date
object SimpleEchoServer {
https://www.gitbook.com/book/0xax/linux-insides/details
https://0xax.github.io/categories/assembler/
Processing a file using par (not in sequence)
source.getLines.toStream.par.foreach( line => println(line))
@mpujari
mpujari / InstallCert
Created June 2, 2017 03:50
Class used to add the server's certificate to the KeyStore with your trusted certificates.
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
So you want to write an interpreter?
https://www.youtube.com/watch?v=LCslqgM48D4
@mpujari
mpujari / Scala compiler thingy
Last active March 15, 2017 02:59
scala and scala compiler references
https://xueliangliang.wordpress.com/2012/04/17/how-scalas-compiler-works/
Scala compiler phases
http://stackoverflow.com/a/4528092/1079835
Lesson on Scala
https://twitter.github.io/scala_school/index.html