Skip to content

Instantly share code, notes, and snippets.

from fastapi import FastAPI,Request
from pydantic import BaseModel
import uvicorn
from smslottery import validate_bet
from fastapi.middleware.cors import CORSMiddleware
origins = ["*"]
class Data(BaseModel):
game:str
text:str
@j-thepac
j-thepac / Excel.md
Last active June 25, 2023 04:19
Excel Operations

Excel

  1. Each Function = New Column
  2. Apply to 1 Cell , later extend
  3. All Rows A:A
  4. "this is string"

String

=LEN(C1)

Big O Notation :

  • asymptotic notations to calculate the running time
  • longest amount of time an algorithm can possibly take to complete

DataStructure (Create,access,Search,Insert,Update,Delete)

  • String

  • Array / 2D aray

  • LinkedList (Create ,append , display , ReverseDisplay, remove , Change value, Update By Index

      class LinkedList:
    

def init(self,i):

HTML CSS JAVASCRIPT REACT

  • Node : Engine which executes javaScript

HTML ( templates : index.html,script.js,style.css)

  1. Attributes
    • href="URL"
    • id =""
  2. Important Tags
"""
to Convert json data to Rows and Columns
[{"data":[["2","2xg","2Q"],["1","3xg","3Q"]],"schema":[{"columnName":"CASE_UID","ordinal":0,"dataTypeName":"varchar"},{"columnName":"QUOTE_ID","ordinal":1,"dataTypeName":"varchar"},{"columnName":"OPP_NO","ordinal":2,"dataTypeName":"varchar"}]}]
"""
from pyspark.sql.functions import *
from pyspark.sql.types import *

NGINX with DOCKER

Summary

  • Serving Static Content (HTML, CSS, JavaScript)
  • Reverse Proxy (load balancing ): forward requests from clients to backend servers which handle the requests.
  • API Gateway(distributing traffic): Acts as a single entry point for all API requests and distributing traffic
  • SSL/TLS Termination: it decrypts incoming traffic, inspects it, and then re-encrypts it before sending it to the backend servers.
  • Caching: NGINX can also be used as an HTTP cache, which can improve website performance by caching frequently requested content and serving it directly from memory
  • load balancing

Mongo

Note : For Mongo Cloud

  • Set Password: Select Cluster > Security >Select User > Edit
  • Add IP : Select Cluster > Security > Network Access > Add IP Address

ref:

SQL VS MongoDB

  • Database = Database
@j-thepac
j-thepac / pyspark.md
Last active March 16, 2023 11:16
Install Pyspark in Mac

Pre-Req:

  • Install Python 3.9
  • Find the location of python ($which python) and Keep it handy
  • pip3 install ipython #optional
  • pip3 install pyspark
  • Download apache spark zip > Unzip to a Path
@j-thepac
j-thepac / scikit-learn.md
Last active April 4, 2023 07:38
ML / AI

ML

dataset

  • input data (features or predictors)
    • Example - student's age, gender, previous grades, etc.
    • numpy array or pandas DataFrame
    • denoted by the variable X.
  • target data (response or labels)
    • Eg = student's final grade or pass/fail status.
    • numpy array or pandas DataFrame
  • denoted by the variable Y.

Versioning

  1. Calender Versioning
  2. Semantic Versioning

Calender Versioning

https://calver.org/

  • ubuntu 16.04 = Ubuntu October,2016
  • Pycharm 2022.3.2