Skip to content

Instantly share code, notes, and snippets.

View AaradhyaSaxena's full-sized avatar

Aaradhya Saxena AaradhyaSaxena

View GitHub Profile
@AaradhyaSaxena
AaradhyaSaxena / 01-Computer Networking.md
Last active November 27, 2023 18:11
Computer Networking

Computer Networking

What Is a Protocol?

Think of your routine conversations. They usually follow a general pattern dictated by predefined rules. For example, most conversations start with greetings and end with goodbyes.

Formally, according to the Oxford Dictionary, a protocol is “a set of rules governing the exchange or transmission of data between devices.”

TCP

The Transmission Control Protocol (TCP) is one such protocol. It was created to allow end systems to communicate effectively. The distinguishing feature of TCP is that it ensures that data reaches the intended destination and is not corrupted along the way.

@AaradhyaSaxena
AaradhyaSaxena / 01-CreditRisk-and-Financing.md
Last active November 27, 2023 18:12
WorldQuant-Financial Markets

Credit Risk and Financing

Bond Pricing

Consider a two-year bond. You receive a coupon, say, in six months. You receive another six months later, another six months later, and the last one in two years, along with the principal amount. So, if we think about the total amount, what we must consider is that the separate times will result in those amounts having different value today. In other words, we simply cannot add cash flows at all different time points in the future and expect to have a straightforward way to sum them today.

Suppose we have $1,000 invested for one year at 4%. What we're doing is something called future valuing. This helps us to calculate what that $1,000 will be 1 year from now. The answer is $1,040. What if we did that problem in reverse? What if we discounted $1,040 that we receive one year from now to today’s dollars? This is known as present-valuing. What is that worth today?

Discounting

When you take an amount in the present and imagine how much it's worth in the future,

@AaradhyaSaxena
AaradhyaSaxena / 01-Chapter-1.md
Last active November 8, 2024 11:19
Book Summary: Intelligent Investor

Chapter1: Investment vs Speculation

He defines investing as the process of analyzing stocks and investing in companies with solid fundamentals and a margin of safety. On the other hand, he defines speculation as the process of buying and selling stocks based on market trends or other speculative factors.

Graham emphasizes that investing is a rational and analytical process, while speculation is an emotional and impulsive process. He warns that speculators often get caught up in the excitement of the market and make irrational decisions that can lead to significant losses.

The chapter goes on to explain the concept of intrinsic value, which is the true value of a company based on its earnings, assets, and other fundamentals. Graham argues that investors should focus on investing in companies that are undervalued in the market relative to their intrinsic value, rather than trying to time the market or make short-term gains.

Graham also introduces the concept of a margin of safety, which is the difference

@AaradhyaSaxena
AaradhyaSaxena / 1. models.md
Last active February 27, 2023 12:04
Recommendation-Models-Google-Cloud

About recommendation models

(https://cloud.google.com/retail/docs/models)

The Retail API offers the following recommendation model types:

  • Others You May Like
  • Frequently Bought Together (shopping cart expansion)
  • Recommended for You
  • Similar Items
  • Buy it Again
  • On-sale
@AaradhyaSaxena
AaradhyaSaxena / 01- Locust.md
Last active March 30, 2023 05:01
Load/Performance Testing

Locust

Events

If you want to run some setup code as part of your test, it is often enough to put it at the module level of your locustfile, but sometimes you need to do things at particular times in the run. For this need, Locust provides event hooks.

test_start and test_stop

If you need to run some code at the start or stop of a load test, you should use the test_start and test_stop events. You can set up listeners for these events at the module level of your locustfile:

from locust import events
@AaradhyaSaxena
AaradhyaSaxena / gensim.md
Last active February 27, 2023 11:24
gensim

Gensim

list all the keys

list(model.wv.index_to_key)

List n most similar products

sims = model.wv.most_similar('computer', topn=10) # get other similar words

Redis #

Redis is an in-memory data structure store that can be used as a caching engine. Since it keeps data in RAM, Redis can deliver it very quickly.

Keys: The key in Redis is a binary-safe String, with a max size of 512 MB.

Values: Supports String, List, Set, Sorted Set, Hash.

Commands:

  • SET key value

Django Project

Some initial setup ,auto-generate some code that establishes a Django project.

  • A collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings.
  • A project may contain multiple apps.
django-admin startproject mysite
@AaradhyaSaxena
AaradhyaSaxena / Decorators.md
Last active February 27, 2023 11:30
Python

Decorators in Python

A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate.

def uppercase_decorator(function):
    def wrapper():
        func = function()
        make_uppercase = func.upper()
 return make_uppercase

Personalization - RIL

Introduction

The key idea is to use the opinions and behaviors of users to suggest and personalize relevant and interesting content for them.

Eg: Lets say there are 2 users, one with history of buying Samsung products, and the other Apple products. Then when they type in phone in search, the U1 should see samsung phones at the top and U2 should see iphones at the top of the result.

What we want is to get the User Embeddings, and the product Embeddings of Products from the search result, calculate which product embeddings are closer to a particular user and then based on their similarity score boost the popularity score of the product.

What do I mean by the Embeddings? We put the product/user data in some model and project it into an N-dimensional space. Then a product is represented by a N-dimensional vector which is the co-ordinate of that point in that space. Now, the model is trained such that 2 products which are similar to each other will be closer to each other. The emb