Skip to content

Instantly share code, notes, and snippets.

Avatar

Miro Cupak mcupak

View GitHub Profile
@mcupak
mcupak / xa-data-source-help.out
Created Oct 9, 2017
xa-data-source add --help
View xa-data-source-help.out
[standalone@localhost:9990 /] xa-data-source add --help
DESCRIPTION:
Add a new XA data-source (unlike the add operation, this command accepts
xa-datasource-properties).
REQUIRED ARGUMENTS:
@mcupak
mcupak / devoxx-exploring-reactive.jsh
Created Nov 19, 2020
Export of my JShell session from the Exploring reactive programming in Java talk at Devoxx Ukraine 2019.
View devoxx-exploring-reactive.jsh
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 / devoxx-type-inference.jsh
Last active Nov 19, 2020
Export of my JShell session from the Local variable type inference - Will it compile? talk at Devoxx Ukraine 2019.
View devoxx-type-inference.jsh
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 / set-resolve-parameter-values.out
Created Oct 9, 2017
Changing resolve-parameter-values in jboss-cli.xml.
View set-resolve-parameter-values.out
$ sed -i "s/<resolve-parameter-values>false<\/resolve-parameter-values>/\
<resolve-parameter-values>true<\/resolve-parameter-values>/" \
$JBOSS_HOME/bin/jboss-cli.xml
View deployment-timeout.cli
# Script for increasing deployment-related timeouts on WildFly to 15 minutes.
# Run with: $WILDFLY_HOME/bin/jboss-cli.sh --connect --file=deployment-timeout.cli
batch
/system-property=jboss.as.management.blocking.timeout:add(value=900)
/subsystem=deployment-scanner/scanner=default:write-attribute(name=deployment-timeout,value=900)
run-batch
View enable-access-log.cli
# Script for enabling access log based on Undertow on WildFly.
# Run with: $WILDFLY_HOME/bin/jboss-cli.sh --connect --file=enable-access-log.cli
batch
/subsystem=undertow/server=default-server/host=default-host/setting=access-log:add(pattern="%h %t \"%r\" %s \"%{i,User-Agent}\"",use-server-log=true)
run-batch
@mcupak
mcupak / confoo-exploring-java.jsh
Created Mar 3, 2020
Export of my JShell session from the Exploring the last year of Java talk at ConFoo 2020.
View confoo-exploring-java.jsh
HttpHandler handler = he -> {
String body = "hello confoo";
he.sendResponseHeaders(200, body.length());
try (OutputStream os = he.getResponseBody()) {
os.write(body.getBytes());
}
}
/l handler
HttpServer hs = HttpServer.create(new InetSocketAddress(8000), 0)
@mcupak
mcupak / confoo-type-inference.jsh
Created Mar 3, 2020
Export of my JShell session from the Local variable type inference - Will it compile? talk at ConFoo 2020.
View confoo-type-inference.jsh
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 / devnexus.jsh
Created Mar 3, 2020
Export of my JShell session from The Good, the Bad and the Ugly of Java API design talk at DevNexus 2020.
View devnexus.jsh
Set<Integer> set = new HashSet<Integer>()
set.add(1)
set.add(2)
set.add(3)
set = Collections.unmodifiableSet(set)
Collections.unmodifiableSet(new HashSet<>Arrays.asList(1,2,3)))
Collections.unmodifiableSet(new HashSet<>Arrays.asList(1,2,3))
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(1,2,3)))
Collections.unmodifiableSet(new HashSet<Integer>() {{ add(1); add(2); add(3); }})
ImmutableSet.of(1,2,3)
@mcupak
mcupak / enable-cors.cli
Created Oct 9, 2017
Enable CORS for Keycloak.
View enable-cors.cli
/subsystem=keycloak/realm=sample-realm:write-attribute\
(name=cors-max-age,value=1000)
/subsystem=keycloak/realm=sample-realm:write-attribute\
(name=cors-allowed-methods,value="GET, POST, PUT, DELETE, OPTIONS, HEAD")
/subsystem=keycloak/realm=sample-realm:write-attribute\
(name=enable-cors,value=true)