Skip to content

Instantly share code, notes, and snippets.

View AravindaM's full-sized avatar
🏠
Working from home

Aravinda Liyanage AravindaM

🏠
Working from home
View GitHub Profile
@AravindaM
AravindaM / Dockerfile
Created July 19, 2022 07:47 — forked from kaysush/Dockerfile
remote debug enabled dockerfile
FROM openjdk:8
WORKDIR /app
ENV JAVA_TOOL_OPTIONS -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
COPY remote-debugging-1.0-SNAPSHOT.jar remote-debugging.jar
ENTRYPOINT ["java", "-cp", "remote-debugging.jar", "com.kaysush.App"]
@AravindaM
AravindaM / ParseRSAKeys.java
Created March 16, 2021 05:33 — forked from destan/ParseRSAKeys.java
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
@AravindaM
AravindaM / native-mem-tracking.md
Created August 18, 2020 14:36 — forked from prasanthj/native-mem-tracking.md
Native memory tracking in JVM

Enable native memory tracking in JVM by specifying the following flag

-XX:NativeMemoryTracking=detail

Know the <PID> of the java process

jps

To print ps based RSS

ps -p <PID> -o pcpu,rss,size,vsize

To print native memory tracking summary

@AravindaM
AravindaM / node-mtls-auth.md
Last active September 17, 2019 10:32 — forked from pcan/README.md
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Prepare certificates

Generate a Certificate Authority:

openssl req -new -x509 -days 9999 -keyout ca-key.pem -out ca-crt.pem
@AravindaM
AravindaM / private_fork.md
Created August 28, 2018 07:28 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@AravindaM
AravindaM / sysctl.conf
Created May 21, 2018 08:14 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
# Inspired from http://blog.akquinet.de/2010/05/26/mastering-the-maven-command-line-%E2%80%93-reactor-options/
# Build only specific modules:
mvn clean install -pl sub-module-name2
mvn clean install -pl sub-module-name2,sub-module-name3
# Build only starting from specific sub-module (resume from)
mvn clean install -rf sub-module-name2
# Build dependencies (also make)
@AravindaM
AravindaM / play-ws-standalone.scala
Created June 2, 2017 01:35 — forked from jarek-przygodzki/play-ws-standalone.scala
Play 2.5.x - example of simple standalone WSClient
import play.api.libs.ws.ahc.AhcWSClient
import akka.stream.ActorMaterializer
import akka.actor.ActorSystem
implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()
val ws = AhcWSClient()
val req = ws.url("http://example.com").get().map{
resp => resp.body
@AravindaM
AravindaM / WSWithoutPlayApp.scala
Created June 1, 2017 16:16 — forked from ScalaWilliam/WSWithoutPlayApp.scala
Running Play WS standalone, without a Play App. Works with Maven builds nicely. The top way to make REST calls in Scala, in my opinion.
package com.scalawilliam.example.play
import play.api.libs.ws._
/**
* Play's Scala WS library is very very cool. Provides you with plenty niceties.
* See more: https://www.playframework.com/documentation/2.3.x/ScalaWS
*
* Unfortunately it by default requires a Play application context.
* But you do not necessarily always want that.
@AravindaM
AravindaM / http-client-example.scala
Created June 1, 2017 15:48 — forked from semperos/http-client-example.scala
Scala - HTTPComponents client example
package com.semperos.example
import org.apache.http.impl.client.{BasicResponseHandler, DefaultHttpClient}
import org.apache.http.{HttpRequest, HttpRequestInterceptor}
import org.apache.http.client.methods.HttpGet
import org.apache.http.protocol.HttpContext
import org.apache.log4j.Logger
/**