Skip to content

Instantly share code, notes, and snippets.

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

Lakshman lakshmankashyap

🏠
Working from home
View GitHub Profile
@lakshmankashyap
lakshmankashyap / Makefile
Created May 30, 2019 10:54 — forked from checkaayush/Makefile
Makefile to setup MongoDB Replica Set for development
# Setup local MongoDB Replica Set for development.
DB_ROOT ?= /tmp
DB1_PATH ?= ${DB_ROOT}/db1
DB2_PATH ?= ${DB_ROOT}/db2
DB3_PATH ?= ${DB_ROOT}/db3
DB1_PORT ?= 30000
DB2_PORT ?= 40000
DB3_PORT ?= 50000
@lakshmankashyap
lakshmankashyap / scalability.md
Created June 12, 2019 07:48 — forked from faressoft/scalability.md
Scalability Overview, Terms, and Methodologies

Instead of writing a long article I wrote this summary to give a good overview about software systems scalability by listing the main terms and methodologies that widely used to build stable systems that are able to scale and handle the increasing amont of users and data.

Index

  • Scalability
  • Terms System Quality Attributes
  • Failover
  • Load Balancer
  • MapReduce
  • Caching
@lakshmankashyap
lakshmankashyap / javascript_deep_dive.md
Created June 12, 2019 07:48 — forked from faressoft/javascript_deep_dive.md
JavaScript Deep Dive to Crack The JavaScript Interviews
@lakshmankashyap
lakshmankashyap / System Design.md
Created June 12, 2019 07:51 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@lakshmankashyap
lakshmankashyap / app.js
Created May 12, 2020 05:35 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@lakshmankashyap
lakshmankashyap / mongo_group_by_day.js
Created August 17, 2020 13:32 — forked from cschlyter/mongo_group_by_day.js
MongoDB: group data by day (group)
db.link_access.group(
{
keyf: function(doc) {
var date = new Date(doc.date);
var dateKey = (date.getMonth()+1)+"/"+date.getDate()+"/"+date.getFullYear()+'';
return {'day': dateKey};
},
cond: {short_id: "N"},
initial: {count:0},
reduce: function(obj, prev) {prev.count++;}
@lakshmankashyap
lakshmankashyap / mongo_group_by_day.js
Created August 17, 2020 13:32 — forked from cschlyter/mongo_group_by_day.js
MongoDB: group by day (aggregate)
var mention_id = 620996;
db.mentionStats.aggregate([
{ $match: {'mention_id': mention_id}},
{ $group: {'_id': {
'year': { '$year': "$verification_date" },
'month': { '$month': "$verification_date" },
'day': { '$dayOfMonth': "$verification_date" }
},
'retweets': { $last: "$retweets" }}},
@lakshmankashyap
lakshmankashyap / findDatesInRange.js
Created August 17, 2020 13:32 — forked from cschlyter/findDatesInRange.js
MongoDB: Find dates in a range.
var start = new Date(2013, 5, 4)
var end = new Date(2013, 5, 6)
db.mention_stat.find({"verification": {"$gte": start, "$lt": end}})
@lakshmankashyap
lakshmankashyap / README.md
Created April 1, 2021 09:42
Node.js interview questions

Node.js interview questions

What is the architecture of node?

Application & Modules

This is where you write your application & installed modules live. Usually they are written in plain Javascript.

C/C++ bindings

@lakshmankashyap
lakshmankashyap / Install_robo3t_Ubuntu.md
Created November 11, 2021 10:02 — forked from abdallahokasha/Install_robo3t_Ubuntu.md
Install Robo3t on Ubuntu18.04 and make a desktop icon for it

Install Robo3t On Ubuntu 18.04

Download the package form Robo3t or using wget
wget https://download.robomongo.org/1.2.1/linux/robo3t-1.2.1-linux-x86_64-3e50a65.tar.gz
Extract here using

tar -xvzf robo3t-1.2.1-linux-x86_64-3e50a65.tar.gz