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
package org.reisjr.iot; | |
import java.util.Random; | |
import com.amazonaws.services.iot.AWSIot; | |
import com.amazonaws.services.iot.model.AttachPolicyRequest; | |
import com.amazonaws.services.iot.model.AttachThingPrincipalRequest; | |
import com.amazonaws.services.iot.model.CreateKeysAndCertificateRequest; | |
import com.amazonaws.services.iot.model.CreateKeysAndCertificateResult; | |
import com.amazonaws.services.iot.model.CreatePolicyRequest; |
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 | |
INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id` #para pegar o id da instância | |
VOL_ID=`aws ec2 create-volume --availability-zone us-east-1a --output text --query "VolumeId" --snapshot-id xxxxxxx --region us-east-1` | |
aws ec2 attach-volume --volume-id $VOL_ID --instance-id $INSTANCE_ID --device /dev/sdf --region us-east-1 |
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
#Append time to a list using face_id as key. Create list if it doesn't exist. | |
def log_event(face_id, similarity): | |
now = datetime.datetime.now() | |
create_dynamodb = dynamodb_events_table.update_item( | |
Key={ | |
'FaceId': face_id, | |
'Timestamp': str(now.date()) | |
}, |
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 | |
DEST="dreis-datasets" | |
# Download files from https://archive.org/download/stackexchange | |
wget https://archive.org/download/stackexchange/stackoverflow.com-Badges.7z & | |
wget https://archive.org/download/stackexchange/stackoverflow.com-Comments.7z & | |
wget https://archive.org/download/stackexchange/stackoverflow.com-PostHistory.7z & | |
wget https://archive.org/download/stackexchange/stackoverflow.com-PostLinks.7z & |
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://s3.amazonaws.com/dreis-iot/immersion-day/IoT+ID+-+HOL+-+FIrst+Lab+-+Connecting+a+Device.pdf |
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 | |
#Setup | |
SQS_MAX_NUMBER_OF_MESSAGES=1 # Mensagens extraídas da fila por vez | |
SQS_WAIT_TIME_SECONDS=20 # Esperar quanto tempo por uma mensagem na fila | |
#Obtain queue URL | |
QUEUE_URL=$(aws sqs get-queue-url --queue-name "dreis-rampup-queue" --output text) | |
#Send message |
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 | |
SCRIPT=`basename "$0"` | |
if [ $# -eq 0 ] | |
then | |
echo "No arguments supplied" | |
echo "$SCRIPT thing-name" | |
exit | |
fi |
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
ddb_client = boto3.client("dynamodb", region_name='eu-west-1') | |
paginator = ddb_client.get_paginator("query") | |
pages = paginator.paginate( | |
TableName=TABLE_NAME, | |
ConsistentRead=False, | |
KeyConditionExpression="Identifier = :k", | |
ExpressionAttributeValues={ | |
":k" : { "S" : key } | |
}, |
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 | |
BUCKET="s3-temp-folder" | |
FILENAME=`basename $1` | |
aws s3 cp $1 s3://$BUCKET/ | |
aws rekognition detect-labels --image "{ \"S3Object\" : { \"Bucket\" : \"$BUCKET\", \"Name\": \"$FILENAME\" } }" --min-confidence 80 |
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 | |
## Simple script to update the security group to allow ssh access from current IP. | |
## You can specify the Public DNS name of the instance that you want to access | |
## and it will update the first SG found. You can also setup a default SG and | |
## the script will update it and the DNS name is not informed. | |
SG="sg-xxxxxxxx" | |
REGION="us-east-1" |