Skip to content

Instantly share code, notes, and snippets.

View thoughtspeed7's full-sized avatar

Raj Chaudhary thoughtspeed7

View GitHub Profile
@thoughtspeed7
thoughtspeed7 / index.js
Created April 23, 2018 11:22
Reusing Mongoose Schema
// om namah shivay
const mongoose = require('mongoose');
const user = require('./user');
const test = () => {
const user_model = new user.user_model();
user_model._id = new mongoose.Types.ObjectId();
@thoughtspeed7
thoughtspeed7 / output.js
Created April 23, 2018 11:24
Reusing Mongoose Schema
{
"mobile": {
"country_code": "91",
"number": "0000000000"
},
"roaming_mobile": {
"country_code": "44",
"number": "1111111111"
},
"_id": "5addc20ef5566233587c252c",
@thoughtspeed7
thoughtspeed7 / aws-cli-lambda-deploy-policy.json
Created May 15, 2018 12:17
CI / CD for AWS Lambda using GCP's Container Builder and Bitbucket!
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "lambda:UpdateFunctionCode",
"Resource": "*"
}
]
@thoughtspeed7
thoughtspeed7 / Dockerfile
Created May 17, 2018 13:10
CI / CD for AWS Lambda using GCP's Container Builder and Bitbucket!
# om namah shivay
FROM python:2.7-alpine
RUN apk update
RUN apk add zip
RUN pip install awscli
@thoughtspeed7
thoughtspeed7 / cloudbuild.yaml
Created May 17, 2018 13:16
CI / CD for AWS Lambda using GCP's Container Builder and Bitbucket!
# om namah shivay
steps:
# build the docker image
- name: gcr.io/cloud-builders/docker
args:
- build
- -t
- gcr.io/$PROJECT_ID/aws-cli
@thoughtspeed7
thoughtspeed7 / index.js
Created May 17, 2018 13:43
CI / CD for AWS Lambda using GCP's Container Builder and Bitbucket!
// om namah shivay
exports.handler = (event, context, callback) => {
callback(null, 'Hello world! This is version 1.');
};
@thoughtspeed7
thoughtspeed7 / cloudbuild.yaml
Created May 17, 2018 16:20
CI / CD for AWS Lambda using GCP's Container Builder and Bitbucket!
# om namah shivay
secrets:
- kmsKeyName: projects/[PROJECT_ID]/locations/global/keyRings/[KEY_RING_NAME]/cryptoKeys/[KEY_NAME]
secretEnv:
AWS_ACCESS_KEY_ID: [BASE_64_ENCRYPTED_AWS_ACCESS_KEY_ID]
AWS_SECRET_ACCESS_KEY: [BASE_64_ENCRYPTED_AWS_SECRET_ACCESS_KEY]
steps:
@thoughtspeed7
thoughtspeed7 / index.js
Created May 17, 2018 16:22
CI / CD for AWS Lambda using GCP's Container Builder and Bitbucket!
// om namah shivay
exports.handler = (event, context, callback) => {
callback(null, 'Hello world! This is version 2.');
};
@thoughtspeed7
thoughtspeed7 / index.js
Created May 23, 2018 13:13
Apollo GraphQL Server on Google App Engine in under 5 minutes!
// om namah shivay
// see https://www.apollographql.com/docs/apollo-server/example.html for more info
const express = require('express');
const bodyParser = require('body-parser');
const { graphqlExpress, graphiqlExpress } = require('apollo-server-express');
const { makeExecutableSchema } = require('graphql-tools');
// Some fake data
@thoughtspeed7
thoughtspeed7 / package.json
Last active May 23, 2018 17:38
Apollo GraphQL Server on Google App Engine in under 5 minutes!
{
"name": "apollo-graphql-server-google-app-engine",
"version": "1.0.0",
"description": "Apollo GraphQL Server on Google App Engine in under 5 minutes!",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Raj Chaudhary",