Skip to content

Instantly share code, notes, and snippets.

View mcupak's full-sized avatar

Miro Cupak mcupak

View GitHub Profile
@mcupak
mcupak / ssl.cli
Last active November 11, 2019 11:23
Configuring WildFly behind a reverse proxy with TLS - https://mirocupak.com/configuring-wildfly-behind-a-reverse-proxy-with-tls/
# WildFly reverse proxy setup script.
# Run with: $WILDFLY_HOME/bin/jboss-cli.sh --connect --file=ssl.cli
batch
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=redirect-socket,value=proxy-https)
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding,value=true)
/socket-binding-group=standard-sockets/socket-binding=proxy-https:add(port=443)
run-batch
@mcupak
mcupak / djug.jsh
Created October 6, 2019 20:36
Export of my JShell session from the The good, the bad, and the ugly of Java API design talk at Detroit Java User Group 2019.
List<Integer> list = new ArrayList<Integer>()
list.add(1)
list.add(2)
list.add(3)
list = Collections.unmodifiableList(list)
Collections.unmodifiableList(Arrays.asList(1,2,3))
Collections.unmodifiableList(Stream.of(1,2,3).collect(toList()))
Collections.unmodifiableList(new ArrayList<Integer>() {{ add(1); add(2); add(3); }})
/env -class-path guava-27.1-jre.jar
import com.google.common.collect.ImmutableList
@mcupak
mcupak / javadevdaymx-reactive.jsh
Created October 6, 2019 20:36
Export of my JShell session from the Exploring reactive programming in Java talk at Java Dev Day Mexico 2019.
Thread t = new Thread(() -> System.out.println("hello guadalajara"))
t.start()
ExecutorService e = Executors.newSingleThreadExecutor()
Future<String> f = e.submit(() -> "hello guadalajara")
f
f.get()
ExecutorService e = ForkJoinPool.commonPool()
Future<String> f = e.submit(() -> "hello guadalajara")
f.get()
CompletableFuture<String> cf = new CompletableFuture<String>()
@mcupak
mcupak / javadevdaymx-api-design.jsh
Created October 6, 2019 20:35
Export of my JShell session from the The good, the bad, and the ugly of Java API design talk at Java Dev Day Mexico 2019.
List<Integer> list = new ArrayList<Integer>()
list.add(1)
list.add(2)
list.add(3)
list = Collections.unmodifiableList(list)
Collections.unmodifiableList(Arrays.asList(1,2,3))
Collections.unmodifiableList(Stream.of(1,2,3).collect(toList()))
Collections.unmodifiableList(new ArrayList<Integer>() {{ add(1); add(2); add(3); }} )
/env -class-path guava-27.1-jre.jar
import com.google.common.collect.ImmutableList
@mcupak
mcupak / tjug.jsh
Created June 28, 2019 17:11
JShell session from the Pub Quiz: Local Variable Type Inference talk at TJUG.
var x = "hello"
/v x
var list = new ArrayList<String>()
/v list
int x
var x
var x = null
var x = (Integer) null
int x=0, y=0
var x=0, y=0
@mcupak
mcupak / voxxed-minsk-api-design.jsh
Created June 1, 2019 22:25
Export of my JShell session from The good, the bad, and the ugly of Java API design talk at Voxxed Days Minsk 2019.
List<Integer> list = new ArrayList<Integer>()
list.add(1)
list.add(2)
list.add(3)
list = Collections.unmodifiableList(list)
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(1,2,3)))
Collections.unmodifiableList(Stream.of(1,2,3).collect(toList()))
Collections.unmodifiableList(new ArrayList<Integer>() {{ add(1); add(2); add(3); }})
/env -class-path guava-27.1-jre.jar
import com.google.common.collect.ImmutableList
@mcupak
mcupak / confoo-reactive.jsh
Created March 14, 2019 18:22
Export of my JShell session for the Exploring reactive programming in Java session at ConFoo 2019.
Thread = new Thread(() -> System.out.println("hello confoo"))
Thread t = new Thread(() -> System.out.println("hello confoo"))
t.start()
ExecutorService e = Executors.newSingleThreadExecutor()
Future<String> f = e.submit(() -> "hello confoo")
f
f.get()
ExecutorService e = ForkJoinPool.commonPool()
Future<String> f = e.submit(() -> "hello confoo")
f.get()
@mcupak
mcupak / confoo-clean-code.jsh
Created March 14, 2019 18:21
Export of my JShell session for the Writing clean code with modern Java session at ConFoo 2019.
List<Integer> list = new ArrayList<Integer>()
list.add(1)
list.add(2)
list.add(3)
list = Collections.unmodifiableList(list)
List<Integer> list2 = new ArrayList<Integer>(list)
List<Integer> list2 = Collections.unmodifiableList(new ArrayList<Integer>(list))
List<Integer> list = List.of(1,2,3)
list.add(4)
list.getClass()
@mcupak
mcupak / devnexus.jsh
Created March 7, 2019 17:09
Export of my JShell session from Exploring what's new in Java 10 and 11 (and 12) talk at DevNexus 2019.
List<Integer> list = new ArrayList<Integer>()
list.add(1)
list.add(2)
list.add(3)
list = Collections.unmodifiableList(list)
List<Integer> list2 = new ArrayList<Integer>(list)
List<Integer> list2 = Collections.unmodifiableList(new ArrayList<Integer>(list))
List<Integer> list = List.of(1,2,3)
list.add(4)
List<Integer> list2 = List.copyOf(list)
script:
# validate
- echo "Validating $URL_TO_VALIDATE:"
- VALIDATION_OUTPUT=`curl -sS "$VALIDATOR_URL=$URL_TO_VALIDATE"`
# print validation errors
- echo $VALIDATION_OUTPUT
# check if the validation output ignoring warnings is an empty array
- VALIDATION_ERROR_COUNT=`echo "$VALIDATION_OUTPUT" |jq -c '.schemaValidationMessages // [] | map(select(.level != "warning"))' |jq length`