Skip to content

Instantly share code, notes, and snippets.

View lobster1234's full-sized avatar
🎯
Focusing

Manish Pandit lobster1234

🎯
Focusing
View GitHub Profile
@lobster1234
lobster1234 / lambda.md
Last active February 28, 2017 20:58
My notes from the AWS Lambda Deep Dive webinar

AWS Lambda

Lambda is the key enabler and a core AWS component for serverless computing. Lets you run the code you want, without worrying about the underlying infrastructure and provisioning. It is also cost efficient, as there are no instances that are in running state but idle. Lambda handles scaling up and scaling down as needed, transparently to the customer.

Components

  • Event Source - Changes in state of the resources or data, or any events triggered explicitly or implicitly. A large number of AWS services can act as Event Sources - Like S3 (Object PUT, DELETE..), DynamoDB, IoT, CloudFormation, CloudWatch, SNS, API Gateway and Cron schedule to name a few.

  • Function - The piece of code that would be run when that event occurs. The function can access any services downstream if needed. Currently Supported languages are Node.js, Python, Java 8 and C#.

Use cases

  • Stateless, event-based file/data processing.
@lobster1234
lobster1234 / serverless_framework_java_maven.md
Last active January 23, 2024 21:18
Tutorial for running the templated maven-java serverless project using the serverless framework.

Working with Serverless and Java - Part 1

In this tutorial, we will create and deploy a java-maven based serverless service using the serverless project (https://serverless.com/). In this part we will not modify any code, or even look at the generated code. We will focus on the deployment and the command line interface provided by serverless. Serverless is a node.js based framework that makes creating, deploying, and managing serverless functions a breeze. We will use AWS as our FaaS (Function-as-a-Service) provider.

Pre-requisites

Here is what the setup on my Mac looks like (Sierra)

  • brew (1.1.10) - you will need this if you do not have node/npm installed already.
  • node (v7.6.0)
  • npm (4.1.2)
  • Apache Maven (3.2.5)
@lobster1234
lobster1234 / localstack.md
Last active August 8, 2023 20:06
Working with localstack on command line

Starting localstack

C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
@lobster1234
lobster1234 / config.xml
Created April 24, 2017 23:45
This is the config.xml for Jenkins Build of helloworld-api project
<?xml version='1.0' encoding='UTF-8'?>
<maven2-moduleset plugin="maven-plugin@2.15.1">
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.2.0">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
@lobster1234
lobster1234 / config.xml
Created April 25, 2017 04:56
Hello World API Packer Jenkins Job
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>Build</name>
@lobster1234
lobster1234 / Dockerfile
Created July 27, 2017 09:49
Dockerfile to run tomcat in an ubuntu container
FROM ubuntu:latest
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install openjdk-8-jdk wget
RUN mkdir /usr/local/tomcat
RUN wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.16/bin/apache-tomcat-8.5.16.tar.gz -O /tmp/tomcat.tar.gz
RUN cd /tmp && tar xvfz tomcat.tar.gz
RUN cp -Rv /tmp/apache-tomcat-8.5.16/* /usr/local/tomcat/
EXPOSE 8080
CMD /usr/local/tomcat/bin/catalina.sh run
@lobster1234
lobster1234 / Main.java
Last active August 9, 2017 04:20
Quick Test for reflection vs. new vs. cached
package com.marqeta.mqpay;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
System.out.println("via Reflection took " + instantiateViaReflection() + " milliseconds");
System.out.println("via New took " + instantiateAsNew() + " milliseconds");
@lobster1234
lobster1234 / nutch-site.xml
Created August 16, 2017 03:44
Nutch Configuration file for MongoDB Store
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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
@lobster1234
lobster1234 / gora.properties
Created August 16, 2017 03:48
Nutch 2.x gora.properties file to support MongoDB
############################
# MongoDBStore properties #
############################
gora.datastore.default=org.apache.gora.mongodb.store.MongoStore
gora.mongodb.override_hadoop_configuration=false
gora.mongodb.mapping.file=/gora-mongodb-mapping.xml
gora.mongodb.servers=localhost:27017
gora.mongodb.db=nutchdb
@lobster1234
lobster1234 / ivy.xml
Created August 16, 2017 03:55
The ivy/ivy.xml from Nutch 2.x to enable MongoDB
<?xml version="1.0" ?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
You 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 distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS