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 contextlib | |
import os | |
import random | |
import sys | |
from copy import deepcopy | |
import numpy as np | |
import pandas as pd | |
import seaborn as sns |
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 torch | |
from contextlib import contextmanager | |
_capture_inputs_dict = {} | |
_capture_inputs_active = False | |
@contextmanager | |
def capture_inputs(): |
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 random | |
import sys | |
class probability: | |
"""Based on https://stackoverflow.com/questions/12594148/skipping-execution-of-with-block""" | |
def __init__(self, probability): | |
assert probability >= 0 and probability <= 1 | |
self.probability = probability |
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 time | |
import contextlib | |
import queue | |
import threading | |
from collections import defaultdict | |
from typing import List, NamedTuple | |
import pandas as pd | |
import torch |
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
from typing import Any, Dict, List, Union | |
def main(): | |
# shortcuts | |
d = Dom() | |
svg, circle, rect, g = d.svg, d.circle, d.rect, d.g | |
print( | |
svg( |
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 tempfile | |
from zipfile import ZipFile | |
import hashlib | |
import json | |
zipf = ZipFile("slides.sketch") | |
with tempfile.TemporaryDirectory() as d: | |
for file in zipf.infolist(): | |
if file.filename.startswith("pages/"): |