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 | |
| client = boto3.client('route53') | |
| def delete_zone(zone_id): | |
| """ List all records and deletes non SOA/NS records, before deleting the zone | |
| """ | |
| record_sets = client.list_resource_record_sets(HostedZoneId=zone_id) | |
| # print(record_sets) |
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 | |
| client = boto3.client('route53') | |
| def delete_zone(zone_id): | |
| """ Deleting a hosted zone in AWS is a real pain if you have any number of | |
| resource records defined because you must first delete all RR's in order to | |
| remove the zone. This is a one-stop script to do all of that in one command. | |
| """ |
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 | |
| set -euxo pipefail | |
| ALLOCATION_IDS=$(aws ec2 describe-addresses | jq -r '.Addresses[] | select(.AssociationId == null) | .AllocationId') | |
| for ALLOCATION_ID in $ALLOCATION_IDS; do | |
| aws ec2 release-address --allocation-id $ALLOCATION_ID | |
| done |
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
| const _ = require('lodash'); | |
| const octet_regex = new RegExp('[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]'); | |
| const ipv4_regex = new RegExp(`^(${octet_regex.source})\.(${octet_regex.source})\.(${octet_regex.source})\.(${octet_regex.source})$`); | |
| const ipv4_cidr_regex = new RegExp(`^(?<ipv4>(${octet_regex.source})\.(${octet_regex.source})\.(${octet_regex.source})\.(${octet_regex.source}))\/(?<prefix>[0-9]|[1-2][0-9]|3[0-2])$`); | |
| let validate_ipv4_cidr = function (cidr) { | |
| return ipv4_cidr_regex.test(cidr); |
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 | |
| function docker_machine_start() { | |
| if [[ -x "$(command -v docker-machine)" ]]; then | |
| if [[ "$(docker-machine status)" == "Running" ]]; then | |
| if [[ $(expr $(date +%s) - $(docker run --rm centos date +%s) | tr -d -) -gt 300 ]]; then | |
| docker-machine restart | |
| fi | |
| else | |
| docker-machine start | |
| fi |
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 | |
| if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | |
| echo -e "You should run the following command:\nsource bin/${0}" | |
| exit 1 | |
| fi | |
| PRIVATE_KEYS=$(grep -l -r "\\-\\+BEGIN [[:alpha:]]\+ PRIVATE KEY\\-\\+" ${HOME}/.ssh) | |
| eval $(ssh-agent) |
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 | |
| DOCKER_MACHINE_NAME=${DOCKER_MACHINE_NAME:-default} | |
| DOCKER_REGISTRY_NAMES=${DOCKER_REGISTRY_NAMES:-} | |
| DOCKER_IMAGE_NAMES=${DOCKER_IMAGE_NAMES:-$(basename ${PWD})} | |
| DOCKER_IMAGE_TAGS=${DOCKER_IMAGE_TAGS:-latest} | |
| DOCKER_RUN_WORKING_DIRECTORY=${DOCKER_RUN_WORKING_DIRECTORY:-/usr/src/app} |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.16.2/min/vs/editor/editor.main.css" | |
| rel="stylesheet"> | |
| <style> | |
| #container { | |
| width: 90%; | |
| height: 800px; | |
| margin-left: auto; |
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
| // Find latest Centos AMI | |
| data "aws_ami" "centos" { | |
| most_recent = true | |
| executable_users = [ | |
| "self"] | |
| filter { | |
| name = "product-code" | |
| values = [ | |
| "aw0evgkw8e5c1q413zgy5pjce"] |
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 | |
| dscacheutil -flushcache; sudo killall -HUP mDNSResponder |