Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Fox purplefox

View GitHub Profile
View foo.java
package scratch;
import java.util.HashMap;
import java.util.Map;
public class StartsWithPerf {
public static void main(String[] args) {
try {
new StartsWithPerf().go();
View Main.java
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
public class Main {
public static void main(String[] args) {
try {
new Main().doIt();
View InternalEndpointHandler.java
/*
* Copyright 2020 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.confluent.io/confluent-community-license
*
* Unless required by applicable law or agreed to in writing, software
View curl1.txt
Tim-Foxs-MBP15:json_request tfox$ curl -X POST http://localhost:8088/query -H "Content-Type: application/json" -d '{
"ksql": "SELECT * FROM riderLocations WHERE GEO_DISTANCE(latitude, longitude, 37.4133, -122.1162) <= 5 EMIT CHANGES;",
"streamsProperties": {
"ksql.streams.auto.offset.reset": "earliest"
}
}'
[{"header":{"queryId":"none","schema":"`ROWKEY` STRING, `PROFILEID` STRING, `LATITUDE` DOUBLE, `LONGITUDE` DOUBLE"}},
{"row":{"columns":["4ab5cbad","4ab5cbad",37.3952,-122.0813]}},
{"row":{"columns":["8b6eae59","8b6eae59",37.3944,-122.0813]}},
{"row":{"columns":["4a7c7b41","4a7c7b41",37.4049,-122.0822]}},
View output.txt
(base) Tim-Foxs-MBP15:json_request tfox$ python pyreq.py
query
<Response [200]>
b'['
b'{'
b'"'
b'h'
b'e'
b'a'
b'd'
View test.java
public class Http2NoTlsTest {
@Test
public void testHttp2NoTls() throws Exception {
Vertx vertx = Vertx.vertx();
HttpServer server =
vertx.createHttpServer(new HttpServerOptions());
View foo.java
public <T> T deserialiseObject(final Buffer buffer, final HttpServerResponse response,
final Class<T> clazz) {
final ObjectMapper objectMapper = DatabindCodec.mapper();
try {
final T t = objectMapper.readValue(buffer.getBytes(), clazz);
} catch (UnrecognizedPropertyException e) {
sendUnrecognisedPropertyError(e.getPropertyName(), response);
return null;
} catch (MismatchedInputException e) {
final int startIndex = e.getMessage().indexOf('\'');
View Benchmark.java
/*
* Copyright 2018 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.confluent.io/confluent-community-license
*
* Unless required by applicable law or agreed to in writing, software
View Benchmark.java
/*
* Copyright 2018 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.confluent.io/confluent-community-license
*
* Unless required by applicable law or agreed to in writing, software
View Benchmark.java
/*
* Copyright 2018 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.confluent.io/confluent-community-license
*
* Unless required by applicable law or agreed to in writing, software
You can’t perform that action at this time.