Skip to content

Instantly share code, notes, and snippets.

View maxandersen's full-sized avatar
💭
; is so overrated

Max Rydahl Andersen maxandersen

💭
; is so overrated
View GitHub Profile
@maxandersen
maxandersen / Main.java
Last active November 6, 2023 09:24 — forked from franz1981/Main.java
//JAVA 21+
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Main {
static {
System.out.print("Hello,");
try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) {
//JAVA 19
//DEPS org.openjdk.jmh:jmh-generator-annprocess:1.36
//JAVA_OPTIONS --enable-preview --add-opens java.base/java.lang=ALL-UNNAMED
// to run with javagagent add the following:
// `--javaagent=ap-loader@maxandersen=start,event=cpu,file=profile.html`
package red.hat.puzzles.loom;
import java.lang.invoke.MethodHandle;
@maxandersen
maxandersen / lol.java
Created November 24, 2022 11:17 — forked from fbricon/lol.java
JFiglet + Lolcat with JBang
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS com.github.jamesnetherton:lolcat4j:0.4.0
//DEPS com.github.lalyos:jfiglet:0.0.9
import java.io.IOException;
import com.github.jamesnetherton.lolcat4j.Lol;
import com.github.lalyos.jfiglet.FigletFont;
public class lol {
@maxandersen
maxandersen / CreateWebserver.java
Created December 29, 2021 05:37 — forked from jmini/CreateWebserver.java
Create a docker image with Jib
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS com.google.cloud.tools:jib-core:0.20.0
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import com.google.cloud.tools.jib.api.Containerizer;
import com.google.cloud.tools.jib.api.DockerDaemonImage;
@maxandersen
maxandersen / mavenstats.java
Last active November 17, 2021 22:51 — forked from rivasdiaz/mavenstats.java
Maven Project Statistics
///usr/bin/env jbang "$0" "$@" ; exit $?
//JDK 17+
//DEPS io.quarkus:quarkus-bom:2.4.1.Final@pom
//DEPS io.quarkus:quarkus-picocli
//DEPS io.quarkus:quarkus-jackson
//DEPS io.quarkus:quarkus-smallrye-context-propagation
//DEPS com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.12.5
//DEPS com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.5
@maxandersen
maxandersen / CircleSpinnyThingies.java
Last active July 17, 2021 15:52 — forked from tsumnia/CircleSpinnyThingies.java
JavaFX Animations - runnable with jbang
//DEPS org.openjfx:javafx-graphics:11.0.2:${os.detected.jfxname}
import javafx.animation.*;
import javafx.application.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.stage.*;
import javafx.util.*;
class AlbumImages {
public String image_id;
public String user_id;
public String albumId;
}
@maxandersen
maxandersen / MTL.java
Last active November 7, 2020 01:41 — forked from tonivade/MTL.java
MTL in Java
//usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 14+
//JAVAC_OPTIONS --enable-preview -source 14
//JAVA_OPTIONS --enable-preview
//DEPS com.github.tonivade:purefun-typeclasses:1.8
//DEPS com.github.tonivade:purefun-instances:1.8
//DEPS com.github.tonivade:purefun-transformer:1.8
import static com.github.tonivade.purefun.Matcher1.is;
@maxandersen
maxandersen / a#a.java
Created October 14, 2020 07:15 — forked from tivrfoa/a#a.java
Tests for JBang - Multiple Files
class file4 {
public static void main(String[] args) {
System.out.println("I'm file 4");
}
}
//JAVAC_OPTIONS -source 15
public class Jbang {
public static void main(String... args) {
String heyRick = """
`````````.-::/+oooooo+ooo++/-.........```...--..-..--......................`...`````...-://++++++/////+++++++++//+++++++++++++++++++++++++++
`````.```..----/+oooooooooooo+:-.................---------------::-...`........`........-://++/+++//++++++++++////+++++++++++++++++++///+++/
`````````..--.--:/+oooooooooooo+/-....................---------://///:--.....```..`......-:////////////+++++////+++++++++o++++ooooo+++++++++
````````........--:/ossoooooooooo+/:-.................--------:::///++++/:-...```.........-://///+++++++++++++++++++++++++++/+++++++++++++++
``````````.`...``..-:/ooooooooooooo+/----.....----..------::::///::-://::::::-......`......-:///////++++++/++++++ooo+++//+++///++++++++++++/
``````````.````````...:+ooooooooo+/:----.----:::///:::///////////:::://::/+++/:--..`........-://///+++++++///+++++++++++++++++++++++++///+//