Skip to content

Instantly share code, notes, and snippets.

@craigforr
craigforr / terraform_bash_completion.sh
Created November 5, 2020 21:31 — forked from zish/terraform_bash_completion.sh
Better Terraform Bash Completion
# Bash Terraform completion
# Originally adapted from: https://gist.github.com/cornfeedhobo/8bc08747ec3add1fc5adb2edb7cd68d3
#
# Author: Jeremy Melanson
#
# Features of this update:
# - Use built-in bash routines for text processing, instead of external tools (awk, sed, grep, ...).
# - fixes the retrieval of options from the Terraform executble.
# - Optional _init_terraform_completion function, which can enable command-completion for multiple Terraform executables.
#
@craigforr
craigforr / efs_targets.j2
Created December 15, 2020 01:45 — forked from halberom/efs_targets.j2
ansible - example of using lookup and a template to generate dynamic list entries for modules
#jinja2:trim_blocks: True, lstrip_blocks: True
targets:
{% for privnet in all_private_subnets %}
- subnet_id: "{{ privnet }}"
security_groups: [ "{{ sg.group_id }}" ]
{% endfor %}
{% for pubnet in all_public_subnets %}
- subnet_id: "{{ pubnet }}"
security_groups: [ "{{ sg.group_id }}" ]
{% endfor %}
@craigforr
craigforr / tmux.conf
Created February 18, 2021 17:03 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@craigforr
craigforr / world-date.sh
Last active August 31, 2021 15:55
BASH Script to display dates and times for any world time zone
#!/bin/sh
# Show date and time in other time zones
# Source: python - command-line world clock? - Stack Overflow
# https://stackoverflow.com/questions/370075/command-line-world-clock
function world_date(){
if [ "$1"x != 'x' ]; then
search=$1
else
@craigforr
craigforr / create-azure-service-principal-contrib.sh
Last active December 14, 2021 15:37
Bash script to create an Azure AD service principal with Contributor role using Azure CLI
#!/usr/bin/env bash
SCRIPT_NAME='create-azure-service-principal-contrib.sh'
SCRIPT_DESCRIPTION='Creates an Azure AD service principal with Contributor rights'
SCRIPT_VERSION='1.2.2'
# Related documentation:
# - https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli
function display_usage() {