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 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). | |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "execute-api:Invoke", | |
"Resource": "execute-api:/*/*/*" | |
}, | |
{ |
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
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_-]*$" |
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
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "Create EC2 instance | FindInMap" | |
Parameters: | |
Environment: | |
Type: String | |
AllowedValues: | |
- dev | |
- prod | |
- qa |
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 os | |
import json | |
import boto3 | |
def lambda_handler(event, context): | |
if event: | |
messages_to_reprocess = [] | |
batch_failure_response = {} | |
for record in event["Records"]: | |
try: |
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 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) |
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 os | |
import json | |
import boto3 | |
def lambda_handler(event, context): | |
region_name = os.environ['AWS_REGION'] | |
if event: | |
sqs = boto3.client('sqs', region_name=region_name) | |
queue_name = event['Records'][0]['eventSourceARN'].split(':')[-1] | |
queue_url = sqs.get_queue_url( |
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 json | |
import boto3 | |
def lambda_handler(event, context): | |
region_name = os.environ['AWS_REGION'] | |
if event: | |
for record in event['Records']: | |
body = record['body'] | |
# process message | |
return { |
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
cd /usr/local/bin | |
sudo mkdir ffmpeg && cd ffmpeg | |
# check https://johnvansickle.com/ffmpeg/ for latest build | |
sudo wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz | |
sudo tar -xf ffmpeg-release-amd64-static.tar.xz | |
sudo ln -s /usr/local/bin/ffmpeg/ffmpeg-4.4.1-amd64-static/ffmpeg /usr/bin/ffmpeg | |
sudo ln -s /usr/local/bin/ffmpeg/ffmpeg-4.4.1-amd64-static/ffprobe /usr/bin/ffprobe |
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 manimlib.scene.scene import Scene | |
from manimlib.mobject.matrix import Matrix | |
from manimlib import * | |
class manim_mobject_matrix_001a(Scene): | |
def construct(self): | |
sans = 'monospace' | |
size = 0.5 | |
play_kw = {"run_time": 0.5} |
NewerOlder