Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
; is so overrated

Max Rydahl Andersen maxandersen

💭
; is so overrated
View GitHub Profile
@maxandersen
maxandersen / delrepo.java
Last active Jul 18, 2020
small https://jbang.dev script to delete all repos under a user or org matching a regular expression. Used it to cleanup many years of weird empty repo experiments ;)
View delrepo.java
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS info.picocli:picocli:4.2.0
//DEPS org.kohsuke:github-api:1.101
import org.kohsuke.github.GitHub;
import org.kohsuke.github.GitHubBuilder;
import org.kohsuke.github.extras.OkHttpConnector;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
View api-config.json
{
"999..": [
{
"extension": "revapi.ignore",
"configuration": [
{
"code": "java.class.nonPublicPartOfAPI",
"old": "interface io.quarkus.annotation.processor.generate_doc.DocFormatter",
"new": "interface io.quarkus.annotation.processor.generate_doc.DocFormatter",
"justification": "ADD YOUR EXPLANATION FOR THE NECESSITY OF THIS CHANGE"
View gist:33f0374b86371ec959368c5f3baed52c
[ERROR] The enum constant was defined on position 9 but is now on 10. The user code can break if it relies on the return value of the "ordinal()" method. [java.field.enumConstantOrderChanged]
new: field com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_MISSING_VALUES (com.fasterxml.jackson.core:jackson-core:jar:2.11.1)
Semantic: Potentiallybreaking
oldOrdinal = 9
newOrdinal = 10
[ERROR] The enum constant was defined on position 8 but is now on 9. The user code can break if it relies on the return value of the "ordinal()" method. [java.field.enumConstantOrderChanged]
new: field com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS (com.fasterxml.jackson.core:jackson-core:jar:2.11.1)
Semantic: Potentiallybreaking
View revapi-maven.ftl
<#ftl strip_whitespace=true>
<#if reports?has_content>
Old API: <#list analysis.oldApi.archives as archive>${archive.name}<#sep>, </#list>
New API: <#list analysis.newApi.archives as archive>${archive.name}<#sep>, </#list>
<#list reports as report>
<#list report.differences as diff>
[ERROR] ${diff.description!} [${diff.code}]
new: ${report.newElement!"<none>"}
<#if report.newElement! != report.oldElement!>
View gist:8c3e78d15b9b357f2bc8935368462742
This file has been truncated, but you can view the full file.
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: javax.annotation.* < plexus.core
[DEBUG] Imported: javax.annotation.security.* < plexus.core
[DEBUG] Imported: javax.enterprise.inject.* < plexus.core
[DEBUG] Imported: javax.enterprise.util.* < plexus.core
[DEBUG] Imported: javax.inject.* < plexus.core
[DEBUG] Imported: org.apache.maven.* < plexus.core
[DEBUG] Imported: org.apache.maven.artifact < plexus.core
View gist:d0bc20c973d659c274bad04871867b8d
This file has been truncated, but you can view the full file.
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/max/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.4, vendor: AdoptOpenJDK, runtime: /Users/max/.sdkman/candidates/java/11.0.4.hs-adpt
Default locale: en_CH, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "mac"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: javax.annotation.* < plexus.core
[DEBUG] Imported: javax.annotation.security.* < plexus.core
View gist:1deff886334834772c76b16e02d0a08c
This file has been truncated, but you can view the full file.
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/max/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.4, vendor: AdoptOpenJDK, runtime: /Users/max/.sdkman/candidates/java/11.0.4.hs-adpt
Default locale: en_CH, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "mac"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: javax.annotation.* < plexus.core
[DEBUG] Imported: javax.annotation.security.* < plexus.core
View delrepo.java
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS info.picocli:picocli:4.2.0
//DEPS org.kohsuke:github-api:1.101
import org.kohsuke.github.GitHub;
import org.kohsuke.github.GitHubBuilder;
import org.kohsuke.github.extras.OkHttpConnector;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
View mutiny.java
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.smallrye.reactive:mutiny:0.5.3
public class mutiny {
public static void main(String... args) {
io.smallrye.mutiny.Multi.createFrom().items("hello", "world")
.onItem().apply(s->s.toUpperCase() + " ")
.onCompletion().continueWith("!")
.subscribe().with(System.out::print);
View gist:ee476dd75515e282ec0548e7bfd855db

without CDS

1: jbang --no-cds docker.java
            Mean        Std.Dev.    Min         Median      Max
real        1.403       0.048       1.358       1.391       1.526
user        2.685       0.052       2.605       2.684       2.805
sys         0.267       0.008       0.258       0.264       0.280

with cds:

You can’t perform that action at this time.