This file contains hidden or 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 | |
# Colors and styles | |
BOLD='\033[1m' | |
DIM='\033[2m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[0;33m' | |
RED='\033[0;31m' | |
BLUE='\033[0;34m' | |
CYAN='\033[0;36m' |
This file contains hidden or 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
################## | |
# Install Terraform with tfenv | |
# Ref: https://github.com/GoogleCloudPlatform/terraformer#installation | |
# For macOS with Homebrew: brew install tfenv | |
############################# | |
git clone https://github.com/tfutils/tfenv.git ~/.tfenv | |
export PATH="$HOME/.tfenv/bin:$PATH" | |
echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bashrc | |
# install Terraform | |
tfenv install latest |
This file contains hidden or 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
variable "records" { | |
description = "Cloudflare DNS zone records" | |
type = set(object({ | |
tf_obj_id = string # tf key used to organize records | |
name = string | |
proxied = bool | |
value = string | |
priority = number | |
ttl = number | |
type = string |
This file contains hidden or 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
# Run Script to fetch monitors | |
# -------------------------------------- | |
# WORKSPACE=$(terraform workspace show) | |
# [[ -d "./tfvars" ]] && VAR_DEFS_PATH="./tfvars" | |
# [[ -d ".././tfvars" ]] && VAR_DEFS_PATH=".././tfvars" | |
# [[ -z "$VAR_DEFS_PATH" ]] && { echo 'VAR_DEFS_PATH not specified. Aborting' >&2 ; exit 1; } | |
# DD_API_KEY="$(awk -F'"' '/dd_api_key/{ print $2 }' $VAR_DEFS_PATH/$WORKSPACE.secret.tfvars)" | |
# DD_APP_KEY="$(awk -F'"' '/dd_app_key/{ print $2 }' $VAR_DEFS_PATH/$WORKSPACE.secret.tfvars)" | |
# [[ -z "$DD_API_KEY" ]] && { echo 'DD_API_KEY not specified. Aborting' >&2 ; exit 1; } | |
# [[ -z "$DD_APP_KEY" ]] && { echo 'DD_APP_KEY not specified. Aborting' >&2 ; exit 1; } |
This file contains hidden or 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 python | |
import argparse | |
import configparser | |
from shutil import which | |
import subprocess | |
import sys | |
import os | |
CONFIG_PATH = os.path.expanduser("~/.aws/config") |
This file contains hidden or 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 | |
ecr_url="<account id>.dkr.ecr.<region>.amazonaws.com" | |
# set username, password, and organization | |
dockerhub_username="<user>" | |
dockerhub_password="<password>" | |
dockerhub_organization="<org>" | |
dockerhub_api_url="https://hub.docker.com/v2" | |
dockerhub_token=$(curl -s -H "Content-Type: application/json" -X POST -d \ |
This file contains hidden or 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
apiVersion: batch/v1beta1 | |
kind: CronJob | |
metadata: | |
name: script | |
spec: | |
schedule: "*/2 * * * *" | |
jobTemplate: | |
spec: | |
template: |
This file contains hidden or 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
# return my IP addresses | |
function myip() { | |
ExtIP=`dig TXT +short o-o.myaddr.l.google.com @ns1.google.com` | |
echo $ExtIP | tr -d '"' | awk '{print "external : " $1}' | |
ifconfig lo0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "lo0 : " $2}' | |
ifconfig en0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en0 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}' | |
ifconfig en0 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en0 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}' | |
ifconfig en1 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en1 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}' | |
ifconfig en1 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en1 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}' | |
} |
This file contains hidden or 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 os | |
from pulumi import get_stack, get_project # so that each resource has a project & staging/dev... in AWS console | |
import pulumi_mongodbatlas as mongodbatlas | |
ACCOUNT_ID = os.environ["ACCOUNT_ID"] | |
ATLAS_PROJECT_ID = os.environ["ATLAS_PROJECT_ID"] | |
my_func_role_arn = f"arn:aws:iam::{ACCOUNT_ID}:role/{get_project()}-{get_stack()}-my-func-iam-role" | |
lambda_cloud_provider_access = mongodbatlas.CloudProviderAccess( |
This file contains hidden or 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 python3 | |
""" | |
A utility to stream records from one or many S3 Inventory reports, with a progress bar. | |
./parse-inventory-progress s3://my-bucket/path/to/my/inventory/2019-12-15T00-00Z/manifest.json > out.csv | |
""" | |
import json | |
import csv | |
import gzip | |
import sys |
NewerOlder