Skip to content

Instantly share code, notes, and snippets.

@sebmaynard
sebmaynard / ca_cowboy_middleware.erl
Created June 10, 2013 08:42
A Cowboy middleware to set some CORS headers for every request, and to handle OPTIONS requests without needing to implement them in every handler.
-module(ca_cowboy_middleware).
-behaviour(cowboy_middleware).
-export([execute/2]).
execute(Req, Env) ->
{ok, ReqWithCorsHeaders} = set_cors_headers(Req),
{Method, ReqMethod} = cowboy_req:method(ReqWithCorsHeaders),
@sebmaynard
sebmaynard / create_dns_records.sh
Created March 7, 2019 16:36
Create dns records on route53 from a text file
#!/bin/bash -e
usage() {
echo "Need a hosted zone name (abc.com.) with the dot on the end"
exit 1
}
HOSTED_ZONE_NAME=$1
if [[ "$HOSTED_ZONE_NAME" == "" ]] ; then
usage
@sebmaynard
sebmaynard / bookmarklet.js
Last active October 3, 2022 18:09
Evernote HTML Editor
/*
Copyright 2015 Seb Maynard
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