Skip to content

Instantly share code, notes, and snippets.

View adityajn105's full-sized avatar

Aditya Jain adityajn105

View GitHub Profile
WEBVTT
00:11.000 --> 00:13.000
<v Roger Bingham>We are in New York City
00:13.000 --> 00:16.000
<v Roger Bingham>We’re actually at the Lucern Hotel, just down the street
00:16.000 --> 00:18.000
<v Roger Bingham>from the American Museum of Natural History
@adityajn105
adityajn105 / checkers_agent.py
Created May 9, 2021 18:05
A MiniMax (Alpha-Beta) pruning agent to play game of checkers.
from random import random
inp = open("input.txt", "r")
single = inp.readline().strip() == 'SINGLE'
white = inp.readline().strip() == 'WHITE'
remain_time = float(inp.readline().strip())
board = []
for i in range(8):
board.append( inp.readline().lstrip() )
inp.close()
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@adityajn105
adityajn105 / common_interview_codes.md
Last active November 26, 2024 06:59
Common interview codes
@adityajn105
adityajn105 / Readme.md
Last active November 18, 2020 03:32
Important Linux Command
  1. Process related command
  • top - real time view of all process running
  • ps -aus - snapshot of all process running
  • kill -9 PID - kill a process with PID as process id.
  • nohup cmd > logs.out & - Run a process in background and deattach from terminal.
  • screen - Start a screen terminal (-r restore, -ls view, Ctrl-A + d deattach screen)
  1. Filesystem related
  • ls -la - list all files in current directory
  • **wc -l ** - Count number of lines in a file
# Decile chart, LIFT, KS
def getDeciles(models, X, y, n=10):
probs = predict_probas(gbms,X)[:,1]
cuts = pd.qcut(probs,n)
df = pd.DataFrame({'DECILE':cuts,"P":probs,'Y':y}).groupby('DECILE').Y.value_counts().unstack(fill_value=0)[::-1]
df.index = [ f"{i+1} {df.index[i]}" for i in range(n) ]
df.columns = ['ZEROS','ONES']
df['POPULATION'] = df.ZEROS+df.ONES
df['EVENT_RATE'] = df.ONES/df.POPULATION
df['CUMULATIVE_EVENT_RATE'] = df.ONES.cumsum()/df.POPULATION.cumsum()
@adityajn105
adityajn105 / app.py
Created February 22, 2020 13:42
Flask Simple File Uploader
from flask import Flask, request
from werkzeug import secure_filename
import os
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = os.path.join(app.root_path,'uploads/')
if not os.path.exists(app.config['UPLOAD_FOLDER']): os.mkdir(app.config['UPLOAD_FOLDER'])
def make_page(notification=""):
return f"""
def settleDebt(debt_dict):
"""
Function to settle debt among group of people
Parameters
----------
debt_dict : dictionary of names and debt(expenses-paid)
sum of debts should be approximately zero
-ve means negative debt, +ve means positive debt
@adityajn105
adityajn105 / System Design.md
Created October 12, 2019 05:08 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@adityajn105
adityajn105 / webscrapper.py
Last active June 1, 2019 14:16
A web scrapping tutorial
from bs4 import BeautifulSoup
import urllib3
import re
import pandas as pd
http = urllib3.PoolManager()
link = "https://www.sitejabber.com/reviews/dream11.com"
#making http get request