Skip to content

Instantly share code, notes, and snippets.

View Phyrom's full-sized avatar

Phyrom Phat Phyrom

View GitHub Profile
@Phyrom
Phyrom / aws-amplify-build-settings-cache-static-files.yml
Created June 17, 2020 13:37 — forked from mrcoles/aws-amplify-build-settings-cache-static-files.yml
Sample file caching custom headers to add to an AWS Amplify build-settings.yml file
frontend:
customHeaders:
# cache static assets! (can I just use a glob for this, e.g., '**/*.{js,css,gif,ico,jpg,png,svg,mp4,webm}' ?)
# js
- pattern: '**/*.js'
headers: [ { key: 'Cache-Control', value: 'public,max-age=31536000,immutable' } ]
# css
- pattern: '**/*.css'
headers: [ { key: 'Cache-Control', value: 'public,max-age=31536000,immutable' } ]
# images
@Phyrom
Phyrom / LambdaConstants.java
Created May 12, 2018 02:06 — forked from seeebiii/LambdaConstants.java
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
public class Constants {
/**
* Contains the path to your Lambda function code.
*/
public static final String LAMBDA_TASK_ROOT = System.getenv("LAMBDA_TASK_ROOT");
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10
@Phyrom
Phyrom / handler.js
Created May 10, 2018 17:04 — forked from kidsil/handler.js
Get AWS Cognito Token ID (JWT) with JavaScript (NodeJS)
const AWS = require('aws-sdk');
const CognitoSDK = require('amazon-cognito-identity-js-node');
AWS.CognitoIdentityServiceProvider.AuthenticationDetails = CognitoSDK.AuthenticationDetails;
AWS.CognitoIdentityServiceProvider.CognitoUserPool = CognitoSDK.CognitoUserPool;
AWS.CognitoIdentityServiceProvider.CognitoUser = CognitoSDK.CognitoUser;
const Username = 'testuser';
const TempPassword = 'TemporaryPassword2!';
const NewPassword = 'NewPassword@#@!19';
const Email = 'some@email.com';