Skip to content

Instantly share code, notes, and snippets.

View wololock's full-sized avatar
🈷️
https://e.printstacktrace.blog

Szymon Stepniak wololock

🈷️
https://e.printstacktrace.blog
View GitHub Profile
@wololock
wololock / java_jmh.log
Created October 2, 2018 17:54
Java collection iteration benchmark results (JMH)
18:15:58: Executing task 'jmh'...
:compileJava NO-SOURCE
:compileGroovy NO-SOURCE
:processResources NO-SOURCE
:classes UP-TO-DATE
:compileTestJava NO-SOURCE
:compileTestGroovy NO-SOURCE
:processTestResources NO-SOURCE
:testClasses UP-TO-DATE
@wololock
wololock / Jenkinsfile.groovy
Last active April 1, 2023 15:30
Jenkins Pipeline with matrix used for parallel deployments
pipeline {
agent any
stages {
stage("Deploy") {
matrix {
axes {
axis {
name "DEPLOY_ENVIRONMENT"
values "DEPLOY_DEV", "DEPLOY_STAGING", "DEPLOY_PROD"
@Grab(group = "org.reflections", module = "reflections", version = "0.9.11")
@Grab(group = "org.slf4j", module = "slf4j-simple", version = "1.7.25")
import groovy.json.JsonOutput
import org.codehaus.groovy.reflection.GeneratedMetaMethod
import org.reflections.Reflections
def reflections = new Reflections("org.codehaus.groovy.runtime")
def json = reflections.getSubTypesOf(GeneratedMetaMethod).collect {
@wololock
wololock / Jenkinsfile.groovy
Last active June 24, 2020 09:14
Jenkins Pipeline with the parallel stages
pipeline {
agent any
stages {
stage("Deploy") {
parallel {
stage("dev") {
when {
beforeAgent true
expression {
import groovy.transform.Field
@Field
def profiles = [
prod: ["master", /release\/.*/],
dev: ["develop", /PR-.*/]
]
String getProfileForBranchName(String branchName, String defaultProfile = "default") {
return profiles.findResult { profile, candidates -> candidates.any { branchName ==~ it } ? profile : null } ?: defaultProfile
stage("Build") {
steps {
sh "mvn clean install"
}
post {
always {
script {
try {
junit "**/target/surefire-reports/TEST-*.xml,**/target/failsafe-reports/*.xml"
} catch (e) {
#!groovy
pipeline {
agent any
stages {
stage("Test") {
when {
changeRequest target: "develop", branch: /^TEST-\d+$/, comparator: 'REGEXP'
}
package com.github.wololock.micronaut.products
import io.micronaut.context.annotation.Property
import io.micronaut.test.annotation.MicronautTest
import spock.lang.Specification
@MicronautTest(environments = ["test"])
class ProductSpec extends Specification {
@Property(name = "items")
import com.sun.net.httpserver.HttpExchange
import com.sun.net.httpserver.HttpHandler
import com.sun.net.httpserver.HttpServer
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked
@CompileStatic
@TypeChecked
class GroovyHttpServer {
@wololock
wololock / console.log
Last active June 25, 2019 15:48
Groovy Trampoline Closure benchmark results (Groovy 2.5.7)
$ ./gradlew clean jmh --no-daemon
> Task :jmhRunBytecodeGenerator
Processing 0 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/java/jmh with "reflection" generator
Processing 5 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/groovy/jmh with "reflection" generator
Writing out Java source to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-sources and resources to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-resources
# Warmup Iteration 1: UTING [6s]
> Task :jmh
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09