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
'use strict'; | |
// Adds a timestamp to the LAST_MODIFIED_COLUMN whenever the value of any of the preceding columns has changed. | |
// Deletes the timestamp if all preceding columns are blank. | |
function onEdit(e) { | |
if (!e) { | |
throw new Error('Please do not run the script in the script editor window. It runs automatically when you edit the spreadsheet.'); | |
} | |
const row = e.range.getRow(); | |
const col = e.range.getColumn(); |
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
set nocompatible | |
set hidden " Hide buffers rather than close them | |
set confirm | |
set encoding=utf-8 | |
set showcmd " display incomplete commands | |
set number " show line numbers | |
set wrap linebreak nolist " wrap lines | |
set cursorline " highlight current row | |
set cursorcolumn " highlight current column | |
"set tags=tags |
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 python3 | |
import argparse | |
import boto3 | |
# Cleanup misc AWS resources | |
# NOTE: this script does not currently handle pagination | |
def get_regions(): | |
ec2 = boto3.client("ec2") |
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
"""Put ECS Instances in DRAINING state so that all ECS Tasks running on them are migrated to other Instances. | |
Batches into chunks of 10 because of AWS api limitations (An error occurred InvalidParameterException when | |
calling the UpdateContainerInstancesState operation: instanceIds can have at most 10 items) | |
""" | |
def put_container_instances_in_draining_state(ecs_client, cluster_name, container_instance_arns): | |
batch_size = 10 | |
n_batches = math.ceil(len(container_instance_arns)/batch_size) | |
for i in range(0, len(container_instance_arns), batch_size): | |
logger.info('Putting batch %d/%d of container instances %s in cluster %s into DRAINING state', i+1, n_batches, container_instance_arns, cluster_name) | |
ecs_client.update_container_instances_state(cluster=cluster_name, containerInstances=container_instance_arns[i:i + batch_size], status='DRAINING') |
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
# Lambda function to subscribe all new cloudwatch log groups to a log shipper function | |
# Used in conjunction with https://github.com/SumoLogic/sumologic-aws-lambda | |
import os | |
import logging | |
import json | |
import uuid | |
import boto3 | |
from botocore.exceptions import ClientError |
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
- hosts: "*" | |
become: True | |
serial: 1 | |
tasks: | |
- name: Initiate graceful shutdown | |
shell: "nodetool {{item}} && sleep 5" | |
with_items: | |
- disablethrift | |
- disablebinary | |
- disablegossip |
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
sh ‘’’#!/bin/bash -l | |
cp do_image.txt pipeline/testing | |
cd pipeline/testing | |
terraform apply \\ | |
-var do_image=\”\$(<do_image.txt)\” \\ | |
-var do_token=\”\${DO_TOKEN}\” \\ | |
-var ssh_fingerprint=\”\${SSH_FINGERPRINT}\” | |
terraform show terraform.tfstate \\ | |
| grep ipv4_address | awk \”{print \$3}\” > ../../do_ip.txt | |
‘’’ |
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
# Quick script to configure routes for a VPC peering connection | |
# Searches a region for all peering connection and prompts to choose one | |
# Configures routes between the peered networks for all routing tables | |
# STS/AssumeRole not implemented cross-account peering. Instead, | |
# Choose accepter/requestor depending on which credentials are set in the environment | |
# Enter either IPv4 and IPv6 route destinations | |
# Example usage: | |
# ( Assuming boto credentials are configured) | |
# $ pip install boto3 | |
# $ python3.6 peer_routes.py |
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
{ | |
"Version": "2012-10-17", | |
"Id": "cassandra-key-policy", | |
"Statement": [ | |
{ | |
"Sid": "Enable IAM User Permissions", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::09876512345:root" | |
}, |
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 | |
$db = $1 | |
for logfile in $(aws rds describe-db-log-files --db-instance-identifier $db | jq '.DescribeDBLogFiles|.[]|.LogFileName') | |
do | |
aws rds download-db-log-file-portion --db-instance-identifier $db --log-file-name ${logfile} --starting-token 0 --output text >> $db-logs.txt | |
done |
NewerOlder