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 | |
# Make sure /contents is writable, might want to change that. | |
# I used this script in a docker container so was not cencerned with dir layout | |
set -Eeuo pipefail | |
UBUNTU_ISO="image/ubuntu.iso" | |
USER_DATA="cloud-init/user-data.yaml" | |
META_FILE="cloud-init/meta-data.yaml" |
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 -ex | |
# | |
# Make sure to provide the Terraform template variables between ${} | |
# | |
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
# Function to insert a line after a match | |
insert_after() { |
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 | |
set -Eeuo pipefail | |
hosts_file="/etc/hosts" | |
hosts=( | |
"www.reddit.com" | |
"twitter.com" | |
"www.nrc.nl" | |
"www.theguardian.com" |
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 | |
set -Eeuo pipefail | |
function format_time() { | |
start=$1 | |
end=$2 | |
elapsed=$((end - start)) |
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 | |
set -Eeuo pipefail | |
# Avoid `${{ context }}` expressions in your script directly, pass as env variables instead. | |
# | |
# Example: | |
# - name: Say hi | |
# env: | |
# NAME: "${{ github.actor }}" |
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 | |
# Find all github workflows in all repositories under the current directory and update actions to the latest major version. | |
# Optionally suply workflow file as first argument to update single repo. | |
# | |
# Dependabot would be better for this I know. This is just a quick and dirty solution. | |
set -Eeuo pipefail | |
update_workflow() { |
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 | |
# | |
# Git hook to enfore formatting Terraform and Terragrunt files | |
# Quick to setup and free of dependencies (outside of Terraform and Terragrunt) | |
# | |
# How to install: | |
# Assuming you save this script under 'scripts/pre-commit.sh' | |
# From the root of your repo, run: | |
# chmod +x scripts/pre-commit.sh |