Skip to content

Instantly share code, notes, and snippets.

View mcupak's full-sized avatar

Miro Cupak mcupak

View GitHub Profile
# 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
@mcupak
mcupak / xa-data-source-help.out
Created October 9, 2017 05:02
xa-data-source add --help
[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 November 19, 2020 03:55
Export of my JShell session from the Exploring reactive programming in Java talk at Devoxx Ukraine 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 / devoxx-type-inference.jsh
Last active November 19, 2020 03:53
Export of my JShell session from the Local variable type inference - Will it compile? talk at Devoxx Ukraine 2019.
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 October 9, 2017 06:37
Changing resolve-parameter-values in jboss-cli.xml.
$ sed -i "s/<resolve-parameter-values>false<\/resolve-parameter-values>/\
<resolve-parameter-values>true<\/resolve-parameter-values>/" \
$JBOSS_HOME/bin/jboss-cli.xml
@mcupak
mcupak / enable-access-log.cli
Last active March 10, 2020 15:56
Enabling access log with Undertow on WildFly - https://mirocupak.com/logging-requests-with-undertow/
# 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 March 3, 2020 22:07
Export of my JShell session from the Exploring the last year of Java talk at ConFoo 2020.
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 March 3, 2020 22:06
Export of my JShell session from the Local variable type inference - Will it compile? talk at ConFoo 2020.
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 March 3, 2020 22:05
Export of my JShell session from The Good, the Bad and the Ugly of Java API design talk at DevNexus 2020.
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 October 9, 2017 04:50
Enable CORS for Keycloak.
/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)