Skip to content

Instantly share code, notes, and snippets.

@ziritrion
ziritrion / pythonenvs.md
Last active April 21, 2024 19:16
Cheatsheet for Conda, Pipenv

Conda

  1. Create a virtual environment
    • conda create --name my_env_name python=3.8 or whatever Python version you may need.
  2. List available envs (2 different ways
    • conda env list
    • conda info --envs
  3. Activate virtual env
    • conda activate my_env_name
  4. Deactivate current environment
@andrewjong
andrewjong / pytorch_image_folder_with_file_paths.py
Last active February 27, 2024 09:24
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
@jayspeidell
jayspeidell / kaggle_download.py
Last active July 18, 2023 12:23
Sample script to download Kaggle files
# Info on how to get your api key (kaggle.json) here: https://github.com/Kaggle/kaggle-api#api-credentials
!pip install kaggle
api_token = {"username":"USERNAME","key":"API_KEY"}
import json
import zipfile
import os
with open('/content/.kaggle/kaggle.json', 'w') as file:
json.dump(api_token, file)
!chmod 600 /content/.kaggle/kaggle.json
!kaggle config path -p /content
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 26, 2024 11:27
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites