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
| IP=$1 | |
| aws ec2 describe-instances --filters "Name=private-ip-address,Values=$IP" \ | |
| --query 'Reservations[0].Instances[0].Tags[?Key==`Name`].Value | [0]'\ | |
| --output text |
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
| cat access_log | sed -E '/\?/s/\?.* HTTP/ HTTP/'| grep -o .......HTTP/1 | | |
| grep -o "\\..* " | | |
| sort | uniq -c | sort -rn |
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 | |
| LASTWEEK=$(date -j -v-7d +%Y-%m-%d) | |
| TODAY=$(date -j +%Y-%m-%d) | |
| aws ce get-cost-and-usage --time-period "Start=$LASTWEEK,End=$TODAY" --granularity DAILY --metrics "BlendedCost" | | |
| jq -j '.[][] | .TimePeriod.Start, ": $", .Total.BlendedCost.Amount, "\n"' |
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 json | |
| import requests | |
| url = $1/_count" | |
| headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'} | |
| def count_type(type): | |
| payload = { | |
| "query" : { |
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 --query 'Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType,Tags[?Key==`Name`]]' --output text | | |
| sed -e '$!N;s/\nName./ /' | sort -k4 |
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 | jq -r '.[][].Instances[].Tags[]? | select(.Key=="Name") | .Value' |
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
| netstat -a | awk '/ESTAB/{split($5,a,":");print a[1]}' | sort | uniq -c | sort -rn | head |
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
| curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json |
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
| echo '{ "utf8_str" : "Señor"}' | python -c ' | |
| import json,sys,codecs,re | |
| UTF8Reader=codecs.getreader("utf8") # sometimes Rally descriptions are in UTF-8 | |
| sys.stdin=UTF8Reader(sys.stdin) | |
| UTF8Writer = codecs.getwriter("utf8") | |
| sys.stdout = UTF8Writer(sys.stdout) | |
| result=json.load(sys.stdin) | |
| print result["utf8_str"] | |
| ' |
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
| ORIGIN=$1 | |
| aws cloudfront list-distributions | jq -r '.[]["Items"][] | select(.DefaultCacheBehavior.TargetOriginId=="S3-"+"'$ORIGIN'") | .Id' |
NewerOlder