Skip to content

Instantly share code, notes, and snippets.

View gotocva's full-sized avatar
🎯
Focusing

Sivabharathy K P gotocva

🎯
Focusing
View GitHub Profile
const express = require('express');
const cors = require('cors');
const app = express();
const env = require('dotenv').config().parsed;
const fs = require('fs');
const pm2 = require("pm2");
@gotocva
gotocva / angular-indexeddb.ts
Created February 16, 2024 04:05
Angular Indexed DB implementation
import { Injectable } from '@angular/core';
import Dexie, { Table } from 'dexie';
interface PostInterface {
id?: number;
name?: string;
age?: number;
date_of_birth?: string;
}
@gotocva
gotocva / nginx-subdomain-ssl.md
Created January 11, 2024 04:27
Nginx subdomain configuration with ssl

sudo nano /etc/nginx/sites-available/subdomain.maindomain.in

server {
    server_name subdomain.maindomain.in;  # Replace with your domain

    access_log /var/log/nginx/access.log;
const axios = require('axios');
const https = require('https');
const cheerio = require('cheerio');
const agent = new https.Agent({
rejectUnauthorized: false
});
const init = async () => {
const response = await axios.get(`https://sivabharathy.in`, { httpsAgent: agent });
@gotocva
gotocva / $lookup-example.md
Created January 4, 2024 09:31
Mongodb $lookup example

In MongoDB, the $lookup stage is used in the aggregation pipeline to perform a left outer join between documents from two collections. This allows you to combine documents from one collection with documents from another based on a specified condition.

Here's an example of using $lookup in MongoDB, assuming you have two collections: orders and products. The goal is to retrieve information about orders along with details about the products they reference:

Suppose you have the following collections:

  1. orders collection:
[

MEAN Stack Cheat-Sheet

Those who want to become a Full Stack Developer their first choice is MEAN Stack because it has a lot of scopes and easy to learn as well but preparing is hard so Here's a Cheat Sheet - Inspired by The Technical Interview Cheat Sheet.md

Cheating

This list is meant to be both a quick guide and reference for further research into these topics. It's basically a summary of important topics, there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

What the heck is MEAN Stack

@gotocva
gotocva / nodejs-best-practices-01.js
Created July 29, 2023 15:54
NodeJS best practices
// for global variables names we use the const/let keyword and UPPER_SNAKE_CASE
let MUTABLE_GLOBAL = "mutable value"
const GLOBAL_CONSTANT = "immutable value";
const CONFIG = {
key: "value",
};
// examples of UPPER_SNAKE_CASE convention in nodejs/javascript ecosystem
// in javascript Math.PI module
const PI = 3.141592653589793;
@gotocva
gotocva / unicode-emoji.txt
Created January 9, 2023 06:15
Emojis unocde
# emoji-data.txt
# Date: 2019-01-15, 12:10:05 GMT
# © 2019 Unicode®, Inc.
# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
# For terms of use, see http://www.unicode.org/terms_of_use.html
#
# Emoji Data for UTS #51
# Version: 12.0
#
# For documentation and usage, see http://www.unicode.org/reports/tr51
@gotocva
gotocva / udp-client-server.js
Created August 10, 2022 13:18
Simple UDP client and server implementation in node.js
var udp = require('dgram');
// --------------------creating a udp server --------------------
// creating a udp server
var server = udp.createSocket('udp4');
// emits when any error occurs
server.on('error',function(error){
console.log('Error: ' + error);
@gotocva
gotocva / deploy-node-as-a-service.service
Created June 30, 2022 04:54
deploy node project as a service
nearly every Linux distribution comes with systemd, which means forever, monit, PM2, etc. are no longer necessary - your OS already handles these tasks.
Make a myapp.service file (replacing 'myapp' with your app's name, obviously):
[Unit]
Description=My app
[Service]