Skip to content

Instantly share code, notes, and snippets.

Hacking Cloud Foundry

Lakshman Diwaakar lakshmantgld

Hacking Cloud Foundry
View GitHub Profile
lakshmantgld /
Last active Feb 2, 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

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 / handler.js
Created Feb 29, 2020
Lambda snippet to upload file to S3
View handler.js
'use strict';
const AWS = require('aws-sdk');
// Set the Region
accessKeyId: '***********',
secretAccessKey: '*************',
region: 'us-east-1',
signatureVersion: 'v4'
View lambda-integration-serverless.yml
handler: handler.hello
- http:
path: users
method: get
integration: lambda
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
lakshmantgld / index.html
Created Mar 16, 2017 — forked from stesie/index.html
AWS IoT-based serverless JS-Webapp Pub/Sub demo
View index.html
<!doctype html>
<meta charset="UTF-8">
<title>AWS IoT Pub/Sub Demo</title>
<h1>AWS IoT Pub/Sub Demo</h1>
<button type="button" id="connect">connect!</button>
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 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 / serverless.yml
Created Oct 21, 2016
dynamoDB in serverless.yml
View serverless.yml
Type: "AWS::DynamoDB::Table"
- AttributeName: "eventId"
AttributeType: "S"
- AttributeName: "googleUserName"
AttributeType: "S"
View error-lambda-integration.js
module.exports.hello = (event, context, callback) => {
const errorResponse = {
message: "Error! Dude You sent the wrong parameters"
// Use JSON.Stringify(), else Integration Response
// cannot read your error message.
// If not used, the Integration Response will read
// the response as [Object Object] which will make it
// impossible to detect the status code.