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
s3_resource = boto3.resource('s3') | |
s3_object = s3_resource.Object(bucket_name=bucket_name, key=object_key) | |
bodylines = get_object_bodylines(s3_object, offset) | |
resp = s3_object.get(Range=f'bytes={offset}-') | |
body: botocore.response.StreamingBody = resp['Body'] |
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
MINIMUN_REMAINING_TIME_MS = 10000 | |
csv_reader = csv.DictReader(bodylines.iter_lines(), fieldnames=fieldnames) | |
for row in csv_reader: | |
## process and do work | |
if context.get_remaining_time_in_millis() < MINIMUN_REMAINING_TIME_MS: | |
fieldnames = fieldnames or csv_reader.fieldnames | |
break |
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
mediainformer.click |
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
import numpy as np | |
def plot_confusion_matrix(cm, | |
target_names, | |
title='Confusion matrix', | |
cmap=None, | |
normalize=True, | |
figsize=(8, 6)): | |
""" |
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
{ | |
"swagger": "2.0", | |
"info": { | |
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", | |
"version": "1.0.5", | |
"title": "Swagger Petstore", | |
"termsOfService": "http://swagger.io/terms/", | |
"contact": { | |
"email": "apiteam@swagger.io" | |
}, |
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
import { Botkit } from "botkit"; | |
module.exports = function (controller: Botkit) { | |
controller.on("app_mention", async (bot, message) => { | |
await bot.reply(message, "I am mentioned."); | |
}); | |
}; |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"lib": ["es2019"], | |
"module": "commonjs", | |
"target": "es2019", | |
"moduleResolution": "node", | |
"types": [ | |
"node" | |
], | |
"typeRoots": [ |
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
// lambda.js | |
'use strict' | |
const awsServerlessExpress = require('aws-serverless-express') | |
const controller = require('.') | |
const server = awsServerlessExpress.createServer(controller.webserver) | |
exports.handler = (event, context) => { awsServerlessExpress.proxy(server, event, context) } |
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
module.exports = function (controller) { | |
controller.on("app_mention", async (bot, message) => { | |
await bot.reply(message, "I am mentioned."); | |
}); | |
}; |
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
// Load Environment variables from dotenv | |
require('dotenv').config(); | |
const express = require("express"); | |
const bodyParser = require("body-parser"); | |
// Import Botkit's core features | |
const { Botkit } = require("botkit"); | |
// Import a platform-specific adapter for slack. | |
const { SlackAdapter, SlackEventMiddleware } = require('botbuilder-adapter-slack'); |