Skip to content

Instantly share code, notes, and snippets.

View pengzhenghao's full-sized avatar
🤩
Focusing

Zhenghao Peng pengzhenghao

🤩
Focusing
View GitHub Profile
@pengzhenghao
pengzhenghao / visualize.py
Created May 6, 2019 09:33
A beautiful choice interface
index = input("You are giving a exp_dir which supposed to contain only one trial, "
"but we found many. \nPlease input the index of the trial you want to "
"visualize:\n\n{}\nYour index:".format(
"".join(["{}: {}\n".format(i, t) for i, t in enumerate(potential_trial_paths)])))
"""The output look as following, it's quite clean.
You are giving a exp_dir which supposed to contain only one trial, but we found many.
Please input the index of the trial you want to visualize:
0: /Users/pengzhenghao/ray_results/debug/PPO_tollgate_0_2019-04-09_21-10-02k6f8lt62
from collections import deque
class FPSTimer(object):
def __init__(self, log_interval=10):
self.cnt = 0
self.log_interval = log_interval
self.queue = deque(maxlen=log_interval)
self.queue.append(time.time())
@pengzhenghao
pengzhenghao / tmp.sh
Created January 22, 2019 04:21
How to write a python list in bash
#!/usr/bin/env bash
arr=(1 10 100)
for d in ${arr[*]}
do
echo $d
echo
done