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 boto3 | |
def lambda_handler(event, context): | |
client = boto3.client('ec2') | |
filters = [{'Name':'tag:Backup-AMI', 'Values':['yes']}] | |
instances = client.describe_instances(Filters=filters) | |
if instances and instances['Reservations']: |
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
from __future__ import print_function | |
from datetime import datetime | |
from urllib2 import urlopen | |
SITES = ['http://produto.mercadolivre.com.br/MLB-726627332-mini-pc-intel-nuc-i5-16gb-ssd-250-samsung-evo-5i5ryh-_JM', 'http://produto.mercadolivre.com.br/MLB-726629981-surface-4-pro-i5-8gb-ram-256-hd-teclado-e-mouse-_JM', 'http://produto.mercadolivre.com.br/MLB-716571875-iphone-6-plus-com-128gb-na-cor-space-gray-_JM'] # URL of the site to check | |
def lambda_handler(event, context): | |
try: | |
for num in range(1,10): |
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
{"message":"One or more parameter values were invalid: Condition parameter type does not match schema type","code":"ValidationException","time":"2015-08-19T12:50:48.382Z","statusCode":400,"retryable":false} |
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
[ { [InvalidParameterType: Expected params.ExpressionAttributeValues[':id'] to be a structure] | |
message: 'Expected params.ExpressionAttributeValues[\':id\'] to be a structure', | |
code: 'InvalidParameterType', | |
time: Wed Aug 19 2015 09:49:42 GMT-0300 (BRT) }, | |
{ [UnexpectedParameter: Unexpected key '0' found in params.ExpressionAttributeValues[':id']] | |
message: 'Unexpected key \'0\' found in params.ExpressionAttributeValues[\':id\']', | |
code: 'UnexpectedParameter', | |
time: Wed Aug 19 2015 09:49:42 GMT-0300 (BRT) } ] |
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
var AWS = require('aws-sdk'); | |
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10', region: 'us-east-1'}); | |
var params = { | |
TableName: 'Produtos', | |
KeyConditionExpression: 'Id = :id', | |
ExpressionAttributeValues: { | |
':id' : '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
var AWS = require('aws-sdk'); | |
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10', region: 'us-east-1'}); | |
var params = { | |
TableName: 'Produtos', | |
ExpressionAttributeValues: { | |
':id' : { 'S' : '1' } | |
}, | |
KeyConditionExpression: 'Id = :id' |
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
# (1) aws s3api put-object é padrão, tem a mesma sintaxe para Mac, Linux e Windows | |
# (2) openssl está disponível no Mac e no Linux, pode ser instalado no Windows com o cygwin | |
# (3) openssl dgst -md5 -binary demo-diebold.txt vai gerar o MD5 em binário do arquivo informado (ex: demo-diebold.txt) | |
# (4) openssl enc -base64 vai converter o valor informado para Base64 | |
# (5) o | (pipe) faz a passagem do output da execução do comando 4 para o comando 5, e gera como ouput final o MD5 em Base64 | |
# (6) a chamada $(openssl dgst -md5 -binary demo-diebold.txt | openssl enc -base64) que passamos para o --content-md5 é para primeiro gerar o hash MD5 em Base64 do arquivo, e então passar o output para o aws s3api put-object ser executado | |
aws s3api put-object --bucket megasenateste --key demo-diebold.txt --body ./demo-diebold.txt --content-md5 $(openssl dgst -md5 -binary demo-diebold.txt | openssl enc -base64) |
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
var aws = require('aws-sdk'), | |
fs = require('fs'), | |
crypt = require("crypto"); | |
function getMD5HashFromFile(file){ | |
var hash = crypt.createHash("md5") | |
.update(file) | |
.digest("base64"); | |
return hash; | |
} |
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
q=(or genres:'Action')&q.parser=structured&fq=(or genres:'Adventure' genres:'Fantasy') |
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
{ | |
"status":{ | |
"rid":"9Z+48u4oJQqVLio=", | |
"time-ms":15 | |
}, | |
"hits":{ | |
"found":485, | |
"start":0, | |
"hit":[ | |
{ |
NewerOlder