Skip to content

Instantly share code, notes, and snippets.

View RahulJyala7's full-sized avatar
🎯
Focusing

Rahul Jyala RahulJyala7

🎯
Focusing
View GitHub Profile
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
@RahulJyala7
RahulJyala7 / a-mongodb-replica-set-docker-compose-readme.md
Created December 30, 2020 15:48 — forked from harveyconnor/a-mongodb-replica-set-docker-compose-readme.md
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

@RahulJyala7
RahulJyala7 / event-loop.md
Created November 7, 2020 15:31 — forked from EryouHao/event-loop.md
Depth in Event Loop, both browser and Node.js.

Depth in Event Loop

For those JavaScript programmers, event loop is an important concept, inevitably.

Literally, event loop is what JavaScritp uses to implement non-blocking execution. Understanding how the event loops works internally would benefit you a lot when programming in JavaScript.

There are two major environments JavaScript runs in: browser and Node.js.

Browser

@RahulJyala7
RahulJyala7 / Event Loop Fun
Last active October 29, 2020 17:08
Event Loop fun
https://stackoverflow.com/questions/56312692/what-is-the-difference-between-child-process-and-worker-threads
const fs = require('fs');
(function mainline() {
process.nextTick(() => {
console.log('A');
});
console.log('B');
setTimeout(() => {
console.log('C');
Types of Hashing
There are many different types of hash algorithms such as RipeMD, Tiger, xxhash and more, but the most common type of hashing used for file integrity checks are MD5, SHA-2 and CRC32.
MD5 - An MD5 hash function encodes a string of information and encodes it into a 128-bit fingerprint. MD5 is often used as a checksum to verify data integrity. However, due to its age, MD5 is also known to suffer from extensive hash collision vulnerabilities, but it’s still one of the most widely used algorithms in the world.
SHA-2 – SHA-2, developed by the National Security Agency (NSA), is a cryptographic hash function. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of six hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256.
CRC32 – A cyclic redundancy check (CRC) is an error-detecting code often used for detection of accidental changes to data. Encoding the same data string using
@RahulJyala7
RahulJyala7 / gist:adb977c81c01fcc526b0820456cc8e59
Created March 27, 2020 20:25
Replication vs Partitioning vs Clustering vs Sharding
Replication - Copying an entire table or database onto multiple servers. Used for improving speed of access to reference records such as master data.
Partitioning - Splitting up a large monolithic database into multiple smaller databases based on data cohesion. Example - splitting a large ERP database into modular databases like accounts database, sales database, materials database etc.
Clustering - Using multiple application servers to access the same database. Used for computation intensive, parallelized, analytical applications that work on non volatile data.
Sharding - Splitting up a large table of data horizontally i.e. row-wise. A table containing 100s of millions of rows may be split into multiple tables containing 1 million rows each. Each of the tables resulting from the split will be placed into a separate database/server. Sharding is done to spread load and improve access speed. Facebook/twitter tables fit into this category.
@RahulJyala7
RahulJyala7 / Vectors
Created February 14, 2020 16:46
Vectors
In mathematics, "sparse" and "dense" often refer to the number of zero vs. non-zero elements in an array (e.g. vector or matrix).
---> A sparse array is one that contains mostly zeros and few non-zero entries.
---> A dense array contains mostly non-zeros.
here's no hard threshold for what counts as sparse; it's a loose term, but can be made more specific.
For example, a vector is k-sparse if it contains at most k non-zero entries. Another way of saying this is that the vector's ℓ0 norm is k.
(https://en.wikipedia.org/wiki/Norm_(mathematics))
@RahulJyala7
RahulJyala7 / Letex
Created December 29, 2019 11:53
Letex Docker
docker run --rm -i --user="$(id -u):$(id -g)" --net=none -v /"$PWD":/data blang/latex xelatex main.tex
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RahulJyala7
RahulJyala7 / enzyme_render_diffs.md
Created November 25, 2019 07:04 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render