This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code to test myself on powers of 2 from 2^1 to 2^11 | |
# 2^[0-3,10] (easy), 2^4 = 4^2 = 16, 2^5 = 32 (3+2=5), 2^6 = 64 ("6"4), 2^7 = 128 (8-1=7), 2^8 = 256 (2+6=8), 2^9 = 2^(10-1) = 512 | |
[("-"*20).join((lambda x: (f"{x:3d}",str(1<<x)))(random.randint(1,11))) for _ in range(100)] | |
# Code to test myself on hex and binary for nibbles | |
# 0-4,7,8 (easy), 5 = 0b101 (10>>1), 6 = 0b110 (4+2), 9 = 0b1001 (8+1), 10 = 0xa (characters look similar), 11 = 0xb (stem of b char), | |
# 12 = 0xc (the hook of the 2 is similar to c) = 0b1100 (8+4), 13 = 0xd (three somewhat = dee) = 0x1101 (01 similar to d), | |
# 14 = 0xe (four + e = free) = 0b1110 = (0xf-0x1), 15 = 0xf ("F"ive) = 0b1111 | |
[(lambda x: f"{x:>3d}"+"-"*20+hex(x)+"-"*20+bin(x))(random.randint(1,15)) for _ in range(100)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Train ResNet on CIFAR10 in a single file using PyTorch.""" | |
import argparse | |
import json | |
import os | |
import pandas as pd | |
import time | |
import torch | |
import torch.optim as optim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{ysavani} | |
\title{} | |
\author{ | |
Yash Savani \\ | |
Computer Science Department \\ | |
Carnegie Mellon University \\ | |
Pittsburgh, PA 15213 \\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fontforge | |
from pathlib import Path | |
import os | |
import re | |
import requests | |
response = requests.get( | |
"https://api.github.com/repos/microsoft/cascadia-code/releases", | |
{"Accept": "application/vnd.github.v3+json"} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char (isSpace) | |
words' :: String -> [String] | |
words' [] = [] | |
words' ls = tail (foldr step [] (' ':ls)) | |
where | |
step x (y:ys) | |
| isSpace x = if null y then []:ys else []:y:ys | |
| otherwise = (x:y):ys | |
step x _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- General purpose Haskell functions to remember (Note I have ommited the typeclasses here for simplicity) | |
-- Bryan O'Sullivan, Don Stewart, and John Goerzen. Real World Haskell, O'Reilly Media, 2008 | |
-- Length of list | |
-- O(n) | |
-- ✅(empty list) -> total / safe | |
-- Python: len(list) | |
length :: [a] -> Int | |
-- Tells if a list is empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List (sortBy) | |
import Data.Function (on) | |
type Vector = (Double, Double) | |
data Direction | |
= LeftDir | |
| RightDir | |
| ForwardDir | |
| NoDir |