Skip to content

Instantly share code, notes, and snippets.

Always deliver more than expected.

Luiz Freneda lfreneda

Always deliver more than expected.
View GitHub Profile
enricop89 / cloudformation-role.json
Created Sep 27, 2019
Serverless IAM Permission
View cloudformation-role.json
"Version": "2012-10-17",
"Statement": [
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
neotreat / http-security-headers-lambda-cloudfront.js
Last active Aug 28, 2018
Add HTTP Security Headers to Cloudfront with Lambda@Edge.
View http-security-headers-lambda-cloudfront.js
'use strict';
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
// Add security headers
const securityHeaders = [
mplatts / 0firebase_functions_cheatsheet.js
Last active Feb 7, 2020
Firebase functions cheatsheet
View 0firebase_functions_cheatsheet.js
// Core
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const db = admin.database();
uid: uid,
displayName: displayName,
photoURL: photoURL
dmfay / collapse.js
Last active Sep 6, 2017
Collapse JOIN query result sets into a hierarchical object graph
View collapse.js
'use strict';
* Collapses tabular result sets into a (hierarchical) object graph based on
* column nomenclature. Given a query that selects parent and child columns as
* parent__id, parent__val, children__id, children__val, this will return an
* array of objects in the form
* {id: 1, val: 'parent val', children: [{id: 11, val: 'child val'}]}
mooniker /
Last active Aug 16, 2020 — forked from facultymatt/
Roles and permissions system for Nodejs

ACL / Roles + Permissions

Virgen-ACL (virgen-acl)

  • "Simple in-memory ACL for node.js apps. Supports arbitrary roles and resources, including role/resource detection using a simple interface. Additionally supports custom assertions for more complex rules."
  • Comments: "Simple and elegant, create your own checks. No middleware?"

Node ACL (acl) BuildStatusDependency StatusdevDependency Status

ippeiukai / cron.conf
Last active Apr 30, 2019
Running cron in AWS ElasticBeanstalk web tier.
View cron.conf
mode: "000777"
owner: 'ec2-user'
group: 'ec2-user'
content: |
30 02 * * * sudo /usr/sbin/execute-in-eb-node-app 'node bin/is-eb-master.js' && sudo /usr/sbin/execute-in-eb-node-app 'npm run daily-maintenance'
encoding: plain

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.
View ascii-art-browser-console.js
* © 2016 - Julián Acosta
* License: CC BY-SA 4.0 (
* Print your own logo in developer tools!
* Step 1: Convert your logo to ASCII text here: (I used color output)
* Note: Is possible that you'll have to resize your photo in order to retain aspect ratio
* Step 2: Remove the <pre></pre> tag that is surrounding the generated code, replace with "[" and "]"
* Step 3: Run the following regexes (*DON'T ALTER THE ORDER*) in order to convert to JSON (Works in PHPStorm and Sublime Text 2):
aemonge / prepare-commit-msg
Last active Feb 12, 2021
Angular Commit Message Conventions git hook, so you got your commit prepared to with the messages they expect ;)
View prepare-commit-msg
firstLine=`head -2 $1 | tail -1`
if [[ $firstLine == \#* ]]; then # Testing that the file starts with a comment, not yet a real commit ;)
echo '<type>(<component>): <subject>' > .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '<body>' >> .prepare-commit-msg-temp
echo '' >> .prepare-commit-msg-temp
echo '# types: feat, fix, docs, style, refactor, test, chore(mantean)' >> .prepare-commit-msg-temp
raineorshine /
Last active Feb 14, 2021
How to set up user authentication for a Chrome Extension using the Chrome Identity API

How to set up user authentication for a Chrome Extension using the Chrome Identity API

  1. Create a private key file, from which you can create the manifest key and Application ID, as detailed here:
  2. Add the manifest key to "key" in manifest.json
  3. Create a new project in Google Developer Console
  4. Go to "APIs & auth > Credentials" and create new client id for a Chrome Application using the Application ID generated in step 3.
  5. Copy the Client ID to oauth2.client_id in the manifest.json