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
function updatePlayCount(your_object) { | |
return new Promise((resolve, reject) => { | |
const LAST_PLAYED_TIME = Math.round(new Date() / 1000); | |
var params = { | |
TableName: "your_table", | |
Key: { | |
"cognitoid": your_object.userId, |
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
async function asyncWorker() { | |
return new Promise( (resolve, reject) => { | |
setTimeout(resolve, 2000); | |
}); | |
} | |
async function main() { | |
console.debug('Started'); |
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
function asyncWorker() { | |
return new Promise( (resolve, reject) => { | |
setTimeout(resolve, 2000); | |
}); | |
} | |
function main() { | |
callback = () => { |
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
function asyncWorker(callback) { | |
setTimeout(callback, 2000); | |
} | |
function main() { | |
callback = () => { | |
console.debug('callback !'); | |
} |
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 logging | |
import boto3 | |
from botocore.exceptions import ClientError | |
def upload_file(file_name, bucket, object_name=None): | |
"""Upload a file to an S3 bucket | |
:param file_name: File to upload | |
:param bucket: Bucket to upload to | |
:param object_name: S3 object name. If not specified then file_name is used |
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
// tm is the trust manager, code to instantiate this is skipped for brevity | |
// let's create our own OKHttpClient and configure it to use our custom SSLSocketFactory | |
val okHTTPClient = OkHttpClient.Builder().sslSocketFactory(TLSSocketFactory(), tm).build() | |
// Tell the builder to use our own OK HTTP client | |
appSyncBuilder.okHttpClient(okHTTPClient) | |
appSyncClient = appSyncBuilder.build() |
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
// initialize the AppSync client | |
val appSyncClient = AWSAppSyncClient.builder() | |
.context(applicationContext) | |
.awsConfiguration(AWSConfiguration(applicationContext)) | |
.credentialsProvider(credentialsProvider) | |
.build() |
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
$ nmap --script ssl-enum-ciphers <your_appsync_id>.appsync-api.eu-west-1.amazonaws.com | |
Starting Nmap 7.70 ( https://nmap.org ) at 2018-12-23 14:35 GMT | |
Nmap scan report for d7...33q.appsync-api.eu-west-1.amazonaws.com (13.xx.xx.43) | |
Host is up (0.033s latency). | |
Other addresses for d7...33q.appsync-api.eu-west-1.amazonaws.com (not scanned): 13.xx.xx.xx 13.xx.xx.xx 13.xx.xx.xx | |
rDNS record for 13.xx.xx.43: server-13-xx-xx-43.lhr62.r.cloudfront.net | |
Not shown: 998 filtered ports | |
PORT STATE SERVICE | |
80/tcp open http |
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
const HelloWorldIntentHandler = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'HelloWorldIntent'; | |
}, | |
async handle(handlerInput) { | |
const { | |
accessToken | |
} = handlerInput.requestEnvelope.context.System.user; | |
let speechText = ''; | |
if (!accessToken) { |