Skip to content

Instantly share code, notes, and snippets.

View sschakraborty's full-sized avatar
💭
Lorem ipsum dolor sit amet

Sundar sschakraborty

💭
Lorem ipsum dolor sit amet
View GitHub Profile
@sschakraborty
sschakraborty / API_Specification_Format.json
Last active January 21, 2020 05:08
API Specification
{
"details": {
"name": "Create user API",
"description": "Creates user",
"creation_date": "21/01/2019",
"author": "SS Chakraborty"
},
"specification": {
"method": "GET/POST/PUT/DELETE",
"path": "/some/path/with/:pathParam/:pathParam/or/without/params",
@sschakraborty
sschakraborty / SpringFramework.txt
Last active October 30, 2019 09:04
Spring Framework principles / installation / technologies and notes
Setting up Spring Framework with Maven
Required dependencies are:
Log4j
jUnit
spring-webmvc
spring-jdbc
jackson-databind
javax.servlet-api
Components from architectural viewpoint
@sschakraborty
sschakraborty / RTree.py
Created June 16, 2019 14:36
Range update and query using Fenwick Tree (BI Tree)
class Fenwick:
def __init__(self, size):
self.size = size
self.array = [0] * size
def add(self, index, value):
while index >= 1 and index <= self.size:
self.array[index - 1] += value
index += (index & -index)
def get(self, index):
s = 0
@sschakraborty
sschakraborty / ParallelMultiplication.java
Last active May 12, 2022 22:43
Java Implementation for Matrix Multiplication in Parallel (Tested in Java 8)
import java.io.IOException;
import java.io.PrintWriter;
import java.io.OutputStreamWriter;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
/*
* SAMPLE OUTPUT
* Parallel Multiplication: 19648 millisecs
* Naive Multiplication: 45219 millisecs
@sschakraborty
sschakraborty / Hive_Installation.txt
Created June 21, 2018 01:34
Step-by-Step Procedure to install HIVE (2.3.3-tested)
1) Extract Hadoop as hadoop-2.9.1
2) Extract Hive inside Hadoop Directory
3) Set JAVA_HOME to JDK installation folder
4) Set HADOOP_HOME to hadoop extracted directory
5) Set HIVE_HOME to hive extracted directory
6) Add $HIVE_HOME/bin to PATH env var
7) Verify MySQL installation
8) Create hive-site.xml inside $HIVE_HOME/conf directory and put contents as given below
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@sschakraborty
sschakraborty / DBMS.txt
Last active May 24, 2018 23:29
Database Unleashed
Introduction to DBMS
Data / DBMS
DBA / Database Designer / End User
Data Abstraction
Advantages of DBMS
Architecture of DBMS
Schemas (Descriptions)
Physical / Internal
Logical / Conceptual
@sschakraborty
sschakraborty / LRC.c
Created May 13, 2018 03:19
Longitudinal Redundancy Check on 4 byte word
#include <stdio.h>
#include <sys/types.h>
#define BIT_STRING int32_t
int horizontal_parity(BIT_STRING b) {
int p = 0;
while(b > 0) {
p ^= (b & 0x1);
b >>= 1;
@sschakraborty
sschakraborty / VRC.c
Created May 13, 2018 02:56
Vertical Redundancy Check
#include <stdio.h>
#include <sys/types.h>
#define BIT_STRING int32_t
int main(int argc, char** argv) {
BIT_STRING b;
fscanf(stdin, "%d", &b);
// The logic for parity checking
@sschakraborty
sschakraborty / Banker.java
Created May 12, 2018 06:31
Banker's Algorithm in Java (commented)
// This is a very trivial implementation of
// Banker's algorithm
// Refer to https://www.geeksforgeeks.org/operating-system-bankers-algorithm/
import java.io.PrintWriter;
import java.io.OutputStreamWriter;
public class Banker {
/*
* The below function takes in the max and allocation
@sschakraborty
sschakraborty / PriorityQueue.java
Created May 11, 2018 01:43
Priority Queue using Iterative Max Heap (in Java 8)
public class PriorityQueue {
private static class MaxHeap {
private int size;
private Long[] array;
public MaxHeap(int size) {
this.size = 0;
this.array = new Long[size];
}