Skip to content

Instantly share code, notes, and snippets.

View darko-mesaros's full-sized avatar
🎯
Focusing

Darko Mesaros darko-mesaros

🎯
Focusing
View GitHub Profile
@darko-mesaros
darko-mesaros / justfile
Created July 1, 2025 14:03
sqlx migration with Postgres and DSQL - justfile
# 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
@darko-mesaros
darko-mesaros / Makefile
Created July 1, 2025 14:01
sqlx migration with Postgres and DSQL
# 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"
@darko-mesaros
darko-mesaros / Makefile
Created March 25, 2025 06:13
Rust + Postgres + Redis makefile
# 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')
@darko-mesaros
darko-mesaros / claude37.py
Created February 26, 2025 04:32
Invoke Claude 3.7 on Amazon Bedrock
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
@darko-mesaros
darko-mesaros / process.py
Created December 4, 2024 23:08
Processing data with Pandas
# 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",
@darko-mesaros
darko-mesaros / main.rs
Created November 25, 2024 07:12
A dummy API with Rocket and Rust
#[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
@darko-mesaros
darko-mesaros / convert_to_24.sh
Last active November 14, 2024 18:59
Use FFMpeg to convert your screen recordings to 24fps
#!/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"
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)
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)
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):