Skip to content

Instantly share code, notes, and snippets.

View jebeaudet's full-sized avatar

Jacques-Etienne Beaudet jebeaudet

  • Coveo
  • Quebec, Canada
View GitHub Profile
@jebeaudet
jebeaudet / Dockerfile
Last active July 25, 2023 21:05
Dockerfile for Named Locks using Redisson
FROM maven:3.9.3-eclipse-temurin-17
RUN addgroup --gid 1001 jenkins
RUN adduser --uid 1001 --gid 1001 --disabled-password --gecos '' jenkins
RUN mkdir -p /usr/share/maven/lib/ext/redisson/
RUN apt update
RUN apt install -y wget unzip
@jebeaudet
jebeaudet / patch-ecj.md
Last active May 26, 2023 18:39
Manual patching of ECJ jar for IntelliJ issue

This is what I've done to circumvent this issue. For my project to work, I need the -parameters option and I also like the -preserveAllLocals for debugging.

As IntelliJ accepts a custom ECJ jar, I figured I'd recompile ECJ with the options hardcoded to get around that bug. Unfortunately, the documentation is quite sparse and doesn't show an easy way to build ecj.jar.

I've decided to modify the jar instead! There is a neat tool called Recaf that does just that, decompiles a jar and allow you to easily modify it and repackage it. Neat!

  1. Head to mvn repo to download the latest jar
  2. Download recaf fat jar and execute it with `java -jar
@jebeaudet
jebeaudet / Dockerfile|
Created February 23, 2023 16:02
Dockerfile for Named Locks using Redisson
FROM maven:3.9.0-eclipse-temurin-17
RUN addgroup --gid 1001 jenkins
RUN adduser --uid 1001 --gid 1001 --disabled-password --gecos '' jenkins
RUN mkdir -p /usr/share/maven/lib/ext/redisson/
RUN sed -i '/.*${maven.conf}\/logging/a load ${maven.home}/lib/ext/redisson/*.jar' usr/share/maven/bin/m2.conf
RUN apt update
RUN apt install -y wget
@jebeaudet
jebeaudet / gist:f2fbd78e8b771f1d3c3924c9ccd73fbb
Created December 11, 2019 18:27
Map PID from Host to docker container
PID from the threads/process will be different from the host that from inside the container.
This makes reading thread dump tricky as the thread dump will show the nid of inside the container however you might be checking CPU usage from the host!
To find the mapping of the two, it's easy. Find the PID of the thread/process on the host.
After this, run `cat /proc/{PID}/status |grep NSpid`. Example :
```
NSpid: 31144 83
```
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Controller
{
@GetMapping("/")
public String foo(Pojo pojo)
{
return pojo.toString();
FROM adoptopenjdk/maven-openjdk11:latest
RUN addgroup --gid 1001 jenkins
RUN adduser --uid 1001 --gid 1001 --disabled-password --gecos '' jenkins
RUN mkdir -p /usr/share/maven/lib/ext/redisson/
RUN sed -i '/.*${maven.conf}\/logging/a load ${maven.home}/lib/ext/redisson/*.jar' usr/share/maven/bin/m2.conf
RUN apt update
RUN apt install wget
cat /usr/share/maven/bin/m2.conf
main is org.apache.maven.cli.MavenCli from plexus.core
set maven.conf default ${maven.home}/conf
[plexus.core]
load ${maven.conf}/logging
load ${maven.home}/lib/ext/redisson/*.jar
optionally ${maven.home}/lib/ext/*.jar
load ${maven.home}/lib/*.jar
tree $MAVEN_HOME
/usr/share/maven
├── LICENSE
├── NOTICE
├── README.txt
├── bin
│   ├── m2.conf
│   ├── mvn
│   ├── mvn.cmd
│   ├── mvnDebug
mvn compile -Dsisu.debug
TRACE: Sisu - Add publisher: com.google.inject.internal.InjectorImpl@4a11eb84
-----[explicit bindings]-------------------------------------------------------
0. InstanceBinding{key=Key[type=com.google.inject.Stage, annotation=[none]], source=[unknown source], instance=DEVELOPMENT}
1. ProviderInstanceBinding{key=Key[type=com.google.inject.Injector, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Injector>}
2. ProviderInstanceBinding{key=Key[type=java.util.logging.Logger, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Logger>}
3. InstanceBinding{key=Key[type=org.codehaus.plexus.context.Context, annotation=[none]], source=org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:831), instance={plexus=org.codehaus.plexus.DefaultPlexusContainer@7c1e2a2d}}
4. InstanceBinding{key=Key[type=org.eclipse.sisu.inject.MutableBeanLocator, annotation=[none]], source=org.codehaus.plex
FROM maven:3.8.1-openjdk-11-slim
RUN addgroup --gid 1001 jenkins
RUN adduser --uid 1001 --gid 1001 --disabled-password --gecos '' jenkins
RUN mkdir -p /usr/share/maven/lib/ext/redisson/
RUN sed -i '/.*${maven.conf}\/logging/a load ${maven.home}/lib/ext/redisson/*.jar' usr/share/maven/bin/m2.conf
RUN apt update
RUN apt install -y wget