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
# for testing interenet speed every hour | |
import time | |
from speedtest_cli import speedtest | |
data_list = [] | |
while True: | |
dlspeed, ulspeed = speedtest() | |
data_list.append((dlspeed, ulspeed, time.strftime("%H:%M:%S"))) |
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
# Use theano to do binary search over continuous monotonic increasing function | |
import theano | |
import theano.tensor as T | |
import numpy as np | |
def func(x): | |
return T.exp(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
"""Logging to file and stdout at the same time""" | |
import logging | |
import sys | |
def config_logging(filename='example.log', format="%(message)s"): | |
logging.basicConfig( | |
filename=filename, | |
format=format, |
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 sys | |
import torch | |
import torch.utils | |
import torch.nn as nn | |
from torch.autograd import Variable | |
from torchvision import models | |
try: | |
import gpustat | |
except ImportError: |
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 sys | |
import gym | |
env = gym.make(sys.argv[1]) | |
env.reset() | |
for _ in range(1000): | |
env.render() | |
env.step(env.action_space.sample()) # take a random action |