# Clear any existing ENV credentials
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
# Assumed the specified role and export the required values
KEYS=$(aws sts assume-role --role-arn $AWS_ROLE_ARN \
--role-session-name testing --duration 900); \
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
# Loops through all the .png images in the current folder and assigns their filename to an element of the array | |
counter=0 | |
for i in `ls -1 ./*.png` ; do | |
images[$counter]=$i; | |
let counter=counter+1; | |
done | |
# Loops through the images array, based on the ROWS and COLS spec, to determine how many items rows and columns there will be when merging. Plenty of improvements here | |
ROWS=2 | |
COLS=4 |
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 | |
FILE="ipsToConnectTo" | |
lineContents() { | |
# Checks if a line has a * pointer next to it to denote which is the next line that should be returned. | |
LN=$(grep --color=never -n \* $FILE | cut -f1 -d\:) | |
# If there is no * pointer it needs a manual reset to the right starting location. A precaution for how I used it but easily customisable. | |
if [ "${LN}" == "" ] ; then |
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[].[PrivateIpAddress, MetadataOptions]' --instance-ids <ids> | |
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 -ex | |
CURL_COMMAND='curl -X POST https://api.github.com/graphql' | |
RAW_OUTPUT_FILE="$(tempfile -s ".query.output")" | |
MINIMUM_PLUS_1_COUNT=20 | |
function API_call() { | |
if [ ! -v NEXT_PAGE ]; then | |
api_output=$($CURL_COMMAND -H "Authorization:bearer $GITHUB_TOKEN" -d @query) | |
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
#!/bin/bash -xe | |
# Below command can be replaced to the required CLI, including with custom JSON output, assuming the NextToken is in the same location. | |
AWS_CLI_COMMAND="aws elasticbeanstalk list-platform-versions --max-records 100 --query={NextToken:NextToken,PlatformARNs:PlatformSummaryList[*].PlatformArn}" | |
OUTPUT_FILE="./output-$(date +%s)" | |
function CLI_call() { | |
if [ ! -v NEXT_TOKEN ]; then | |
cli_output=$($AWS_CLI_COMMAND) | |
else |
NewerOlder