This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "day7" | |
version = "0.1.0" | |
authors = ["Matthew Tran <[email protected]>"] | |
edition = "2018" | |
[dev-dependencies] | |
criterion = "*" | |
[[bench]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function echoerr { echo "$@" 1>&2; } | |
function error_exit { echoerr "$1"; exit 1; } | |
if [ -z "${REGION}" ] ; then error_exit "No REGION set"; fi | |
command -v jq >/dev/null 2>&1 || error_exit "'jq' not found" | |
command -v aws >/dev/null 2>&1 || error_exit "'aws' not found" | |
command -v tee >/dev/null 2>&1 || error_exit "'tee' not found" | |
command -v ec2metadata >/dev/null 2>&1 || error_exit "'ec2metadata' not found" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import heapq | |
from threading import Lock | |
class HeapQueue(object): | |
def __init__(self, values=None, maxsize=None, reversed=False): | |
""" | |
Create a new heap queue. | |
- ``maxsize`` will create a capped queue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(erlhmac). | |
-export([hmac/4]). | |
hmac(Key, Message, Hash, BlockSize) when byte_size(Key) > BlockSize -> | |
hmac(Hash(Key), Message, Hash, BlockSize); | |
hmac(Key, Message, Hash, BlockSize) when byte_size(Key) < BlockSize -> | |
hmac(<<Key/binary, | |
(binary:copy(<<0>>, BlockSize - byte_size(Key)))/binary>>, | |
Message, Hash, BlockSize); |