Skip to content

Instantly share code, notes, and snippets.

# First layer of container is built from DotNetCore with zip utilities
FROM microsoft/dotnet:latest
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install zip -y
RUN apt install python3-pip -y
RUN pip3 install awscli
# Second layer of container is built with Ubuntu with AWS CLI etc.
FROM ubuntu:latest
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
@syalam
syalam / lambda-event-source.tf
Last active July 28, 2018 16:11
lambda can event source from sqs
# Event source from SQS
resource "aws_lambda_event_source_mapping" "event_source_mapping" {
event_source_arn = "${var.terraform_queue_arn}"
enabled = true
function_name = "${aws_lambda_function.test_lambda.arn}"
batch_size = 1
}
@syalam
syalam / lambda.tf
Created July 28, 2018 16:09
lambda terraform
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
@syalam
syalam / sqs.tf
Created July 28, 2018 16:07
terraform sqs queue
resource "aws_sqs_queue" "terraform_queue" {
name = "terraform-example-queue"
delay_seconds = 90
max_message_size = 2048
message_retention_seconds = 86400
receive_wait_time_seconds = 10
redrive_policy = "{\"deadLetterTargetArn\":\"${aws_sqs_queue.terraform_queue_deadletter.arn}\",\"maxReceiveCount\":4}"
tags {
Environment = "production"
{"Records":[{"eventVersion":"1.03","userIdentity":{"type":"Root","principalId":"412098244858","arn":"arn:aws:iam::412098244858:root","accountId":"412098244858","userName":"blast","invokedBy":"elasticbeanstalk.amazonaws.com"},"eventTime":"2016-04-18T23:54:16Z","eventSource":"elasticloadbalancing.amazonaws.com","eventName":"DescribeInstanceHealth","awsRegion":"us-west-2","sourceIPAddress":"elasticbeanstalk.amazonaws.com","userAgent":"elasticbeanstalk.amazonaws.com","requestParameters":{"loadBalancerName":"awseb-e-c-AWSEBLoa-41A3QP7RV0RG"},"responseElements":null,"requestID":"dc40c2eb-05c0-11e6-8d7e-97b4585276d6","eventID":"c6f80986-453b-40a0-905c-ef9ba4bf0c49","eventType":"AwsApiCall","apiVersion":"2012-06-01","recipientAccountId":"412098244858"},{"eventVersion":"1.03","userIdentity":{"type":"Root","principalId":"412098244858","arn":"arn:aws:iam::412098244858:root","accountId":"412098244858","userName":"blast","invokedBy":"elasticbeanstalk.amazonaws.com"},"eventTime":"2016-04-18T23:55:23Z","eventSource":"elasti
{"Records":[{"eventVersion":"1.03","userIdentity":{"type":"Root","principalId":"412098244858","arn":"arn:aws:iam::412098244858:root","accountId":"412098244858","userName":"blast","invokedBy":"elasticbeanstalk.amazonaws.com"},"eventTime":"2016-04-18T23:54:16Z","eventSource":"elasticloadbalancing.amazonaws.com","eventName":"DescribeInstanceHealth","awsRegion":"us-west-2","sourceIPAddress":"elasticbeanstalk.amazonaws.com","userAgent":"elasticbeanstalk.amazonaws.com","requestParameters":{"loadBalancerName":"awseb-e-c-AWSEBLoa-41A3QP7RV0RG"},"responseElements":null,"requestID":"dc40c2eb-05c0-11e6-8d7e-97b4585276d6","eventID":"c6f80986-453b-40a0-905c-ef9ba4bf0c49","eventType":"AwsApiCall","apiVersion":"2012-06-01","recipientAccountId":"412098244858"},{"eventVersion":"1.03","userIdentity":{"type":"Root","principalId":"412098244858","arn":"arn:aws:iam::412098244858:root","accountId":"412098244858","userName":"blast","invokedBy":"elasticbeanstalk.amazonaws.com"},"eventTime":"2016-04-18T23:55:23Z","eventSource":"elasti
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private boolean prepareVideoRecorder(){
// BEGIN_INCLUDE (configure_preview)
mCamera = CameraHelper.getDefaultCameraInstance();
// We need to make sure that our preview and recording video size are supported by the
// camera. Query camera to find all the sizes and choose the optimal size given the
// dimensions of our preview surface.
Camera.Parameters parameters = mCamera.getParameters();
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private boolean prepareVideoRecorder(){
// BEGIN_INCLUDE (configure_preview)
mCamera = CameraHelper.getDefaultCameraInstance();
// We need to make sure that our preview and recording video size are supported by the
// camera. Query camera to find all the sizes and choose the optimal size given the
// dimensions of our preview surface.
Camera.Parameters parameters = mCamera.getParameters();