Skip to content

Instantly share code, notes, and snippets.

View DanielThomas's full-sized avatar

Danny Thomas DanielThomas

View GitHub Profile
@DanielThomas
DanielThomas / HashIndexTest.java
Last active March 25, 2024 22:26
Tests for HashIndex.java
/*
* Copyright 2024 Netflix Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@DanielThomas
DanielThomas / HashIndex.java
Last active March 26, 2024 03:37
A hash index for primitive numeric values in Java using a twin prime, double hashed hash table
/*
* Copyright 2024 Netflix Inc.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@DanielThomas
DanielThomas / npm-registry.vcl
Created February 19, 2021 01:19
Varnish Plus configuration for public NPM registry
vcl 4.1;
import edgestash;
import goto;
import xbody;
backend default none;
sub vcl_init {
new registry = goto.dns_director("https://registry.npmjs.org");
@DanielThomas
DanielThomas / docker_setup_vpn.sh
Created January 18, 2021 04:00
Docker for Mac M1 Preview VPN workaround
docker_setup_vpn () {
echo "## Previous Configuration"
sudo pfctl -a com.apple.internet-sharing/shared_v4 -s nat 2> /dev/null | tee /tmp/docker_vpn.conf
if sudo pfctl -a com.apple.internet-sharing/shared_v4 -s nat 2> /dev/null | grep 192.168.64.0 | grep -q utun2
then
echo && echo "Not applying change"
else
echo "nat on utun2 inet from 192.168.64.0/24 to any -> (utun2) extfilter ei" >> /tmp/docker_vpn.conf
sudo pfctl -a com.apple.internet-sharing/shared_v4 -N -f /tmp/docker_vpn.conf 2> /dev/null
echo && echo "## New Configuration"
@DanielThomas
DanielThomas / gradle-cache.vcl
Last active February 19, 2021 01:04
Varnish Cache Plus (Enterprise) configuration for Gradle HTTP Build Cache
vcl 4.1;
import purge;
import std;
import synthbackend;
sub vcl_recv {
if (req.method != "GET" && req.method != "PUT" && req.method != "DELETE") {
return (synth(405));
}
package com.netflix.lint.rule.nebula
import com.netflix.nebula.lint.FileMode
import com.netflix.nebula.lint.rule.GradleLintRule
import com.netflix.nebula.lint.rule.GradleModelAware
import org.codehaus.groovy.ast.ClassNode
import java.security.MessageDigest
import static java.nio.file.Files.isSymbolicLink
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.