Skip to content

Instantly share code, notes, and snippets.

View amkhrjee's full-sized avatar

Aniruddha Mukherjee amkhrjee

View GitHub Profile
@amkhrjee
amkhrjee / structs.c
Created March 11, 2024 15:31
Common Structs in Network Programming
// Address Info
struct addrinfo {
int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc.
int ai_family; // AF_INET, AF_INET6, AF_UNSPEC
int ai_socktype; // SOCK_STREAM, SOCK_DGRAM
int ai_protocol; // use 0 for "any"
size_t ai_addrlen; // size of ai_addr in bytes
struct sockaddr *ai_addr; // struct sockaddr_in or _in6
char *ai_canonname; // full canonical hostname
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE_LENGTH 500
#define MAX_TOKENS 1000
void addToken(Token, Token *, int *);
int scanToken(char *, int, Token *, int *);
void scanTokens(char *, long, Token *, int *);
@amkhrjee
amkhrjee / RedTriangle.cpp
Created April 4, 2023 16:37
OpenGL boilerplate that generates a red triangle 🔺
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include<iostream>
static unsigned int CompileShader(unsigned int type, const std::string& source)
{
unsigned int id = glCreateShader(type);
const char* src = source.c_str();
glShaderSource(id, 1, &src, nullptr);
glCompileShader(id);

x86 Assembly Cheatsheet

Jumps based on Unsigned comparisons

Mnemonic Description
JA Jump if above
JNBE Jump if not below or equal (same as JA)
JAE Jump if above or equal
JNB Jump if not below (same as JAE)
@amkhrjee
amkhrjee / init.vim
Last active March 5, 2023 06:01
nvim configuration file
call plug#begin('~/AppData/Local/nvim/plugged')
" below are some vim plugins for demonstration purpose.
" add the plugin you want to use here.
Plug 'joshdick/onedark.vim'
Plug 'iCyMind/NeoSolarized'
Plug 'sainnhe/everforest'
"Plug 'dense-analysis/ale'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'nvim-tree/nvim-web-devicons' " optional, for file icons
@amkhrjee
amkhrjee / browser.txt
Last active February 23, 2023 14:50
What happens when you enter an URL in your browser
What happens when you enter an URL in your browser:
1. Browser sends a request to the DNS server IP
2. The request goes to the switch
3. The switch sends all connected devices a packet and waits for the correct IP to respond with its MAC address
4. The switch sends the mac address back to the browser
5. The browser sends the url resolution request to the switch
6. The switch forwards the request to the DNS server
7. The DNS server resolves the url into an IP and sends it back to the switch
8. The switch sends it back to the browser
9. The browser sends http request to the IP via the switch
#!/usr/bin/bash
#***************************************#
# #
# setalias.sh #
# Aniruddha Mukherjee #
# October 12, 2022 #
# Set shell aliases quickly #
# #
#***************************************#

Differential eqns are just eqns having derivatives in them. Often times it's easier to describe natural phenomenon in terms of rates of changes than absolute values. And hence, there comes differential eqns!!!

Derivaties are linear operators, so adding up two different solutions will also be a solution.

The general solution of a differential eqns contains all the possble solutions of that eqn.

Implict eqns are not nice, so try to make them nice and y = f(x) form of stuff.

Isocline: Iso = same, cline = inclination Given a family of curves, isocline is the set of points at which some member of the family attains a given slope.

Why are minterms called 'min'terms and maxterms called 'max'terms?

The terms max and min has nothing to do with one being greater than the other in any manner, in fact they are boolean values so that's not even possible.

The terms min and max rather has to do with satisfiability of each of the terms. For a POS term (essentially ANDs) - there can be ony one combinaion for which it's value will be truthy(1) out of all the possible combinations. Hence it has 'minimum satisfiability'. And hence the term 'minterm'.

Similarly, for SOPs(essentially ORs) there can be only one combination for which the result will be falsy(0) and hence it has maximum satisfiabllity and hence the term 'maxterm'.

@amkhrjee
amkhrjee / SSRvsSSGvsCSR.md
Created March 9, 2022 13:40
Different Types of Websites