Skip to content

Instantly share code, notes, and snippets.

View ben-manes's full-sized avatar

Ben Manes ben-manes

View GitHub Profile
@ben-manes
ben-manes / compute_results_11.json
Last active May 30, 2024 22:11
Compute JMH Results
[
{
"jmhVersion" : "1.37",
"benchmark" : "com.github.benmanes.caffeine.cache.ComputeBenchmark.compute_sameKey",
"mode" : "thrpt",
"threads" : 32,
"forks" : 1,
"jvm" : "/usr/lib/jvm/temurin-11-jdk-amd64/bin/java",
"jvmArgs" : [
"-Xmx2G"
@ben-manes
ben-manes / getput_results_11.json
Last active May 30, 2024 22:21
Get/Put JMH Results
[
{
"jmhVersion" : "1.37",
"benchmark" : "com.github.benmanes.caffeine.cache.GetPutBenchmark.read_only",
"mode" : "thrpt",
"threads" : 8,
"forks" : 1,
"jvm" : "/usr/lib/jvm/temurin-11-jdk-amd64/bin/java",
"jvmArgs" : [
"-Xmx2G"
@ben-manes
ben-manes / caffeine-cla.md
Created October 11, 2020 09:13
Caffeine CLA

Caffeine's CLA is directly based on the Apache Software Foundation's, where "Foundation" is replaced with "Caffeine project". Please see their website regarding any questions, https://www.apache.org/licenses/contributor-agreements.html


Thank you for your interest in the Caffeine project. In order to clarify the intellectual property license granted with Contributions from any person or entity, the Caffeine project must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Caffeine project and its users; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and sign this Agreement. Please read this document carefully before signing and keep a copy for your records.

You accept and agree to the following terms and conditions for Your present and future Co

/* Copyright 2016 LoadDocs */
package co.loaddocs.service.document.upload;
import static org.bytedeco.javacpp.opencv_core.CV_32F;
import static org.bytedeco.javacpp.opencv_imgcodecs.IMREAD_GRAYSCALE;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvLoadImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.imread;
import static org.bytedeco.javacpp.opencv_imgcodecs.imwrite;
import static org.bytedeco.javacpp.opencv_imgproc.warpPerspective;
@ben-manes
ben-manes / Stresser.java
Last active December 8, 2019 00:32
Stresser
import static java.util.concurrent.TimeUnit.SECONDS;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import com.google.common.cache.Cache;
@ben-manes
ben-manes / HttpPort.java
Created July 12, 2015 18:40
Jetty module
/**
* A qualifier for the server http port.
*
* @author ben.manes@gmail.com (Ben Manes)
*/
@BindingAnnotation
@Retention(RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
public @interface HttpPort {}
@ben-manes
ben-manes / ApiOriginFilter.java
Last active August 11, 2017 07:13
Swagger 1.5.1-M1 + RestEasy 3.x + Guice 4
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
public final class FinalizeBenchmark extends Benchmark {
public int timeFinalize(int reps) {
int dummy = 0;
for (int i = 0; i < reps; i++) {
Object o = new Object() {
@Override protected void finalize() {
toString();
}
};
23:36:18.125 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
23:36:18.129 [main] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Connecting to database for operation 'getMetaData'
23:36:18.132 [main] DEBUG c.g.f.c.dbsupport.DbSupportFactory - Database: H2 1.3
23:36:18.134 [main] DEBUG com.googlecode.flyway.core.Flyway - DDL Transactions Supported: false
23:36:18.134 [main] DEBUG com.googlecode.flyway.core.Flyway - Schema: file_vault
23:36:18.139 [main] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'setAutoCommit'
23:36:18.139 [main] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'prepareStatement'
23:36:18.141 [main] DEBUG c.g.flyway.core.command.DbSchemas - Schema "file_vault" already exists. Skipping schema creation.
23:36:18.141 [main] DEBUG o.s.j.d.LazyConnectionDataSourceProxy - Using existing database connection for operation 'commit'
23:36:18.142 [main] DEBUG o.s.j.
/**
* A validator to verify that the jOOQ generated tables match the database table metadata.
*
* @author Ben Manes (ben@addepar.com)
*/
final class SchemaValidator {
private static final Logger logger = LoggerFactory.getLogger(SchemaValidator.class);
private final List<Schema> schemas;
private final DSLContext db;