Skip to content

Instantly share code, notes, and snippets.

View shivam1283's full-sized avatar
🎯
Focusing

Shivam Yadav shivam1283

🎯
Focusing
View GitHub Profile
@shivam1283
shivam1283 / HTTP2.0.md
Created June 5, 2022 17:44
Networking

Traditional HTTP requests flow throught the network "pipe" (TCP connection) and the pipe only allows requests to flow in 1 direction ("to" or "from") and only 1 request can be be sent through the at once (Single-plexing).
Image

HTTP 1.1 allows browser to form 6 such TCP connections to the server. This approach was quite expensive as servers held resource descritptors which eats a lot of server memory. Image

HTTP2 enabled multiplexing thought the same network pipe. The pipe has different streams and each stream carriers an ID which lets client map the responses to its respective client.

HTTP2

@shivam1283
shivam1283 / csrf.md
Last active December 26, 2022 06:10
security.md

Cross-site request forgery (also known as CSRF) is a web security vulnerability that allows an attacker to induce users to perform actions that they do not intend to perform. In a successful CSRF attack, the attacker causes the victim user to carry out an action unintentionally.

For a CSRF attack to be possible, three key conditions must be in place:

  1. A relevant action. There is an action within the application that the attacker has a reason to induce. This might be a privileged action (such as modifying permissions for other users) or any action on user-specific data (such as changing the user's own password).
  2. Cookie-based session handling. Performing the action involves issuing one or more HTTP requests, and the application relies solely on session cookies to identify the user who has made the requests. There is no other mechanism in place for tracking sessions or validating user requests.
  3. No unpredictable request parameters. The requests that perform the action do not contain an
@shivam1283
shivam1283 / 1PromisesAndCallback.md
Last active December 21, 2022 08:31
JS concepts

Callback

function loadScript(src) {
  // creates a <script> tag and append it to the page
  // this causes the script with given src to start loading and run when complete
  let script = document.createElement('script');
  script.src = src;
  document.head.append(script);
}
@shivam1283
shivam1283 / ConceptsToCover.md
Last active December 15, 2022 06:44
React Concepts
@shivam1283
shivam1283 / androidSetup.md
Last active August 1, 2022 07:39
Android studio set up

Array wrapper

drag and drop to upload

@shivam1283
shivam1283 / 1introduction.md
Last active May 7, 2022 10:26
[Javascript design patterns] #js #development

Pattern is a reusable solution to a commonly occuring problem. A pattern is a reusable solution that can be applied to commonly occurring problems in software design. templates for how we solve problems

Types of design pattern

  1. Creational pattern
  2. Structural pattern
  3. Behavioural pattern

Benefits

@shivam1283
shivam1283 / linkTag.md
Last active March 10, 2022 11:11
[Web Performance]

preload

<link rel="preload" href='./style.css' >

Advantages

  • The preload property enables browser to load resources tha will be required very soon in the page rendering lifecycle, before the main rendering kicks in.
  • The call for resources can be prioritised.
  • Store in the cache for future requests.
@shivam1283
shivam1283 / 1.Setup.md
Last active March 9, 2022 12:38
[Django setup] django setup and tutorials

Install drf

pip install djangorestframework

Create project

django-admin startproject <project name>

Initial migrations

python manage.py migrate

Run server