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 | |
| # | |
| # Updates docker-compose to the latest release | |
| # | |
| # Author: Emiliano Gabrielli <albert@faktiva.com> | |
| DESTINATION_FILE="${DESTINATION_FILE:-$(command -v docker-compose)}" | |
| set -e -o pipefail |
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
| # Automated AMI and Snapshot Deletion | |
| # | |
| # @author Robert Kozora <bobby@kozora.me> | |
| # | |
| # This script will search for all instances having a tag with "Backup" or "backup" | |
| # on it. As soon as we have the instances list, we loop through each instance | |
| # and reference the AMIs of that instance. We check that the latest daily backup | |
| # succeeded then we store every image that's reached its DeleteOn tag's date for | |
| # deletion. We then loop through the AMIs, deregister them and remove all the | |
| # snapshots associated with that AMI. |
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
| # Automated AMI Backups | |
| # | |
| # @author Robert Kozora <bobby@kozora.me> | |
| # | |
| # This script will search for all instances having a tag with "Backup" or "backup" | |
| # on it. As soon as we have the instances list, we loop through each instance | |
| # and create an AMI of it. Also, it will look for a "Retention" tag key which | |
| # will be used as a retention policy number in days. If there is no tag with | |
| # that name, it will use a 7 days default value for each AMI. | |
| # |
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 bash | |
| CONF_DIR="/etc/nginx/sites-enabled" | |
| OLD_DEFAULT="default" | |
| NEW_DEFAULT="api" | |
| # remove old default | |
| sed -i'' -e 's/\s*default_server\s*//' "${CONF_DIR}/${OLD_DEFAULT}" | |
| # set new default |
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 requests | |
| import json | |
| import datetime, time | |
| NEWRELIC_API_KEY = "YOUR_KEY_HERE" | |
| HOURS_TO_KEEP = 6 | |
| HEADERS = {"X-Api-Key": NEWRELIC_API_KEY} | |
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 boto3 | |
| def role_arn_to_session(**args): | |
| """ | |
| Usage : | |
| session = role_arn_to_session( | |
| RoleArn='arn:aws:iam::012345678901:role/example-role', | |
| RoleSessionName='ExampleSessionName') | |
| client = session.client('sqs') | |
| """ |
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 | |
| # | |
| # Ansible role test shim. | |
| # | |
| # Usage: [OPTIONS] ./tests/test.sh | |
| # - distro: a supported Docker distro version (default = "centos7") | |
| # - playbook: a playbook in the tests directory (default = "test.yml") | |
| # - cleanup: whether to remove the Docker container (default = true) | |
| # - container_id: the --name to set for the container (default = timestamp) | |
| # - test_idempotence: whether to test playbook's idempotence (default = true) |
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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "AllowAllUsersToListAccountAliases", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "iam:ListAccountAliases" | |
| ], | |
| "Resource": [ |
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 bash | |
| # | |
| # Quick script to automatically update git submodules on checkout. | |
| # Save it in the repo `.git/hooks` dir and make it executable | |
| #echo "post-checkout hook: '$1' '$2' '$3'" | |
| oldRef=$1 | |
| newRef=$2 |
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 | |
| # A shell script to help getting SAML credentials into `~/.aws/credentials` | |
| # Login URL https://sts.asdasd.com/adfs/ls/idpinitiatedsignon.aspx?loginToRp=urn:amazon:webservices | |
| LSE_AWS_ACCOUNT=0123456789 | |
| LSE_AWS_ROLE="asdasdasd-role" | |
| LSE_AWS_PROFILE="asdasd-saml" | |
| LSE_SAML_PROVIDER="STS.ASDASD.COM" | |
| LSE_SAML_RESPONSE="PHNhbWxwOlJlc3 [..] vbnNlPg==" |