Skip to content

Instantly share code, notes, and snippets.

View abelbryo's full-sized avatar

Abel Terefe abelbryo

View GitHub Profile
@abelbryo
abelbryo / S3OutputStream.java
Created July 11, 2024 20:03 — forked from blagerweij/S3OutputStream.java
OutputStream which wraps S3Client, with support for streaming large files directly to S3
import java.io.ByteArrayInputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.AbortMultipartUploadRequest;
import com.amazonaws.services.s3.model.CannedAccessControlList;
import com.amazonaws.services.s3.model.CompleteMultipartUploadRequest;
import com.amazonaws.services.s3.model.InitiateMultipartUploadRequest;
object UserEntityModule {
case class UserEntityF[F[_], G[_]](id: G[Option[Long]] = None, username: F[String], password: F[String])
type Id[A] = A
type Forget[A] = Unit
// You can also just use Option if you don't care
// for the domain-specific type
sealed trait Updatable[+A] {
def foreach(f : A => Unit): Unit = this match {
@abelbryo
abelbryo / playjson-example.scala
Last active October 26, 2016 07:52
Json formatting with Play Json 2.5
import play.api.libs.functional.syntax._
import play.api.libs.json._
// Example showing different use cases
// of json formatting with Play-Json library
// case class with parameters
final case class DataType[T](value: T)
object DataType {
implicit def anyDataTypeJsonFmt[T: Format]: Format[DataType[T]] = {