Skip to content

Instantly share code, notes, and snippets.

View dceoy's full-sized avatar
Lazy

Daichi Narushima dceoy

Lazy
View GitHub Profile
@dceoy
dceoy / execution_time_logger.py
Last active April 23, 2025 15:36
[Python] Execution time logger
#!/usr/bin/env python
import logging
import time
from functools import wraps
from typing import Any, Callable
def log_execution_time(func: Callable[..., Any]) -> Callable[..., Any]:
@wraps(func)
@dceoy
dceoy / test_twilio_signature_validator.py
Last active May 14, 2025 07:35
[Python] Twilio signature validator
"""Unit tests for twilio_signature_validator module."""
import base64
import pytest
from aws_lambda_powertools.event_handler.exceptions import (
BadRequestError,
UnauthorizedError,
)
from aws_lambda_powertools.utilities.data_classes import LambdaFunctionUrlEvent
@dceoy
dceoy / ics.py
Last active May 14, 2025 07:27
[Python] Check if now is any event in iCalendar data
"""Utilities for iCalendar (ICS) data."""
from datetime import datetime
from zoneinfo import ZoneInfo
import recurring_ical_events # type: ignore[reportMissingTypeStubs]
from aws_lambda_powertools import Logger
from icalendar import Calendar
logger = Logger()
@dceoy
dceoy / bedrock-logging.cfn.yml
Last active May 20, 2025 08:56
[CloudFormation] AWS resources for Amazon Bedrock model invocation logging
---
AWSTemplateFormatVersion: 2010-09-09
Description: CloudFormation template to create resources for Amazon Bedrock model invocation logging
Parameters:
SystemName:
Type: String
Default: brmil
Description: Name of the system for which the resources are being created.
EnvType:
Type: String