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 | |
| # white list all public IPs from an AWS region in to a security group | |
| security_group="sg-xxxxxx" | |
| region="eu-west-1" | |
| port="3306" | |
| # list the public IPs from the instances in region | |
| public_ips=`aws ec2 describe-instances --query "Reservations[*].Instances[*].PublicIpAddress" --output=text --region=${region} | xargs` |
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 | |
| # A small script to take a larger text based file and break it down to several smaller files | |
| # of 500 lines each for easier processing, keeping the headings at the top of each file | |
| FILENAME=${1} | |
| if [ -z ${FILENAME} ]; then | |
| echo "Please provide a filename, for example: bash split.sh /path/to/data.csv"; | |
| else |
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
| # Sync 2 S3 buckets | |
| aws s3 sync s3://{source} s3://{destination} | |
| # Determine size of an S3 bucket | |
| aws s3api list-objects --bucket {s3_bucket_name} --output json --query "[sum(Contents[].Size), length(Contents[])]" | |
| # dump large mysql DB > tested on 200gb DBs | |
| mysqldump -h {HOST} -u {USER} -p {TABLE} --single-transaction --default-character-set=utf8 --quick --extended-insert > {FILENAME}.sql |
NewerOlder