Skip to content

Instantly share code, notes, and snippets.

Hacking Cloud Foundry

Lakshman Diwaakar lakshmantgld

Hacking Cloud Foundry
View GitHub Profile
View General Description
║ Lambda-Proxy ║ Lambda ║
║ This is a simple, but powerful integration. All the ║ This is complex, but offers more control over transmission ║
║ request to the APIGateway URL is forwarded ║ data. The request can be modified before it is ║
║ straight to the Lambda and the response is sent ║ sent to lambda and the response can be modified ║
║ from Lambda. i.e No modifications to the ║ after it is sent from lambda. This can be done by ║
║ request(query params, body, variables) and ║ mapping templates which transforms the payload, as per ║
║ response(status code, message) are done ║ the user customisations. API Gat
View try
║ Features ║ lambda-proxy ║ lambda ║
║ General ║ This is a simple, but powerful integration. All the request ║ This is complex, but offers more control over transmission data. ║
║ Description ║ and response to the APIGateway URL is forwarded ║ The request and response can be modified before it is sent to ║
║ ║ straight to the Lambda. ║ lambda. This can be done by mapping templates which transforms ║
║ ║ i.e No modifications to the request(query par
lakshmantgld / cloudSettings
Last active Oct 23, 2017
Visual Studio Code Settings Sync Gist
View cloudSettings
View handler.js
if (!global._babelPolyfill) require('babel-polyfill');
import { Promise as bbPromise } from 'bluebird';
import AWS from 'aws-sdk';
const lambda = new AWS.Lambda({
region: 'ap-northeast-1'
module.exports.wakeup = (event, context, callback) => {
View serverless.yml
service: stakinet-wakeup
name: aws
runtime: nodejs6.10
cfLogs: true
timeout: 20
lakshmantgld / buildspec.yml
Last active Jun 30, 2018
config file for the codeBuild
View buildspec.yml
version: 0.2
# Yarn installation
- curl -sS | sudo apt-key add -
- echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get -y update
- apt-get install -y yarn
lakshmantgld /
Last active Nov 25, 2021
Configuring slack webhook

A Webhook, in simple terms, is a user-defined HTTP callback. It is a mechanism for the system to notify you about an event. In our case, we need to send messages to a particular channel in slack. Slack calls in Incoming Webhook. It is a mechanism to send messages to your Slack Channel from external sources. These external sources could be any application or service that is capable of sending a JSON payload over HTTP into a Slack Channel. Each Channel will be identified by a unique Incoming Webhook URL to which you can post the message from outside. This configuration is done via the Integrations for your channel.

Steps to create a incoming webhook in Slack:

  1. Naviagte to the Incoming Webhook URL. Click the hyper link incoming webhook integration below the heading Incoming Webhooks.
  2. You will be asked to enter your team URL, followed by your slack credentials.
  3. Once you have completed the above step, you will see the wizard kind of webpage to
lakshmantgld /
Last active May 21, 2018
Documenting cronJob with examples

Cron is an utility program which is a time-based job scheduler in Unix-like computer operating systems. It can also be combined with AWS Lambda to invoke function based on the time-scheduler.

CronJob is represented as space-delimited 5 character string. Here is the syntax:

+---------------- minute (0 - 59)
 |  +------------- hour (0 - 23)
 |  |  +---------- day of month (1 - 31)
 | | | +------- month (1 - 12)
lakshmantgld /
Last active May 25, 2022
Free Sales Tax API based on Postal code by Avalara

Sales Tax API

There are many companies providing sales tax API. Out of all the companies, Avalara offers free API service for sales Tax. This gist is all about setting up avalara API and querying it.

The Free-To-Use API by avalara has some restrictions. Usage of this API is subject to rate limits. Users who exceed the rate limit will receive HTTP response code 429 - Too Many Requests. The requirement for this API is to create an avalara free trail account. You can create a free account using this link create free account.

Once you have filled the form from above link, you will get an e-mail containing temporary credentials to login the avalara account. The e-mail will look something like this:

Avalara e-mail


How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.