text stringlengths 92 5.09M |
|---|
import json
import boto3
def lambda_handler(event, context):
# Create S3 Client
s3 = boto3.client('s3')
# Load the transcript from file in S3
obj = s3.get_object(Bucket=event['bucket_name'], Key=event['key'])
data = obj['Body'].read()
data_obj = json.loads(data)
transcript = data_obj[... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import json
import boto3
from random import randrange
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
patch_all()
def lambda_handler(event, context):
#Generate random number... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import json
import boto3
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
patch_all()
client = boto3.client('stepfunctions')
def lambda_handler(event, context):
print(event)
... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import json
import boto3
from random import randrange
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
patch_all()
def lambda_handler(event, context):
product_id = event["prod... |
"""Unit tests for sfndeploy.py
As an end-user this module is not relevant to you. You do not need to copy it
alongside sfndeploy.py.
If you are coding changes to sfndeploy.py, this test module is useful during
the development phase.
"""
import unittest
from unittest.mock import call, patch, MagicMock
import sfndeplo... |
#!/bin/bash
#
# AWS StepFunctions example showing how to create a canary deployment with a
# State Machine Alias and versions.
#
# Requirements: AWS CLI installed and credentials configured.
#
# A canary deployment deploys the new version alongside the old version, while
# routing only a small fraction of the overal... |
#!/usr/bin/env python3
"""Create gradual deployment of an AWS Step Functions state machine.
Uses an Alias to deploy a new version of state machine, with one of the
following deployment strategies:
- All At Once (aka blue/green)
- Canary
- Linear
You can set a configurable monitoring period during which the script wil... |
from aws_cdk import (
Stack,
aws_iot as iot,
aws_lambda as lambdafun,
aws_iam as iam,
CfnOutput as cfn_out
)
from constructs import Construct
class AsyncResponseWithIoT(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct... |
from aws_cdk import (
Duration,
Stack,
aws_lambda as lambdafun,
aws_stepfunctions as sfn,
aws_stepfunctions_tasks as tasks,
aws_s3 as s3,
CfnOutput as cfn_out,
aws_iam as iam
)
from constructs import Construct
import builtins
import typing
import os, subprocess
CLAUDE_HUMAN_PROMPT = "... |
#!/usr/bin/env python3
import os
import aws_cdk as cdk
from api_stack import ApigwSqsLambdaStack
from sfn_workflow_stack import GenerativeAIWorkflow
import aws_cdk as cdk
from iot import AsyncResponseWithIoT
app = cdk.App()
workflow = GenerativeAIWorkflow(app, "genai-prompt-chaining-hitl-workflow")
ApigwSqsLambdaSt... |
from aws_cdk import (Stack, aws_sqs as sqs, aws_apigateway as apigateway,
aws_iam as iam, aws_lambda as lambdafun, aws_stepfunctions as sfn,
aws_lambda_event_sources as eventsources, Duration as duration,
CfnOutput as cfn_out)
import os
import json
from con... |
/* JSONPath 0.8.0 - XPath for JSON
*
* Copyright (c) 2007 Stefan Goessner (goessner.net)
* Licensed under the MIT (MIT-LICENSE.txt) licence.
*/
function jsonPath(obj, expr, arg) {
var P = {
resultType: arg && arg.resultType || "VALUE",
result: [],
normalize: function(expr) {
var s... |
let wssClient;
//************************UPDATE ****************************************/
const WSS_SERVER_URL = 'wss://xxxxx-ats.iot.region.amazonaws.com';
const WSS_AUTHORIZER_NAME = 'genai-hitl-workflow-iot';
const REQ_API = "https://xxxxx.execute-api.region.amazonaws.com/prod/"
//************************UPDATE ... |
""" Module to send the response from workflow to the user through IoT core topic"""
import json
import re
import boto3
def lambda_handler(event, context):
"""Lambda handler to send message to IoT topic. Sends title and description to the client in the first call. Sends avatar presigned url in the second call"""
... |
import os
import json
import boto3
sfn = boto3.client("stepfunctions")
stateMachineArn = os.environ.get("STATE_ARN")
def lambda_handler(event, context):
"""Lambda event handler. Invokes workflow."""
for record in event["Records"]:
request = json.loads(record["body"])
input = {"input": reques... |
"""Module providing auth to IoT topic"""
import os
def lambda_handler(event, context):
""" Lambda function to return the authorization for IoT topic """
ACCOUNT_ID = os.getenv("ACCOUNT_ID")
REGION = os.getenv("REGION")
policy = {
"isAuthenticated": True,
"principalId": 'Unauthen... |
import boto3
import csv
from random import uniform, randrange, randint
from datetime import datetime, timedelta
from io import StringIO
import os
region = os.getenv('REGION')
count = os.getenv('RECORDCOUNT')
s3_client = boto3.client('s3', region_name=region)
s3 = boto3.resource('s3')
terms = [12, 24, 36, 48, 60, 72, 8... |
import boto3
import json
import csv
import pandas as pd
import io
import os
region = os.getenv('REGION')
count = os.getenv('RECORDCOUNT')
s3_client = boto3.client('s3', region_name=region)
s3_resource = boto3.resource('s3')
def lambda_handler(event, context):
bucket_v = event['inventory']['bucket']
manifest_key_v... |
import boto3
import csv
from io import StringIO
import os
region = os.getenv('REGION')
count = os.getenv('RECORDCOUNT')
s3_client = boto3.client('s3', region_name=region)
s3 = boto3.resource('s3')
def lambda_handler(event, context):
data = []
for i in range(1, (int(count) + 1)):
data.append({
'num': i
... |
import boto3
import csv
import gzip
from io import StringIO
from io import BytesIO
from botocore.client import Config
import os
# set a few variables we'll use to get our data
region = os.getenv('REGION')
count = os.getenv('RECORDCOUNT')
s3_client = boto3.client('s3', region_name=region)
s3 = boto3.resource('s3')
def... |
import boto3
import json
from datetime import datetime
import time
s3_client = boto3.client("s3")
s3 = boto3.resource("s3")
def lambda_handler(event, context):
files = []
for item in event['Items']:
files.append({
"key": item['Key'],
"size": item['Size'],
"MD5checksum": item['Etag'].replace(... |
import boto3
import os
# set a few variables we'll use to get our data
region = os.getenv('REGION')
bucket = os.getenv('SOURCEBUCKET')
s3_client = boto3.client('s3', region_name=region)
s3 = boto3.resource('s3')
def lambda_handler(event, context):
body = """#!/usr/bin/python3
import boto3
import botocore
import os... |
import boto3
import botocore
import os
import pandas as pd
from io import StringIO
from botocore.config import Config
from random import randint
# set initial variables for the rest of the script
config = Config(retries = dict(max_attempts = 2, mode = 'standard'))
region = os.getenv('REGION')
count = os.getenv('RECORD... |
import boto3
import os
# set a few variables we'll use to get our data
region = os.getenv('REGION')
bucket = os.getenv('SOURCEBUCKET')
s3_client = boto3.client('s3', region_name=region)
s3 = boto3.resource('s3')
def lambda_handler(event, context):
body = """#!/usr/bin/python3
import boto3
import botocore
import os... |
#include <stdint.h>
#include "minhook/include/MinHook.h"
typedef void(__fastcall* netcat_insert_direct_t)(uint64_t catalog, uint64_t* key, uint64_t** item);
netcat_insert_direct_t netcat_insert_direct = NULL;
typedef size_t (__cdecl* strlen_t)(const char *str);
strlen_t builtin_strlen = NULL;
HMODULE g_hmod = NULL;... |
module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass: {
files: ['web/assets/css/sass/*.scss'],
tasks: 'sass'
},
concat: {
files: ['<%= concat.dist.src %>', '<%= concat.dist.dest %>'],
... |
walk(document.body);
function walk(node)
{
// I stole this function from here:
// http://is.gd/mwZp7E
var child, next;
var tagName = node.tagName ? node.tagName.toLowerCase() : "";
if (tagName == 'input' || tagName == 'textarea') {
return;
}
if (node.classList && node.classList.contains('ace_editor')) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.