Skip to content

Instantly share code, notes, and snippets.

View luca992's full-sized avatar

Luca Spinazzola luca992

View GitHub Profile
@luca992
luca992 / gist:ad305d1e39fb9cfeae91bf997607654f
Last active August 2, 2025 08:08
Rust Snafu Errors Example
use snafu::Snafu;
/// Error type for all API traits
/// Note: Do not put implementation specific errors here (so no errors from reqwest, serde, etc.)
/// These should be generic errors that can be used by any API implementation.
/// The implementation specific errors should be defined locally for each API implementation then
/// converted to this error type before being returned.
///
/// Hint: use [From] to convert implementation specific errors to this error type. You can define
/// an error snafu enum inside the same file as an api implementation and also implement the
@luca992
luca992 / s3.kt
Last active August 1, 2025 22:07
Kotlin Multiplatform S3 Request
import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import okio.ByteString.Companion.encodeUtf8