Skip to content

Instantly share code, notes, and snippets.

View neilstuartcraig's full-sized avatar

Neil Craig neilstuartcraig

View GitHub Profile
@neilstuartcraig
neilstuartcraig / caddy-debian-9-sysd-service-file
Created July 20, 2017 21:27
A basic Caddy / Debian 9 (Stretch) System D service file
[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target
[Service]
Restart=on-failure
StartLimitInterval=0
StartLimitBurst=0
@neilstuartcraig
neilstuartcraig / tdp-push-config-draft-1
Created July 20, 2017 12:53
TDP push config draft 1
# H2 push
# Needed on all pages:
push / {
/assets/css/reset.css?v=1
/assets/images/twitter.svg
/assets/images/github.svg
/assets/css/generics.css?v=1
/assets/css/main-header.css?v=1
/assets/css/main-footer.css?v=1
}
@neilstuartcraig
neilstuartcraig / LetsEncrypt-HPKP-Jul-2017
Last active July 19, 2017 20:18
HPKP header for Let's Encrypt active & backup certs listed at https://letsencrypt.org/certificates/ - generated by https://hpkpcalc.github.io/calculator.html
Public-Key-Pins: pin-sha256="YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg="; pin-sha256="sRHdihwgkaib1P1gxX8HFszlD+7/gTfNvuAybgLPNis="; max-age=31536000
@neilstuartcraig
neilstuartcraig / nginx-boringssl-build-script-debian.sh
Last active April 4, 2024 23:39
This builds NGINX from source with BoringSSL for Debian (alike?) systems with systemd (e.g. Debian Jessie)
#!/bin/bash
LATESTNGINX="1.11.10"
BUILDROOT="/tmp/boring-nginx"
# Pre-req
sudo apt-get update
sudo apt-get upgrade -y
# Install deps
@neilstuartcraig
neilstuartcraig / node-https-post-example.js
Last active February 17, 2017 14:35
nodejs core https POST example - not working code!
// NOTE: This isn't working code, I rehashed it as an example from one of my projects
import https from "https";
const requestOptions =
{
// See https://nodejs.org/api/http.html#http_http_request_options_callback
};
const req = https.request(requestOptions, (res) =>
@neilstuartcraig
neilstuartcraig / compile-node-alpine.txt
Created October 17, 2016 21:10
Compiling Node.JS on Alpine Linux
apk update
apk install curl python build-base gcc abuild binutils binutils-doc gcc-doc linux-headers
curl -L -O https://nodejs.org/dist/v4.6.0/node-v4.6.0.tar.gz
tar xzf node-v4.6.0.tar.gz
cd node-v4.6.0
./configure
make
make install
{
"blockedURI": {
"http://static.bbci.co.uk": {
"0": 20,
"200": 1
},
"inline": {
"0": 8,
"200": 5
},
This file has been truncated, but you can view the full file.
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
"startedDateTime": "2016-05-27T11:43:56.762Z",
"use strict";
// Core deps
const path = require("path");
const fs = require("fs");
// Monolith PoC
let HARFile = path.join(__dirname, "/data/har2.js");
fs.readFile(HARFile, (err, data) =>
{
@neilstuartcraig
neilstuartcraig / nginx vary header length patch
Created September 10, 2015 20:52
nginx vary header length patch
--- a/src/http/ngx_http_cache.h 2015-06-05 15:10:36.000000000 +0100
+++ b/src/http/ngx_http_cache.h 2015-06-05 15:16:21.000000000 +0100
@@ -25,7 +25,7 @@
#define NGX_HTTP_CACHE_KEY_LEN 16
#define NGX_HTTP_CACHE_ETAG_LEN 42
-#define NGX_HTTP_CACHE_VARY_LEN 42
+#define NGX_HTTP_CACHE_VARY_LEN 4096
#define NGX_HTTP_CACHE_VERSION 3