Skip to content

Instantly share code, notes, and snippets.

Hacking Cloud Foundry

Lakshman Diwaakar lakshmantgld

Hacking Cloud Foundry
View GitHub Profile
eneko / list-of-curl-options.txt
Last active May 18, 2022
List of `curl` options
View list-of-curl-options.txt
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
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)
sapessi /
Last active Oct 26, 2021
Continuous deployment of React websites to Amazon S3

Continuous deployment of React websites to Amazon S3

This sample includes a continuous deployment pipiline for websites built with React. We use AWS CodePipeline, CodeBuild, and SAM to deploy the application. To deploy the application to S3 using SAM we use a custom CloudFormation resource.

Files included

  • buildspec.yml: YAML configuration for CodeBuild, this file should be in the root of your code repository
  • configure.js: Script executed in the build step to generate a config.json file for the application, this is used to include values exported by other CloudFormation stacks (separate services of the same application).
  • index.js: Custom CloudFormation resource that publishes the website to an S3 bucket. As you can see from the buildspec and SAM template, this function is located in a s3-deployment-custom-resource sub-folder of the repo
  • app-sam.yaml: Serverless Application model YAML file. This configures the S3 bucket and the cu

Route-based chunking

Many of us building single-page apps today use JavaScript module bundling tools that trend towards a monolithic "bundle.js" file including the full app and vendor code for multiple routes. This means if a user lands on any arbitrary route they need to wait for a large bundle of JS to be fetched, parsed and executed before the application is fully rendered and interactive.

screen shot 2016-09-28 at 4 45 52 pm

This is a little backwards, especially when apps are used under real-world network (3G) and device

View Cognito Federated oauth + API Gateway IAM auth + Lambda for serverless
TO USE THIS client:
- Go to the google developer console and get your client id. This is pretty
well documented somewhere else. Use your localhost(:port)? as url to work in
your local as always.
- Go to AWS and create a new Federated identity pool
* Associate an Authenticated role and Unauthenticated role to the pool
At least you need cognito-identity and apigateway, edit this for your needs
leonardofed /
Last active May 24, 2022
A curated list of AWS resources to prepare for the AWS Certifications

A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


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.
hassy / lambda.js
Last active Oct 5, 2021
Different behavior of context.succeed() vs callback() in AWS Lambda
View lambda.js
// Lambda's timeout needs to be >5 seconds, 10 should do
var startedAt = new Date();
var interval = setInterval(function () {
console.log(startedAt, new Date());
}, 1000);
stesie / index.html
Created Apr 1, 2016
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>
View gist:734c75ef176795a77527
- Self documenting. Exploring data becomes trivial.
- Mobile devs can request everything once
- Mobile devs only get the data they need
- You don’t have to know your active record relations.
- You have to manually write all end points
- Attributes can become bloated. Suppose we make a breaking update to an attribute. The solution is to create a new attribute.