Skip to content

Instantly share code, notes, and snippets.

View FBI23's full-sized avatar
🐢
Yarp

Yatin Badal FBI23

🐢
Yarp
View GitHub Profile

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.
@FBI23
FBI23 / cloudflare-worker-force-lowercase.js
Created June 19, 2019 14:31 — forked from availit/cloudflare-worker-force-lowercase.js
Cloudflare worker script to rewrite requests to lowercase, to prevent duplicate page URLs
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Fetch and log a request
* @param {Request} request
*/
async function handleRequest(request) {
let url = request.url
### Keybase proof
I hereby claim:
* I am fbi23 on github.
* I am yatin (https://keybase.io/yatin) on keybase.
* I have a public key ASDLk1ZiQb_SF5exK-Bh4zIhBX3ftPXgNoGCimzXXm868wo
To claim this, I am signing this object:
@FBI23
FBI23 / create-csv.sh
Created February 17, 2019 19:19 — forked from jexp/create-csv.sh
import git-log into neo4j with LOAD CSV
echo sha1,hash,parents,author_email,author_name,refs,subject,timestamp,date_time > git_log.csv
git log --reverse --format='format:"%H","%h","%P","%ae","%an","%d", "%s","%at","%ai"' >> git_log.csv
# Download and Unzip Neo4j
# Start Neo4j
/path/to/neo4j-community-2.1.5/bin/neo4j start
# Start Neo4j-Shell with your data
@FBI23
FBI23 / git-commit-log-stats.md
Created February 13, 2019 09:36 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@FBI23
FBI23 / AWS Security Resources
Created October 18, 2018 15:29 — forked from chanj/AWS Security Resources
AWS Security Resources
INTRO
I get asked regularly for good resources on AWS security. This gist collects some of these resources (docs, blogs, talks, open source tools, etc.). Feel free to suggest and contribute.
Short Link: http://tiny.cc/awssecurity
Official AWS Security Resources
* Security Blog - http://blogs.aws.amazon.com/security/
* Security Advisories - http://aws.amazon.com/security/security-bulletins/
* Security Whitepaper (AWS Security Processes/Practices) - http://media.amazonwebservices.com/pdf/AWS_Security_Whitepaper.pdf
* Security Best Practices Whitepaper - http://media.amazonwebservices.com/AWS_Security_Best_Practices.pdf
@FBI23
FBI23 / doodad.js
Created September 20, 2018 07:19
Basic Auth Apollo server Node Js Lambda Serverless
import { graphqlLambda } from "apollo-server-lambda";
import { makeExecutableSchema } from "graphql-tools";
import resolvers from "../resolvers";
import typeDefs from "../schema.graphql";
import { renderPlaygroundPage } from "graphql-playground-html";
const graphql = graphqlLambda((event, context) => {
const headers = event.headers;
const functionName = context.functionName;
@FBI23
FBI23 / golang-nuts.go
Created December 21, 2017 11:43 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
This file has been truncated, but you can view the full file.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
@FBI23
FBI23 / Redirect to admin.php
Last active May 2, 2017 09:47
How to redirect WordPress frontend to the backendhttp://www.wprecipes.com/how-to-redirect-wordpress-frontend-to-the-backend
<?php
//Redirect To Admin Url WP
header("Location: ".get_admin_url());
exit();
?>