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
# Database migration targets | |
# Show available recipes | |
default: | |
@echo "Available recipes:" | |
@echo " just migrate dsql - Run migrations for DSQL" | |
@echo " just migrate pgres - Run migrations for PostgreSQL" | |
@echo " just clean-migrations - Clean the migrations directory" | |
# Clean migrations directory |
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
# Database migration targets | |
.PHONY: migrate clean-migrations | |
# Default target | |
help: | |
@echo "Available targets:" | |
@echo " make migrate dsql - Run migrations for DSQL" | |
@echo " make migrate pgres - Run migrations for PostgreSQL" | |
@echo " make clean-migrations - Clean the migrations directory" |
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
# Project configuration | |
PROJECT_NAME = rusty_databases | |
# Docker configuration | |
DOCKER = docker | |
POSTGRES_CONTAINER = $(PROJECT_NAME)_postgres | |
REDIS_CONTAINER = $(PROJECT_NAME)_redis | |
# Generate a random password (16 characters) | |
PG_PASSWORD := $(shell openssl rand -base64 12 | tr -d '\n') |
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 boto3 | |
def process_stream_response(stream) -> None: | |
"""Process and print the streaming response from Claude. | |
Args: | |
stream: The response stream from the Bedrock API | |
""" | |
if not stream: | |
return |
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
# HOMEWORK: | |
# The data processed by this code cannot be consumed by my event sender application | |
# WHY? It should be pretty obvious - drop the comment. | |
# Here is how the data looks like: | |
# [ | |
# { | |
# "minute": 1, | |
# "event_type": "Foul", | |
# "side": "Home", | |
# "event_team": "Thunder FC", |
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
#[macro_use] extern crate rocket; | |
use rocket::serde::json::Json; | |
use serde::Serialize; | |
#[derive(Serialize)] | |
struct Response { | |
status: String, | |
message: String, | |
} | |
// This spoofs weather for the demo |
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
#!/bin/bash | |
set -e | |
if ! command -v ffmpeg 2>&1 >/dev/null | |
then | |
echo "ffmpeg could not be found. Please install it before using this script" | |
echo "Mac users: brew install ffmpeg" | |
echo "Windows users: choco install ffmpeg" | |
echo "Linux: You already know" |
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 os | |
import boto3 | |
from tqdm import tqdm | |
s3_client = boto3.client('s3') | |
def upload_and_sign(file_path, bucket): | |
file_name = os.path.basename(file_path) | |
file_size = os.path.getsize(file_path) |
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 os | |
import boto3 | |
s3_client = boto3.client('s3') | |
def upload_and_sign(file_path, bucket): | |
file_name = os.path.basename(file_path) | |
s3_client.upload_file(file_path, bucket, file_name) |
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 json | |
from typing import List, Dict, Optional | |
def parse_and_validate_recommendations(llm_output: str) -> List[Dict[str, str]]: | |
try: | |
# Attempt to parse the JSON output | |
data = json.loads(llm_output) | |
# Validate the structure of the parsed data | |
if not isinstance(data, list): |
NewerOlder