$ export VPC_ID=<VPC ID> \
export SUBNET_ID=<subnet id> \
export PEM_KEY_NAME=<pem key name> \
export YOUR_NAME=<your name for resource tag>; \
go test -v
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
aws ec2 describe-images --owners self amazon --filters \ | |
Name=virtualization-type,Values=hvm \ | |
Name=architecture,Values=x86_64 \ | |
Name=block-device-mapping.volume-type,Values=gp2 \ | |
| jq -r '.Images | sort_by(.Name)| .[] | select(.Platform != "windows") | .Name + ": " + .ImageId' \ | |
| egrep 'amzn-ami-hvm|ecs-optimized|amzn2-ami-hvm|amzn2-ami-ecs' |
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
# As of 2018/09/11 | |
# METEIC can be either NetworkPacketsOut, NetworkPacketsIn, DiskReadOps, StatusCheckFailed, StatusCheckFailed_Instance, NetworkOut, NetworkIn, DiskWriteBytes, StatusCheckFailed_System, CPUUtilization, DiskWriteOps or DiskReadBytes | |
METRIC='NetworkIn'; REGION='ap-northeast-1'; NAME_TAG_VALUE='your_instance_name_prefix*'; echo "https://${REGION}.console.aws.amazon.com/cloudwatch/home?region=${REGION}#metricsV2:graph=~(view~'timeSeries~stacked~false~metrics~(`aws ec2 describe-instances --filter Name=tag:Name,Values="${NAME_TAG_VALUE}" | jq '.[][].Instances[].InstanceId' --raw-output | sed "s/^/~(~'AWS*2fEC2~'${METRIC}~'InstanceId~'/g" | sed "s/$/~(stat~'Sum))/g" | tr -d '\n'`)~view~'timeSeries~stacked~true~region~'${REGION})" |
The goal of this document is submitting a job to AWS Batch and confirming the result in CloudWatch Logs.
Since I've worked on ap-northeast-1
region, The following examples includes this region name.
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 base64 | |
import datetime | |
import gzip | |
import json | |
import sys | |
import time | |
from typing import Any, Dict, List | |
import boto3 |
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
# echo '{}' > event.json; mkdir -p libs; pip install attrs envattrs -t libs; \ | |
# export YOUR_PREFIX_SLACK_CHANNEL=your_project-staging; \ | |
# export YOUR_PREFIX_S3_BUCKET=pyconapac-bucket; \ | |
# export YOUR_PREFIX_THRESHOLD=50; \ | |
# python-lambda-local -l libs/ -f handler -t 5 lambda_pyconapac.py event.json | |
from typing import Dict | |
import attr | |
import envattrs |
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 | |
if [ $# -ne 2 ]; then | |
echo "$0 [the number of insert] [output file]" | |
exit 1 | |
fi | |
nmemb_insert=$1 | |
ddlfile=$2 | |
cat <<- EOF > $ddlfile |
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
#include <stdio.h> | |
int | |
main(void) | |
{ | |
double answer = 0.1 + 0.1 + 0.1; | |
if(answer == 0.3){ | |
printf("True:%.100f\n", answer); | |
} else { |
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 | |
echo "---> sleep 0" | |
for loop in `seq 10`; do awk 'BEGIN{ srand(); print rand() }'; done | |
echo "---> sleep 0.5" | |
for loop in `seq 10`; do awk 'BEGIN{ srand(); print rand() }'; sleep 0.5; done | |
echo "---> sleep 1.0" | |
for loop in `seq 10`; do awk 'BEGIN{ srand(); print rand() }'; sleep 1.0; done | |
echo "---> srand(\$RANDOM)" | |
for loop in `seq 10`; do awk 'BEGIN{ srand('"$RANDOM"'); print rand() }'; done |