Skip to content

Instantly share code, notes, and snippets.

# no args example
$ ./build/graal/hello-world
# output
Hello world :)
# args example
$ ./build/graal/hello-world --help
# output
# no args example
$ ./gradlew run
# output
> Task :run
Hello world :)
# args example
$ ./gradlew run --args="--help"
plugins {
// ...
id 'com.palantir.graal' version '0.6.0'
}
graal {
mainClass 'com.mitchseymour.mycli.App'
outputName 'mycli'
}
package com.mitchseymour.mycli;
public class App {
public String getGreeting() {
return "Hello world.";
}
public static void main(String[] args) {
System.out.println(new App().getGreeting());
}
@mitch-seymour
mitch-seymour / mycli.rb
Created March 22, 2020 16:58
medium-cli-article2-formula
class Mycli < Formula
desc "example CLI"
homepage "https://github.com/mitch-seymour/graal-cli-example"
url "https://github.com/mitch-seymour/graal-cli-example/releases/download/v0.1.0/mycli-0.1.0.tar.gz"
sha256 "f2b530c413c795e8b0bfd5ece9bdd56d14b61846c5281e15bc4b46ee3b49d067"
bottle :unneeded
def install
bin.install "mycli"
@mitch-seymour
mitch-seymour / c10-0.md
Last active December 1, 2020 01:55
book edits
+------+----+--------+-------------+--------------------+---------------------+-------------+
|ROWKEY|UUID|TITLE_ID|CHANGE_TYPE  |BEFORE              |AFTER                |CREATED_AT   |
+------+----+--------+-------------+--------------------+---------------------+-------------+
|2     |2   |2       |release_date |{SEASON_ID=1,        |{SEASON_ID=1,       |2021-02-08...|
                                     EPISODE_COUNT=null}   EPISODE_COUNT=null}

|null  |1    |1      |season_length|{SEASON_ID=1,
                                     EPISODE_COUNT=12}   |{SEASON_ID=1,       |2021-02-08...|
 EPISODE_COUNT=8}
// required for interactive queries (server)
implementation 'io.javalin:javalin:3.12.0'

// required for interactive queries (client)
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
Properties props = new Properties();
props.put(StreamsConfig.APPLICATION_ID_CONFIG, "dev");
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");

KafkaStreams streams = new KafkaStreams(builder.build(), props);
streams.start();
StreamsBuilder builder = new StreamsBuilder();
KStream<byte[], String> stream = builder.stream("patient-events");

stream
    .groupByKey()
    .reduce(
        (value1, value2) -> {
          if (value2.equals(PATIENT_CHECKED_OUT)) {
 // create a tombstone