This file contains 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
gcloud compute disks delete $(gcloud compute disks list --format json | jq '.[] | select (has("users") | not) | .name' -r) |
This file contains 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
package iaws.tblabsauzzya.ugmont; | |
import org.glassfish.grizzly.utils.Exceptions; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import javax.ws.rs.WebApplicationException; | |
import javax.ws.rs.core.Response; | |
import javax.ws.rs.ext.ExceptionMapper; | |
import javax.ws.rs.ext.Provider; |
This file contains 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
package iaws.tblabsauzzya.ugmont; | |
import org.glassfish.grizzly.utils.Exceptions; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import javax.ws.rs.WebApplicationException; | |
import javax.ws.rs.core.Response; | |
import javax.ws.rs.ext.ExceptionMapper; | |
import javax.ws.rs.ext.Provider; |
This file contains 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
# The key of the map is the first folder name | |
PATTERN=".*/mybucket/([^/]+)/.*200 - ([0-9]+) .*" | |
unset costMap | |
# Requires Bash 4.0 | |
declare -A costMap | |
for file in $(ls .); do | |
This file contains 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 java.util.Collections; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.logging.Logger; | |
import ch.qos.logback.classic.Level; | |
import ch.qos.logback.classic.spi.IThrowableProxy; | |
import ch.qos.logback.classic.spi.LoggingEvent; | |
import ch.qos.logback.classic.spi.StackTraceElementProxy; | |
import ch.qos.logback.core.AppenderBase; |
This file contains 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 | |
ROLE=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` | |
JSON=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${ROLE}` | |
TOKEN=`echo ${JSON} | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w 'Token' | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'` | |
# Get instance region and make it the default endpoint | |
EC2_AVAIL_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone` | |
AWS_INSTANCE_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`" |
This file contains 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 | |
ROLE=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` | |
JSON=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${ROLE}` | |
# Get access keys | |
AWS_ACCESS_KEY=`echo ${JSON} | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w 'AccessKeyId' | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'` | |
AWS_SECRET_KEY=`echo ${JSON} | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w 'SecretAccessKey' | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'` | |
SECURITY_TOKEN=`echo ${JSON} | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w 'Token' | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'` | |
# Get insta |
This file contains 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 | |
ROLE=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/` | |
JSON=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${ROLE}` | |
AWS_ACCESS_KEY=`echo ${JSON} | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w 'AccessKeyId' | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'` | |
AWS_SECRET_KEY=`echo ${JSON} | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w 'SecretAccessKey' | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g'` | |
echo "AWSAccessKeyId=${AWS_ACCESS_KEY}" > /tmp/aws_credentials | |
echo "AWSSecretKey=${AWS_SECRET_KEY}" >> /tmp/aws_credentials |
NewerOlder