Skip to content

Instantly share code, notes, and snippets.

View kriegaex's full-sized avatar

Alexander Kriegisch kriegaex

View GitHub Profile
@kriegaex
kriegaex / BootstrapAdviceAgent.java
Last active January 19, 2024 06:41
An example agent that intercepts bootstrap class method String::concat. Tested with Byte Buddy 1.14.11 on JDKs 8 to 21. Based on a question about https://gist.github.com/kriegaex/0f4dd4c9d05f3a68e3a8e1ed75359c3b.
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.agent.builder.ResettableClassFileTransformer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.asm.Advice.*;
import net.bytebuddy.dynamic.loading.ClassInjector;
import java.io.IOException;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;
package de.scrum_master.spring.q68785567;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
@kriegaex
kriegaex / run-spock2-test-via-junit5-standalone-runner.sh
Last active July 9, 2020 13:14
How to run Spock 2 tests via JUnit 5 stand-alone console runner (please adjust variables, paths, separators etc. by yourself)
export MAVEN_REPO=c:/Users/alexa/.m2/repository
export JUNIT5_STANDALONE=$MAVEN_REPO/org/junit/platform/junit-platform-console-standalone/1.6.2/junit-platform-console-standalone-1.6.2.jar
export GROOVY3=$MAVEN_REPO/org/codehaus/groovy/groovy/3.0.4/groovy-3.0.4.jar
export SPOCK2_CORE=$MAVEN_REPO/org/spockframework/spock-core/2.0-M3-groovy-3.0/spock-core-2.0-M3-groovy-3.0.jar
java -jar $JUNIT5_STANDALONE -cp "$GROOVY3;$SPOCK2_CORE;target/test-classes;target/classes" --disable-banner --details=verbose --select-class de.scrum_master.testing.MyTest
@kriegaex
kriegaex / BootstrapAgent.java
Last active January 19, 2024 03:52 — forked from joshgord/BootstrapAgent.java
An example agent that intercepts a method of the bootstrap class loader. Tested with Byte Buddy 1.14.11 on JDKs 8 to 21.
package net.bytebuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.loading.ClassInjector;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.SuperCall;
import net.bytebuddy.matcher.ElementMatchers;
@kriegaex
kriegaex / telekom-backlog-filter.js
Last active December 17, 2015 01:49
Sorry for my bad JavaScript, it is my first try to use this language.
// ==UserScript==
// @name Backlog Filter
// @namespace myproject.telekom.de
// @description MyProject ein paar Buttons schenken, mit denen sich Backlogs filtern lassen
// @include https://myproject.telekom.de/pi/rb/master_backlogs/hmp
// @require http://code.jquery.com/jquery-1.9.1.min.js
// @version 3.15
// @grant none
// ==/UserScript==