Skip to content

Instantly share code, notes, and snippets.

View lakshmantgld's full-sized avatar
⚒️
Hacking Cloud Foundry

Lakshman Diwaakar lakshmantgld

⚒️
Hacking Cloud Foundry
View GitHub Profile
@lakshmantgld
lakshmantgld / serverless.yml
Created October 21, 2016 00:59
dynamoDB in serverless.yml
resources:
Resources:
DynamoDbTable:
Type: "AWS::DynamoDB::Table"
Properties:
AttributeDefinitions:
- AttributeName: "eventId"
AttributeType: "S"
- AttributeName: "googleUserName"
AttributeType: "S"
@lakshmantgld
lakshmantgld / index.html
Created March 16, 2017 06:27 — forked from stesie/index.html
AWS IoT-based serverless JS-Webapp Pub/Sub demo
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>AWS IoT Pub/Sub Demo</title>
</head>
<body>
<h1>AWS IoT Pub/Sub Demo</h1>
<form>
<button type="button" id="connect">connect!</button>

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.
@lakshmantgld
lakshmantgld / salesTax.md
Last active May 2, 2024 04:24
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
lakshmantgld / cronJob.md
Last active May 21, 2018 02:27
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
lakshmantgld / slackWebhook.md
Last active February 7, 2024 03:57
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
lakshmantgld / buildspec.yml
Last active June 30, 2018 04:13
config file for the codeBuild
version: 0.2
phases:
install:
commands:
# Yarn installation
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get -y update
- apt-get install -y yarn
service: stakinet-wakeup
package:
exclude:
provider:
name: aws
runtime: nodejs6.10
cfLogs: true
timeout: 20
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) => {
@lakshmantgld
lakshmantgld / cloudSettings
Last active October 23, 2017 01:32
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-10-23T11:31:35.410Z","extensionVersion":"v2.8.3"}