Skip to content

Instantly share code, notes, and snippets.

@twoBoots
twoBoots / install.md
Created December 2, 2019 09:15
setup golang in X lines
  • install asdf version manager
  • add golang plugin
    asdf plugin-add golang
    
  • add asdf to bash profile (osx)
    echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
    echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
    
@twoBoots
twoBoots / gist:f514c28c584c146fc9d1dbae4591b8e2
Created November 13, 2019 00:48 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@twoBoots
twoBoots / keybase.md
Created October 1, 2019 05:37
I R twoBoots

Keybase proof

I hereby claim:

  • I am twoBoots on github.
  • I am twoboots (https://keybase.io/twoboots) on keybase.
  • I have a public key whose fingerprint is EBD6 C993 9040 7198 0848 7B2F 4038 F343 4DBD 674E

To claim this, I am signing this object:

@twoBoots
twoBoots / index.js
Created July 6, 2018 03:49
API Gateway HTTP basic auth using Lambda@Edge
exports.handler = (event, context, done) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
if(headers['edge-www-authenticate']) {
headers['www-authenticate'] = [{key: 'WWW-Authenticate', value: 'Basic realm="Secure Area"'}];
delete headers['edge-www-authenticate'];
}
done(null, response);
@twoBoots
twoBoots / letsencrypt_2017.md
Created August 1, 2017 01:52 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@twoBoots
twoBoots / .well-known-acme-challenge.js
Created January 23, 2017 02:22
API Gateway - Lambda - Lets Encrypt certificate rotation
"use strict";
exports.handler = (event, context, callback) => {
/*
1. lets-encrypt certbot
> ./certbot-auto certonly -a manual --rsa-key-size 2048 -d [domain]
>
>
>
2. paste the challenge string in the context.succeed response below