Skip to content

Instantly share code, notes, and snippets.

View mageddo's full-sized avatar
💭
🚲 🍺

Elvis Souza mageddo

💭
🚲 🍺
View GitHub Profile
Stream.of(
new AbstractMap.SimpleEntry<>("Apple", 1),
new AbstractMap.SimpleEntry<>("Orange", 1),
new AbstractMap.SimpleEntry<>("Orange", 1),
new AbstractMap.SimpleEntry<>("Grape", 1),
new AbstractMap.SimpleEntry<>("Grape", 1),
new AbstractMap.SimpleEntry<>("Grape", 1)
)
@mageddo
mageddo / build.gradle
Last active March 20, 2021 19:05
Gradle Release Config Example
plugins {
id 'net.researchgate.release' version '2.8.1'
}
release {
project.ext.set("release.useAutomaticVersion", true)
git {
requireBranch = ''
}
failOnCommitNeeded = false
version: '3'
services:
agent:
image: portainer/agent:1.3.0
environment:
AGENT_CLUSTER_ADDR: tasks.agent
# AGENT_PORT: 9001
# LOG_LEVEL: debug
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@mageddo
mageddo / TestUtils.java
Created June 25, 2020 22:19
Utilities for testing
package testing;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
/**
* Some utilities while testing
@mageddo
mageddo / TestUtils.java
Created June 25, 2020 22:19
Utilities for testing
package testing;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
/**
* Some utilities while testing
@mageddo
mageddo / main.cpp
Created June 20, 2020 20:46
Load jar and execute class method from JVMTI + JNI
#include <jvmti.h>
#include <cstring>
#include <iostream>
void debug(char* msg...){
// printf(msg);
}
int loadJar(JNIEnv *jni){
@mageddo
mageddo / main.cpp
Last active November 8, 2022 17:44
JNI call static method with arguments and return object
JNIEnv *jni;
// class and method finding
jclass clazz = jni->FindClass("java/lang/String");
jmethodID method = jni->GetStaticMethodID(clazz, "valueOf", "(Ljava/lang/Object;)Ljava/lang/String;");
if(method == NULL){
jni->FatalError("Class method not found\n");
}
// method execution
@mageddo
mageddo / agent.cpp
Created June 20, 2020 18:34 — forked from hkalina/agent.cpp
Example of setting security policy through JVM Tool Interface (JVM TI) when is JVM starting
/**
* JVM Tool Interface agent which sets
* security policy when is agent loaded
* @author Jan Kalina <honza889@gmail.com>
*/
#include <string.h>
#include <jvmti.h>
#include <jni.h>
@mageddo
mageddo / Main.java
Created May 14, 2020 01:15
Save extension state between tests executions
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
@import url("https://fonts.googleapis.com/css?family=Lato:300,400,700");
/*!
* bootswatch v3.3.7
* Homepage: http://bootswatch.com
* Copyright 2012-2017 Thomas Park
* Licensed under MIT
* Based on Bootstrap
*/
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)