Skip to content

Instantly share code, notes, and snippets.

View melix's full-sized avatar

Cédric Champeau melix

View GitHub Profile
@melix
melix / convert.groovy
Created July 17, 2013 12:57
Convert Confluence HTML export into asciidoc
@Grab('net.sourceforge.htmlcleaner:htmlcleaner:2.4')
import org.htmlcleaner.*
def src = new File('html').toPath()
def dst = new File('asciidoc').toPath()
def cleaner = new HtmlCleaner()
def props = cleaner.properties
props.translateSpecialEntities = false
def serializer = new SimpleHtmlSerializer(props)
@melix
melix / README.md
Last active June 22, 2023 20:57
Reproducing the benchmarks of the Maven vs Gradle performance page

Gradle vs Maven performance reproduction instructions

Install the Gradle Profiler

This page explains how to reproduce the Gradle vs Maven performance numbers yourself. For that, you need to install the Gradle profiler, a tool which will automate benchmarking by running several builds in a row, with the appropriate options (it also runs Maven builds).

Generate the test projects

Our performance comparison uses 4 test projects:

@melix
melix / build.gradle
Created June 19, 2013 12:41
Apply javadoc fix tool to your Gradle build
// Copy JavadocFixTool.java into buildSrc/src/main/java
// this will apply the javadoc fix tool to all generated javadocs
// we use it to make sure that the javadocs are not vulnerable independently of the JDK used to build
allprojects {
tasks.withType(Javadoc).all {
doLast {
def javadocFix = new JavadocFixTool()
javadocFix.recursive = true
javadocFix.doPatch = true
@melix
melix / build.gradle
Last active October 7, 2022 17:09
Dependency downloader
// Downloads dependencies of an artifact in an output directory
//
// Note that it assumes _runtime_ dependencies, and it assumes "Maven compatible" variants.
// For compile time (API) dependencies, or for variant-aware resolution,
// code would have to be updated to set the appropriate resolution attributes.
//
// Usage:
// gradle download --input org.apache.groovy:groovy-json:4.0.1
//
// Optional flags:
@melix
melix / GroovyActivity.groovy
Created April 24, 2014 09:17
An Android activity, written in Groovy, and able to compile and run Groovy code dynamically on the device.
package me.champeau.groovydroid
import android.app.Activity
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.View
import android.widget.EditText
import com.android.dx.dex.DexFormat
import com.android.dx.dex.DexOptions
@melix
melix / build.gradle.kts
Last active December 21, 2021 16:21
Micronaut AOT Intro
plugins {
id("io.micronaut.application") version "3.1.1"
id("io.micronaut.aot") version "3.1.1"
}
...
micronaut {
...
aot {
version.set("1.0.0-M5")
cacheEnvironment.set(true)
@melix
melix / README.md
Created December 20, 2021 17:49
Testing Micronaut AOT for Lambda

Edit your settings.gradle file to include the Micronaut Gradle Plugin branch:

plugins {
    id 'me.champeau.includegit' version '0.1.4'
}

rootProject.name="micronautguide"

gitRepositories {
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
The Universal Permissive License (UPL), Version 1.0
Subject to the condition set forth below, permission is hereby granted to any
person obtaining a copy of this software, associated documentation and/or
data (collectively the "Software"), free of charge and under any and all
@melix
melix / README.adoc
Last active July 7, 2021 07:37
An automated solver for 2048

Automated solver for 2048

This is a script which runs a "bot" that tries to solve the incredibly addictive 2048 game. It makes use of Groovy and browser automation with Geb.

How to

  • First step, if you don’t have it, you need to install Groovy.

  • Second step is to install the Google Chrome WebDriver (just unzip the appropriate file to a local directory)

  • Next, edit the script to set the path to the Chrome Driver

  • then execute the script: groovy solver2048.groovy

@melix
melix / Dockerfile
Last active June 2, 2020 01:37
Dockerfile for Groovy
################################################
# Dockerfile to run Groovy containers
# Based on Java 8 image
################################################
FROM java:8u40-jdk
MAINTAINER Cédric Champeau
# Install GVM