Skip to content

Instantly share code, notes, and snippets.

View vinaymavi's full-sized avatar
🏠
Working from home

Vinay Kumar vinaymavi

🏠
Working from home
View GitHub Profile
replication:
replSetName: "rs0"
net:
bindIp: localhost,<hostname(s)|ip address(es)>
const http = require('http');
exports.handler = async (event) => {
// TODO implement
const response = await getURL();
return response;
};
function getURL(){
console.log("GET URL");
for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done
for remote in `git branch | grep -v /HEAD`; do git push backup $remote -f ; done
@vinaymavi
vinaymavi / index.js
Created April 15, 2019 04:12
Google-Cloud-Vision-Serverless-Implementation
/**
* Google Cloud Vision integration
*/
const vision = require("@google-cloud/vision");
// Creates a client
const client = new vision.ImageAnnotatorClient();
exports.vision_serverless = function(req, res) {
if (req.method === "POST") {
@vinaymavi
vinaymavi / buildspec.yml
Created December 5, 2018 02:50
AWS code build configuration for angular project CI and CD setup.
version: 0.2
phases:
install:
commands:
# Get Chrome Information
- curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
- apt-get -y update
# Install chrome
@vinaymavi
vinaymavi / protractor-configuration-for-ci-cd
Created December 5, 2018 02:37
protractor configuration for chrome headless support for CI and CD setup.
capabilities: {
chromeOptions: {
args: ['--headless', '--disable-gpu', '--window-size=800x600','--disable-dev-shm-usage','--no-sandbox']
},
browserName: "chrome"
},
@vinaymavi
vinaymavi / angular-karma-configuration-for-ci-cd
Last active April 4, 2019 21:20
This Gist contains karma configuration for CI and CD setup for angular projects.
browsers: ["HeadlessChrome"],
customLaunchers: {
HeadlessChrome: {
base: "ChromeHeadless",
flags: [
"--no-sandbox", // required to run without privileges in Docker
"--disable-web-security",
"--disable-gpu",
"--remote-debugging-port=9222"
]
@vinaymavi
vinaymavi / index.js
Created October 15, 2018 12:21
Node.js configuration management example index.js file.
// Load .env file
require('dotenv').config()
const express = require('express');
const config = require('./src/config')
const app = express();
const port = process.env.PORT || 3000
app.get("*",(req,res)=>{
res.setHeader("Content-Type","application/json")
res.send(JSON.stringify(config));
@vinaymavi
vinaymavi / index.js
Created October 15, 2018 11:14
Node.js configuration management example src/config/index.js file.
const env = process.env.ENV || "DEV";
switch (env) {
case "DEV":
module.exports = require("./development.config");
break;
default:
module.exports = require("./production.config");
}