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
<!DOCTYPE html> | |
<!--[if lte IE 6]><html class="preIE7 preIE8 preIE9"><![endif]--> | |
<!--[if IE 7]><html class="preIE8 preIE9"><![endif]--> | |
<!--[if IE 8]><html class="preIE9"><![endif]--> | |
<!--[if gte IE 9]><!--><html><!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>title</title> |
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
# Gets latest aws linux ami published by amazon | |
# Example use with an optional var: | |
# ${upper(var.ami) == "NONE" ? data.aws_ami.default.id : var.ami} | |
data "aws_ami" "default" { | |
most_recent = true | |
filter { | |
name = "name" | |
values = ["amzn-ami-*-x86_64-gp2"] | |
} | |
filter { |
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 time | |
def timeit(method): | |
""" | |
Decorator useful for timing functions. | |
Source: https://medium.com/pythonhive/python-decorator-to-measure-the-execution-time-of-methods-fa04cb6bb36d | |
Usage: | |
@timeit | |
def my_function(): |
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
def print_table(data, column_order=None): | |
""" Pretty print a list of dictionaries (data) as a dynamically sized table. | |
If column names (column_order) aren't specified, they will show in random order. | |
Author: Thierry Husson - Use it as you want but don't blame me. | |
Source: https://stackoverflow.com/questions/17330139/python-printing-a-dictionary-as-a-horizontal-table-with-headers | |
PEP8ed by: mijdavis2 | |
""" | |
if not column_order: | |
column_order = list(data[0].keys() if data else []) | |
l = [column_order] # 1st row = header |
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
""" | |
Note: Found somewhere on Stack Overflow but was unable to find again. | |
If found, please comment and I will update this gist with the source. | |
""" | |
def threadwrap(func, args, kwargs): | |
class res(object): | |
result = None | |
def inner(*args, **kwargs): | |
res.result = func(*args, **kwargs) |
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
data "aws_availability_zones" "available" {} | |
# Assuming we vars for list of private_subnet_ids and or public_subnet_ids | |
# we take a slice of available AZs. | |
# | |
# Add or remove private/public vars when necessary. | |
locals { | |
available_azs = "${ | |
slice( | |
data.aws_availability_zones.available.names, |
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
#!/bin/bash | |
PROFILE=${AWS_PROFILE:-default} | |
TAG=${TAG:-Name} | |
STATE=${STATE:-running} | |
aws ec2 --profile ${PROFILE} describe-instances \ | |
--filters Name=instance-state-name,Values=${STATE} | \ | |
jq .Reservations[].Instances[].Tags | \ | |
jq -c ".[] | select(.Key | contains(\"${TAG}\"))" | \ |
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/fish | |
# Name allows for "." | |
# so might as well use full domain minus the "*" | |
# if you are using a wildcard cert... | |
# | |
# But you should at least use one subdomain if you wildcard | |
# ...for security... just sayin. | |
# Using absolute path is more reliable. |
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
#!/bin/bash | |
# | |
# To add this as a fish function: | |
# function dockercleanup | |
# docker volume rm (docker volume ls -f dangling=true -q); docker system prune -a | |
# end | |
# funcsave dockercleanup | |
# |
OlderNewer