Skip to content

Instantly share code, notes, and snippets.

@quells
quells / boox-dns-blacklist
Created July 1, 2021 15:29
Pi-Hole Blacklist for BOOX devices
# Copied from https://github.com/StevenBlack/hosts
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 local
255.255.255.255 broadcasthost
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe80::1%lo0 localhost
@quells
quells / ubnt-dns-blacklist
Created April 16, 2021 23:04
Pi-Hole Blacklist for UniFi/Ubiquiti Devices
# Copied from https://github.com/StevenBlack/hosts
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 local
255.255.255.255 broadcasthost
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe80::1%lo0 localhost
@quells
quells / pihole-unbound.docker-compose.yml
Last active April 2, 2021 23:23
Pi-Hole + Unbound Docker Compose Script
version: "3"
networks:
dns_net:
driver: bridge
ipam:
config:
- subnet: 172.31.41.0/24
services:
@quells
quells / tiny-ca.sh
Created February 8, 2021 16:51
Tiny certificate authority for LAN
#!/bin/bash
# Based on https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
if [ "$#" -ne 1 ]; then
echo "Usage: tiny-ca.sh <domain>"
exit 1
fi
DOMAIN=$1
@quells
quells / unifi-docker.makefile
Created September 18, 2020 15:46
Run UniFi Controller in a Docker container
DATA = $(shell pwd)/data
LOGS = $(shell pwd)/logs
TZ = America/Los_Angeles
NAME = unifi
IMAGE = jacobalberty/unifi:stable
.PHONY: run
run:
docker run -d --rm --init \
@quells
quells / rex.go
Last active November 22, 2019 06:42
Basic Go HTTP helper
package rex
import (
"bytes"
"net/http"
"strings"
"time"
)
type Request struct {
@quells
quells / cache.java
Created November 17, 2019 21:36
Very simple in-memory thread safe cache
package me.kaiwells.cache;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.lang3.SerializationUtils;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.Instant;
@quells
quells / gist:95e7ed235abd98dae64a2cef0ea16b0a
Created September 14, 2017 17:35
Javascript Performance Notes
2.4 ns per bit shift
6.3 ns per multiply by 2
25 ns per == comparison
2 ns per === comparison
45 ns per parseInt
2 ns per Math.floor
// both work as array indices
package chanSpeed
import (
"fmt"
"sync"
"testing"
"unsafe"
)
func BenchmarkChannelOneByte(b *testing.B) {
//: # Brent's "Secret Projects Diary #2"
import Foundation
//: ## Feeds
protocol Feed: Equatable {
var url: String {get}
}
class LocalFeed: Feed {
var url: String
init(url: String) {