Skip to content

Instantly share code, notes, and snippets.

import os
import json
import boto3
def lambda_handler(event, context):
region_name = os.environ['AWS_REGION']
if event:
sqs = boto3.resource('sqs', region_name=region_name)
queue_name = event['Records'][0]['eventSourceARN'].split(':')[-1]
queue = sqs.get_queue_by_name(QueueName=queue_name)
import os
import json
import boto3
def lambda_handler(event, context):
if event:
messages_to_reprocess = []
batch_failure_response = {}
for record in event["Records"]:
try:
AWSTemplateFormatVersion: "2010-09-09"
Description: "Create EC2 instance | FindInMap"
Parameters:
Environment:
Type: String
AllowedValues:
- dev
- prod
- qa
AWSTemplateFormatVersion : "2010-09-09"
Description: "Sample Template"
Parameters:
S3BucketName:
Description: Enter S3 bucket name
Type: String
MinLength: 3
MaxLength: 10
AllowedPattern: "^[A-Za-z0-9_-]*$"
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "execute-api:/*/*/*"
},
{
@srcecde
srcecde / reciprocal_rank_fusion_impl.py
Created December 18, 2023 21:45
Reciprocal Rank Fusion implementation
from collections import defaultdict
def reciprocal_rank_fusion(*list_of_list_ranks_system, K=60):
"""
Fuse rank from multiple IR systems using Reciprocal Rank Fusion.
Args:
* list_of_list_ranks_system: Ranked results from different IR system.
K (int): A constant used in the RRF formula (default is 60).