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
rm *{access*,error*}.log.[1-9][0-9]* |
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
PROFILE=srekcahrai;for name in $(aws --profile=$PROFILE --region=us-east-1 ec2 describe-instances --filter Name='instance-state-name',Values='running' --query 'Reservations[*].Instances[*][Tags[?Key==`Name`].Value]' --output text|sort); do echo $name | awk '{print tolower($0) ".srekcahrai.com"}'; 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
PROFILE=srekcahrai;REGION=us-east-1;aws --profile=$PROFILE --region=$REGION ec2 describe-instances --filter Name='instance-state-name',Values='running' --output json | jq -r '.Reservations[].Instances[] | .InstanceId + "\t" + .BlockDeviceMappings[].Ebs.VolumeId' | while read instance_id volume_id;do aws --profile=$PROFILE --region=$REGION ec2 create-snapshot --volume-id="$volume_id" --description="$instance_id $volume_id $(date +"%F %T")";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
RewriteEngine On | |
RewriteCond %{HTTPS} off [OR] | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] | |
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301] |
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
for instance in $(cat ~/.ssh/config | ggrep -oP "(?<=Host )[A-Za-z0-9_\-]+$"); do ssh -o StrictHostKeyChecking=no $instance "uname -a"; 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
aws ec2 describe-instances \ | |
--filter Name=tag-key,Values=Name \ | |
--query 'Reservations[*].Instances[*].{Instance:InstanceId,Name:Tags[?Key==`Name`]|[0].Value,PublicIP:PublicIpAddress,PrivateIP:PrivateIpAddress,State:State.Name}' \ | |
--output table |