Skip to content

Instantly share code, notes, and snippets.

Adrian Hesketh a-h

Block or report user

Report or block a-h

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
a-h / disablecaching.go
Created Aug 20, 2019
Disable caching and sniffing via HTTP headers
View disablecaching.go
func DisableCachingAndSniffing(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate;")
w.Header().Set("pragma", "no-cache")
w.Header().Set("X-Content-Type-Options", "nosniff")
next.ServeHTTP(w, r)
View on.json

Keybase proof

I hereby claim:

  • I am a-h on github.
  • I am adrianhesketh ( on keybase.
  • I have a public key whose fingerprint is 0227 7F96 9055 ACF7 36CE 8954 9E01 3872 2232 3123

To claim this, I am signing this object:

a-h / esp32_audio.ino
Created Mar 17, 2019
ESP32 DAC square wave
View esp32_audio.ino
#include <U8x8lib.h>
U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/15, /* data=*/4, /* reset=*/16);
// Timer setup.
volatile int interruptCounter;
volatile int totalInterruptCounter;
hw_timer_t *timer = NULL;
a-h / lambda.js
Created Feb 5, 2019
Lambda@Edge to carry out redirects and apply default documents (index.html) to incoming requests
View lambda.js
var path = require('path');
const redirects = {
"/about-us": { to: "/about", statusCode: 301 },
"/contact-us/head-office": { to: "/contact/head-office", statusCode: 302 },
exports.handler = async event => {
const { request } = event.Records[0].cf;
const normalisedUri = normalise(request.uri);
a-h / redirect.yaml
Created Feb 5, 2019
Apex redirect handling using AWS Network and Application Load Balancers
View redirect.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: Sets up the required resources for the website at
Type: String
Description: The website domain name.
Type: String
a-h /
Created Jan 31, 2019
Security vulnerability tracking

What you wanted to do

Check that my program is free from known security vulnerabilities.

For example, if a package I'm using has a security vulnerability in it, I want to be notified to upgrade or warned.

What you actually did

Checked the for Go related issues, but found that only core packages were listed. I noticed that some packages had vulnerabilities listed (e.g. but couldn't work out how to find them programatically. I wrote a program to scan the NIST database for Go language related vulnerabilities and to let me know anyway -

a-h / main.go
Created Dec 21, 2018
Circle CI AWS Credentials Cycling
View main.go
package main
import (
a-h / 01_nodemcu.ino
Last active Nov 11, 2018
Updated door sensor
View 01_nodemcu.ino
#include <WiFiServerSecure.h>
#include <WiFiClientSecure.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiUdp.h>
#include <ESP8266WiFiType.h>
#include <ESP8266WiFiAP.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <ESP8266WiFiScan.h>
You can’t perform that action at this time.