Skip to content

Instantly share code, notes, and snippets.

View wintermonster's full-sized avatar

Nikhil Ahuja wintermonster

View GitHub Profile
@wintermonster
wintermonster / aws_helper_funcs.py
Last active March 7, 2025 09:09
AWS Multipart Upload with etag checks
import hashlib
from pathlib import Path
from typing import Optional
import boto3
import math
# Etag Calculation funcs take from https://stackoverflow.com/a/77362525
def get_local_etag(path: Path, chunk_size_bytes: Optional[int] = None) -> str:
"""Calculates an expected AWS s3 upload etag for a local on-disk file.
@wintermonster
wintermonster / races.py
Created December 9, 2022 04:12
Solution to the cycling problem
list_of_races = [[('c','d'), ('a','b'),('b','c')],
[('C', 'B'), ('D', 'C'), ('B', 'E'), ('A', 'D')]]
for races in list_of_races:
print(races)
races = dict(races)
start_city = (set(races.keys()) - set(races.values())).pop()
end_city = (set(races.values()) - set(races.keys())).pop()
all_cities = list(set(races.keys()).union(set(races.values())))
activate="E:\_virtual_envs\$*\Scripts\activate"
listenvs=ls 'E:\_virtual_envs'
virtualenv=virtualenv "E:\_virtual_envs\$*"