Skip to content

Instantly share code, notes, and snippets.

View MidpriceDog's full-sized avatar

midpricedog MidpriceDog

View GitHub Profile
@MidpriceDog
MidpriceDog / prettify.py
Created October 17, 2023 15:28
Prettify Terminal
from termcolor import colored
def print_bold(text):
"""Prints text in bold
Parameters
----------
text : str
text to print in bold
@MidpriceDog
MidpriceDog / vig.py
Last active January 26, 2023 17:42
vig function linked to my substack
def vig(odds_arr):
"""Calculate vig based on odds offered
Parameters
----------
odds_arr : list
Odds being offered by a sportsbook
Returns
-------
float
Vig collected by the sportsbook
@MidpriceDog
MidpriceDog / ExportCommand.md
Last active January 10, 2023 20:12
Add change to PATH to ~/.bash_profile

For a system-wide installation for a package named PACKAGE

export PATH=$PATH:/usr/local/PACKAGE/bin
@MidpriceDog
MidpriceDog / run_html_in_browser.md
Created January 6, 2023 23:52
Run HTML file in browser using localhost
@MidpriceDog
MidpriceDog / check_mps_availability.py
Created December 23, 2022 07:00
Check if Mac with M1 Chip has MPS device activated for GPU accelerated PyTorch
def check_mps_availability():
import torch
# Note: Your Mac must have an M1 Chip and have installed MacOS 12.1+
if torch.backends.mps.is_available():
mps_device = torch.device("mps")
x = torch.ones(20, device=mps_device)
print(x)
print(torch.backends.mps.is_built())
else:
print("mps not avail")
@MidpriceDog
MidpriceDog / CloningRepoToEC2Instance.md
Created December 5, 2022 03:19
Cloning a GitHub Repo to an EC2 Instance

Cloning a GitHub Repo into an EC2 instance

This gist will walk you through getting a GitHub repo cloned in an EC2 instance for MacOS or Linux. The below steps assumes you have an EC2 instance launched. If you do not, follow the AWS docs here.

Creating ED25519 public and private key pair

Follow the steps outlined under Generating a new SSH key. Once complete, return here.

Copy the public key from the file you just saved your newly generated public key to the clipboard by pasting the below in terminal. The default name would be id_ed25519.pub which we assume throughout the rest of the guide. If you saved the public key to a different file name during generation of the new SSH key, substitute that file name in for id_ed25519.pub.