Skip to content

Instantly share code, notes, and snippets.

View joakime's full-sized avatar

Joakim Erdfelt joakime

  • Webtide, LLC
  • McAllen, TX
View GitHub Profile
@joakime
joakime / FindShortTempDir.java
Created August 4, 2021 15:19
FindShortTempDir
package fs;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
public class FindShortTempDir
{
@joakime
joakime / CaseInsensitiveAliasChecker.java
Created July 6, 2021 18:19
CaseInsensitiveAliasChecker.java (for Jetty)
package jetty.examples;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.PathResource;
<schema
xmlns='http://www.w3.org/2000/10/XMLSchema'
targetNamespace='https://www.eclipse.org/jetty/configure_10_0.xsd'
xmlns:jetty='https://www.eclipse.org/jetty/configure_10_0.xsd'>
<element name='Configure'>
<complexType>
<sequence>
<element ref='jetty:Id' minOccurs='0' maxOccurs='1'/>
<element ref='jetty:Class' minOccurs='0' maxOccurs='1'/>
111e7bea9c968cdb3d06ef4632bf7ff0824d0f36 ./net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar - NOT FOUND
cdd846cfc4e0f7eefafc02c0f5dce32b9303aa2a ./net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar - VALID SHA1SUM
-----BEGIN PGP SIGNATURE-----
iEYEABECAAYFAlfn6TwACgkQDail7ALRHq3MswCeJmq5nI8jWdsfQgCXHg8wTMT1
eKUAnR75TnGR/85PQbStK3dQW5zKugO2
=3yXe
-----END PGP SIGNATURE-----
42ccaf4761f0dfdfa805c9e340d99a755907e2dd ./net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar - VALID SHA1SUM
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
## org.eclipse.jetty.demo.EmbeddedEnhancedListenerSCIDemo
[INFO] org.eclipse.jetty.util.log.javautil (1) Logging initialized @196ms to org.eclipse.jetty.util.log.JavaUtilLog
[INFO] org.eclipse.jetty.server.Server (1) jetty-9.4.31.v20200723; built: 2020-07-23T17:57:36.812Z; git: 450ba27947e13e66baa8cd1ce7e85a4461cacc1d; jvm 11.0.8+10
[INFO] org.jboss.weld.environment.servletWeldServlet (1) WELD-ENV-001008: Initialize Weld using ServletContainerInitializer
[INFO] org.jboss.weld.Version (1) WELD-000900: 3.1.3 (Final)
[INFO] org.jboss.weld.Bootstrap (1) WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
[INFO] org.jboss.weld.environment.servletJetty (1) WELD-ENV-001200: Jetty 7.2+ detected, CDI injection will be available in Servlets and Filters. Injection into Listeners should work on Jetty 9.1.1 and newer.
[INFO] org.eclipse.jetty.server.handler.ContextHandler (1) Started o.e.j.s.ServletContextHandler@6941
package fs;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ServletApiExample
{
public static void main(String[] args)
{
Path multipartLocation = Paths.get(System.getProperty("user.dir"));
package fs;
import java.nio.file.FileSystems;
import java.nio.file.Path;
public class AbsoluteTest
{
public static void main(String[] args)
{
isAbsolute("/is/it/abs");
$ ab -n 100000 -c 10000 http://localhost:8888/
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
package test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class WithResources
{
public static void main(String[] args) throws IOException
package random;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.security.SecureRandom;
import java.security.Security;
public class OptionsForSecureRandom
{
public static void main(String[] args)