Skip to content

Instantly share code, notes, and snippets.

View mdvsh's full-sized avatar
:shipit:
homework

Madhav Shekhar Sharma mdvsh

:shipit:
homework
View GitHub Profile
@mdvsh
mdvsh / notes.md
Created April 10, 2024 21:49
Nathan Hamish C++ game engine talk

notes

talk on high performance, safe C++ enngineering

slides

firsts done by him

  • discord stuff init, in game genAI, stadia
  • 25+ c++ exp
@mdvsh
mdvsh / script.py
Created June 23, 2023 17:09
mem regex search for large exp log files to find mean of steps to success
import re, mmap
pattern = rb'pick_rsteps\s*:\s*(\d+)\s+place_rsteps\s*:\s*(\d+)'
expfnam = ["svfu", "svu", "mr"]
nf = 10
for exp in expfnam:
means = []
for i in range(nf):
with open(f"dat/{exp}{i}.txt", "r") as file:
with mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as mmap_file:
@mdvsh
mdvsh / intro-num-methods.py
Created April 4, 2023 23:36
supporting recitation i did on wed 4/4
# newton raphson table generator
import math
def f(x):
return x**2 + 2*x - 8
def df(x):
return 2*x + 2
def newton_raphson(x0, f, df, n):
@mdvsh
mdvsh / mog.py
Created November 21, 2022 18:08
example mog use
class MoG:
def __init__(self, means, sigma, weights=None, td="cpu"):
if weights is None:
weights = torch.ones(means.shape[0], device=td) / means.shape[0]
self.means = means.detach()
mix_d = D.Categorical(weights)
comp_d = D.Independent(D.Normal(self.means, sigma * torch.ones(means.shape, device=td)), 2) # 2 needed to interpret M as batch
self.mixture = D.MixtureSameFamily(mix_d, comp_d)
def sample(self, n=None):
@mdvsh
mdvsh / pdf.py
Last active January 29, 2022 00:38
A dope discord bot (son of Bruh) I wrote to complement the existing bot (BruhBot) on my Class's Discord Server. HIGHLIGHT : Notes Generator and Markov Chain Chatbot
from fpdf import FPDF
from PIL import Image
def makePdf(pdfFileName, listPages, dir = ''):
if (dir):
dir += "/"
cover = Image.open(dir + str(listPages[0]))
width, height = cover.size
@mdvsh
mdvsh / build_notes.sh
Created January 10, 2022 23:08
misc files for backing and building notes for eecs 281
for note in ./notes/*.md; do
sed -i -e 's/!\[\[\([^]]*\)\]\]/!\[\[\1\]\]\(https:\/\/github.com\/mdvsh\/eecs281\/blob\/main\/notes\/media\/\1\)/g' $note
done
find . -name '*.md-e' -exec rm -rf {} \;
@mdvsh
mdvsh / app.js
Last active June 21, 2021 07:15
const http = require("http");
const fs = require("fs");
const PORT = 4000;
const origin = `http://localhost:${PORT}`;
class Database {
constructor(fname) {
this.fn = `${fname}.json`;
let state = new Map();
@mdvsh
mdvsh / TTTadvanced.py
Last active May 5, 2021 08:34
Games, written in python : Hangman, Hunt The Wumpus (CLI), TicTacToe
'''
PvC Tic Tac Toe Game.
(AI)
'''
from random import randint
print("TicTacToe\nWelcome, You are X. The computer is O.\n\nLet's Start.")
@mdvsh
mdvsh / mangla_learning.py
Created October 16, 2020 16:43
isef scraper
from bs4 import BeautifulSoup
src = open('bhai.html', 'r')
import re, csv, pandas
soup = BeautifulSoup(src, 'lxml')
data = {}
table = soup.find("table", attrs={'class':'stripe'})
table_head = table.thead.find_all("tr")
heading = []
for th in table_head[0].find_all("th"):
heading.append(th.text.replace('\n', '').strip())

Keybase proof

I hereby claim:

  • I am pseudocodenerd on github.
  • I am sharmadhavs (https://keybase.io/sharmadhavs) on keybase.
  • I have a public key ASDJFyfMBp0wMDbnCggjHrwjD7PgIkMkKvdIQIINSO6gpQo

To claim this, I am signing this object: