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 "Alan" | base64 | base64 --decode | |
convert -size 2560x1600 canvas:red ~/tx.png # reaquires imagemagick | |
find . -maxdepth 1 -type f -name '*x.png*' -exec ls -l {} \; | |
base64 ~/tx.png > ~/tx.png.b64 | |
zip ~/tx.png.b64.zip ~/tx.png.b64 | |
cp ~/tx.png.b64.zip ~/rx.png.b64.zip |
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
# execute the following command from the terminal of a new c9 workspace | |
git clone https://github.com/amcginlay/nodejs-chat.git | |
cd nodejs-chat | |
npm install | |
# Now ... | |
# - open server.js and click the green run button | |
# - click Preview / Preview Running Application | |
# - in the mini-browser window, click the stacked window icon to open in a new tab |
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
- Create VPC-A in us-west-2 on 10.100.0.0/16 with IGW and public subnet on 10.100.0.0/24 | |
- Create VPC-B in us-east-2 on 10.200.0.0/16 with IGW and public subnet on 10.200.0.0/24 | |
- Create EC2-A in 10.100.0.0/24 with all TCP & ICMP ports open to 10.200.0.0/24 | |
- Create EC2-B in 10.200.0.0/24 with all TCP & ICMP ports open to 10.100.0.0/24 | |
- Allocate EC2-B an Elastic IP address | |
- Create a Virtual Private Gateway (VGW) attached to VPC-A | |
- Create a Customer Gateway (CGW) referencing EC2-B's Elastic IP address | |
- Create a VPN Connection (VPN), referencing the VGW, the CGW and static route 10.200.0.0/24 | |
- Download the Generic VPN configuration file |
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
STREAM_NAME=wildrydes | |
SHARD_ID=ShardId-000000000000 | |
aws kinesis get-records --shard-iterator $( \ | |
aws kinesis get-shard-iterator \ | |
--stream-name ${STREAM_NAME} \ | |
--shard-id ${SHARD_ID} \ | |
--shard-iterator-type TRIM_HORIZON \ | |
--output text \ | |
) --output text --query 'Records[*].[Data]' | while read line ; do echo $line | base64 --decode ; echo ; 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
How to assume an IAM role using the AWS CLI | |
=========================================== | |
# from admin session | |
# TODO fix this to eliminate ACCOUNT_ID env var | |
ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text) | |
aws iam create-user --user-name test-user | |
cat << EOF > test-policy.json | |
{ | |
"Version": "2012-10-17", | |
"Statement": { |
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 region in $(aws ec2 describe-regions --query 'Regions[*].[RegionName]' --output text); do | |
# echo "--- ${region} ---" | |
aws resourcegroupstaggingapi get-resources \ | |
--region ${region} \ | |
# --resource-type-filters 'ec2:instance' \ | |
--query 'ResourceTagMappingList[*].[ResourceARN]' \ | |
--output text; | |
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 cloudwatch get-metric-statistics \ | |
--namespace AWS/EC2 \ | |
--metric-name CPUUtilization \ | |
--statistics Maximum \ | |
--start-time 2019-01-01T00:00:00Z \ | |
--end-time 2020-01-01T00:00:00Z \ | |
--period $((60*60*24)) \ | |
--query 'sort_by(Datapoints,&Timestamp)[*]' |
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
function Button() { | |
const [counter, setCounter] = useState(0); | |
return <button onClick={() => setCounter(counter+1)}>{counter}</button>; | |
} | |
ReactDOM.render( | |
<Button />, | |
document.getElementById('mountNode'), | |
); |
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
# https://adamj.eu/tech/2019/08/19/cloudformation-minimum-viable-template/ | |
AWSTemplateFormatVersion: 2010-09-09 | |
Resources: | |
Topic: | |
Type: AWS::SNS::Topic |