Skip to content

Instantly share code, notes, and snippets.

View nealeu's full-sized avatar

Neale Upstone nealeu

  • Wormhole Technology Ltd
  • Cambridge, UK
View GitHub Profile
nealeu / build.gradle
Created June 12, 2024 07:59
Parallel sourceset for Gradle Groovy build avoidance
sourceSets {
testWip {
groovy {
srcDirs = ['src/test/groovyWip']
compileClasspath = sourceSets.test.compileClasspath + sourceSets.main.compileClasspath
runtimeClasspath = sourceSets.test.runtimeClasspath + sourceSets.main.runtimeClasspath
nealeu /
Created June 6, 2024 13:05
Setting log level for com.mongodb.internal.diagnostics.logging.SLF4JLogger doesn't work


Running with Spring Boot, I get logs like this

c.m.i.d.l.SLF4JLogger : Command "insert" started on database "test" using a connection with driver-generated ID 3 and server-generated ID 13 to localhost:32795. The request ID is 13 and the operation ID is 11. Command: {"insert": "jobExecution", "ordered": true, "txnNumber": 1, "$db": "test", "$clusterTime": {"clusterTime": {"$timestamp": ...}

where c.m.i.d.l.SLF4JLogger refers to com.mongodb.internal.diagnostics.logging.SLF4JLogger.

I want to disable this logging, but if I change log4j2.xml to add:

nealeu / docker-compose.yml
Last active August 22, 2019 09:36
Fake for GCP images with docker-compose
version: "3"
image: nginx:alpine
- ./metadata-db0:/usr/share/nginx/html:ro
command: [nginx-debug, '-g', 'daemon off;']
let dynamoDb = new AWS.DynamoDB.DocumentClient(dynamoParams);
if (process.env.XRAY_DYNAMO) {
const AWSXRay = require("aws-xray-sdk-core");
if (process.env.IS_OFFLINE) {
AWS = AWSXRay.captureAWS(AWS);
dynamoDb = AWSXRay.captureAWSClient(dynamoDb);
nealeu / bitbucket-pipelines.yml
Last active June 17, 2019 10:14
Check commits contain reference to tickets on Bitbucket/Shippable branch
- step:
- npm ci
- npm run lint
- npm test
# == Check that all commits since the base branch (dev) contain ACME- for ticket reference ==
# Fetch the merge base for our project
nealeu /
Created February 6, 2019 11:01
Spring Framework caching of Etagged responses
public void findGlobalConfig(WebRequest request, HttpServletResponse response) throws IOException {
// Optionally String myCacheKey = buildKey(params)
request, response,
"myCacheName", "myCacheKey", 3600,
() -> {
return expensiveToBuildAndSerialize();
nealeu / OpenRTB.http
Created January 8, 2019 13:37
An example OpenRTB request used when testing adapter on prebid-server
# For a quick start check out IDEA's HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection).
POST http://localhost:8000/openrtb2/auction
Content-Type: application/json
"id": "must be string",
"imp": [
"id": "test-imp-id",
nealeu / acme-widget
Created January 3, 2019 20:42
Independent go projects with dep
# To start using a project or working for a given client I'll type the client or project name, and I'll have an
# alias defined in .profile to run this (so that I actually end up in the directory that this file cd's to)
# alias 'acme-widget=source $HOME/bin/acme-widget'
cd $GOPATH/src/widget
# widget is the project directory as cloned from source control
nealeu / react-async.d.ts
Last active November 8, 2018 01:21
Typescript typings for react-async
declare module "react-async" {
import {ComponentType, ReactNode} from "react";
import * as React from "react";
export interface LoadingProps<V> {
/** Show only on initial load (data is undefined) */
initial?: boolean;
/** Function (passing state) or React node */
children: ReactNode | ((state: State<V>) => ReactNode);
nealeu / ConfigurableAccessTokenConverter
Last active June 19, 2017 21:34
JWK for Auth0 (and prob enough for Okta too)
public class ConfigurableAccessTokenConverter extends DefaultAccessTokenConverter {
public ConfigurableAccessTokenConverter(String usernameAttributeKey) {
setUserTokenConverter(new DefaultUserAuthenticationConverter() {
public Authentication extractAuthentication(Map<String, ?> map) {
if (map.containsKey(usernameAttributeKey)) {