Skip to content

Instantly share code, notes, and snippets.

View devarajchidambaram's full-sized avatar

devaraj devarajchidambaram

View GitHub Profile
@devarajchidambaram
devarajchidambaram / index.txt
Created September 23, 2019 12:34
Common Node.js deployment problems
Common Node.js deployment problems
Problems occurring in Node.js application deployments can have a range of symptoms, but can generally be categorized into the following:
Uncaught exception or error event in JavaScript code
Excessive memory usage, which may result in an out-of-memory error
Unresponsive application, possibly looping or hanging
Poor performance
Crash or abort in native code
Unexpected application behavior or functional issue
@devarajchidambaram
devarajchidambaram / app.js
Created August 29, 2019 12:56
React tutorials
import React from 'react';
import logo from './logo.svg';
import './App.css';
import Car1 from './Car'
// function App() {
// return (
// <div className="App">
// <h1>Helloworld</h1>
// </div>
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubernetes-tutorial-deployment
spec:
replicas: 1
selector:
matchLabels:
app: kubernetes-tutorial-deployment
template:
@devarajchidambaram
devarajchidambaram / index.js
Created March 22, 2019 08:08
Block event loop
const els = require('event-loop-stats')
console.log(els.sense())
const end = Date.now() + 50
setTimeout(() => {
console.log(els.sense())
}, 100)
@devarajchidambaram
devarajchidambaram / grpc_client.js
Last active March 12, 2019 04:57
grpc in nodejs
const grpc = require('grpc')
const PROTO_PATH = './notes.proto'
const NoteService = grpc.load(PROTO_PATH).NoteService
const client = new NoteService('localhost:50051',
grpc.credentials.createInsecure())
console.log('client', client)
module.exports = client
client.list({}, (error, notes) => {
const genericPool = require("generic-pool");
const DbDriver = require("mysql");
/**
* Step 1 - Create pool using a factory object
*/
const factory = {
create: function() {
return DbDriver.createConnection({
host: '192.168.8.221',
@devarajchidambaram
devarajchidambaram / three_sum.js
Last active March 7, 2019 09:43
problem solving
/**
* Three Sum
*
* Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique
* triplets in the array which gives the sum of zero.
*
* Note:
*
* The solution set must not contain duplicate triplets.
*
@devarajchidambaram
devarajchidambaram / cassandra.js
Created March 5, 2019 11:07
cassendra driver examples
var cassandra = require('cassandra-driver');
var PlainTextAuthProvider = cassandra.auth.PlainTextAuthProvider;
var client = new cassandra.Client({
contactPoints: ["50.112.59.244"],
authProvider: new PlainTextAuthProvider('iccassandra', '636fd7882101b8387d4fc43b1ea499ec'),
localDataCenter: 'AWS_VPC_US_WEST_2',
keyspace: 'keyspace'
});
@devarajchidambaram
devarajchidambaram / graph_ql.js
Last active February 28, 2019 10:52
Graphql example
//Refferd https://medium.com/codingthesmartway-com-blog/creating-a-graphql-server-with-node-js-and-express-f6dddc5320e1
var express = require('express');
var express_graphql = require('express-graphql');
var { buildSchema } = require('graphql');
// GraphQL schema
var schema = buildSchema(`
type Query {
course(id: Int!): Course
courses(topic: String): [Course]
@devarajchidambaram
devarajchidambaram / knex.js
Created February 28, 2019 06:17
knex tutorial
var Knex = require('knex')
var knex = Knex({
client: 'mysql',
connection: {
host: '192.168.8.221',
user: 'user_name',
password: 'some_pass',
database: 'vehicle'
}
});