Skip to content

Instantly share code, notes, and snippets.

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

Vignesh Ramesh VRamazing

🏠
Working from home
View GitHub Profile
@VRamazing
VRamazing / ShortestPath.py
Created February 15, 2025 16:44
Shortest Path
my_graph = {
'A': [('B', 5), ('C', 3), ('E', 11)],
'B': [('A', 5), ('C', 1), ('F', 2)],
'C': [('A', 3), ('B', 1), ('D', 1), ('E', 5)],
'D': [('C',1 ), ('E', 9), ('F', 3)],
'E': [('A', 11), ('C', 5), ('D', 9)],
'F': [('B', 2), ('D', 3)]
}
def shortest_path(graph, start, target = ''):
@VRamazing
VRamazing / appmodel.js
Created February 20, 2025 15:29
Mongoose model
require('dotenv').config();
// TODO move to singleton pattern
const mongoose = require("mongoose")
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }, (err)=> {
console.log("DB Error", err)
});
@VRamazing
VRamazing / mongoose.js
Created March 13, 2025 11:40
Mongoose Schema and queries
const mongoose = require('mongoose');
const express = require('express');
const app = express();
const PORT = 3000;
app.use(express.json());
// Set mongoose strictQuery
mongoose.set('strictQuery', true);