Skip to content

Instantly share code, notes, and snippets.

View onema's full-sized avatar

Juan Manuel Torres onema

View GitHub Profile
class Function extends LambdaHandler[S3Event, Unit] with NoopLambdaConfiguration
import com.amazonaws.serverless.proxy.model.{AwsProxyRequest, AwsProxyResponse}
import io.onema.userverless.configuration.lambda.NoopLambdaConfiguration
import io.onema.userverless.function.ApiGatewayHandler
import io.onema.userverless.function.ApiGatewayHandler.Cors
import org.apache.http.HttpStatus
class ApiGatewayFunction
extends ApiGatewayHandler
import io.onema.userverless.configuration.lambda.NoopLambdaConfiguration
import io.onema.userverless.function.SnsHandler
case class Foo(bar: String)
class Function extends SnsHandler[Foo] with NoopLambdaConfiguration {
//--- Methods ---
def execute(event: Foo, context: Context): Unit = {
import{AmazonS3, AmazonS3ClientBuilder}
import io.onema.userverless.configuration.lambda.EnvLambdaConfiguration
import io.onema.userverless.function.LambdaHandler
import scala.collection.JavaConverters._
class CopyFunction extends LambdaHandler[S3Event, Unit] with EnvLambdaConfiguration {
onema / codebuild-4scala_cfn.yml
Created September 7, 2018 21:09
Cloudformation template to create codebuild service for scala libraries
# Code pipeline for scala applications
AWSTemplateFormatVersion: '2010-09-09'
Description: >
Template to create codebuild service for components and libraries
onema / Function.scala
Last active March 22, 2018 16:05
My own solution of the LambdaSharp challenge March2018-DynamoDB
* See
package onema
import collection.JavaConverters._
onema /
Created April 19, 2017 14:26
Converting a case class to a map
import{BufferedWriter, FileWriter}
import com.github.tototoshi.csv.CSVWriter
// ...
def writeCaseClasses(seqOfCaseClasses: Seq[AnyRef], filename: String): Unit = {
import Implicits._
val mapOfKeyValues = => x.toMap)
val values =
onema / lock-down-access-to-instance-types.yml
Created January 24, 2017 21:43
Cloud formation template for single policy based on the reInvent2015 talk
AWSTemplateFormatVersion: "2010-09-09"
Description: >
Tempalte to create a managed policy to lock down users to create instance of a specific type
Description: >
Comma separated list of instance types that will be allowed by the policy
e.g. "t1.*, t2.*, m3.*"
onema / gist:eb5fbd8200882569a43b
Created December 8, 2015 00:54
Prevent vagrant from asking for password
sudo /bin/bash -c "echo 'Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports' >> /etc/sudoers"
sudo /bin/bash -c "echo 'Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart' >> /etc/sudoers"
sudo /bin/bash -c "echo 'Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports' >> /etc/sudoers"
sudo /bin/bash -c "echo '%admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE' >> /etc/sudoers"
onema /
Created November 5, 2015 17:53 — forked from nonZero/
import signal
class GracefulInterruptHandler(object):
def __init__(self, sig=signal.SIGINT):
self.sig = sig
def __enter__(self):
self.interrupted = False