Skip to content

Instantly share code, notes, and snippets.

View lzhbrian's full-sized avatar
😎
Interesting

Tzu-Heng Lin lzhbrian

😎
Interesting
View GitHub Profile
@lzhbrian
lzhbrian / boto3-list-instances.py
Created August 24, 2020 03:16 — forked from ableasdale/boto3-list-instances.py
Using Boto 3 to list out AWS EC2 instance information
import boto3
from termcolor import colored
ec2 = boto3.resource('ec2')
for i in ec2.instances.all():
print("Id: {0}\tState: {1}\tLaunched: {2}\tRoot Device Name: {3}".format(
colored(i.id, 'cyan'),
colored(i.state['Name'], 'green'),
@lzhbrian
lzhbrian / infinite_dataloader.py
Created November 13, 2020 04:06 — forked from MFreidank/infinite_dataloader.py
A pytorch DataLoader that generates an unbounded/infinite number of minibatches from the dataset.
from torch.utils.data import DataLoader
class InfiniteDataLoader(DataLoader):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Initialize an iterator over the dataset.
self.dataset_iterator = super().__iter__()
def __iter__(self):