Skip to content

Instantly share code, notes, and snippets.

View raeidsaqur's full-sized avatar
💭
I may be slow to respond.

Raeid raeidsaqur

💭
I may be slow to respond.
View GitHub Profile
@raeidsaqur
raeidsaqur / conda_auto_env_remote.sh
Created September 25, 2019 17:16
conda-auto-env
#!/bin/bash
# conda-auto-env automatically activates a conda environment when
# entering a folder with an environment.yml file.
#
# If the environment doesn't exist, conda-auto-env creates it and
# activates it for you.
#
# To install add this line to your .bashrc or .bash-profile:
#
@raeidsaqur
raeidsaqur / nb.slurm
Created September 25, 2019 22:12
nb.slurm is a slurm script to launch a Jupyter notebook server on ionic. You can connect to it by tunneling using SSH from your local machine -- Follow the instructions in the corresponding slurm output file after the job gets scheduled.
#!/bin/bash
#SBATCH --partition general
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 1
#SBATCH --mem 16G
#SBATCH --gres gpu:1
#SBATCH --time 1-0:00:00
#SBATCH --job-name jupyter-notebook
#SBATCH --output jupyter-notebook-%J.log
@raeidsaqur
raeidsaqur / environment.yml
Created September 25, 2019 23:42
Conda environment.yml template for project specific conda environment creation.
name: null # env was made with --prefix
channels:
- conda-forge # added a third party channel
- defaults
dependencies:
- numpy=1.16.3=py37h926163e_0
- opencv=3.4.2=py37h6fd60c2_1
- pandas=0.24.2=py37h0a44026_0
- pip=19.1.1=py37_0
- pip: # Packages installed from PyPI
@raeidsaqur
raeidsaqur / ClusterBashAliases.md
Last active October 9, 2019 17:14
Cluster Usage Helpful Bash Aliases

Add the following helper commands to your ~/.bash_profile to easily check cluster status

sq returns the status of jobs with respect to the $(PARTITION) machines.*

alias sq='squeue -o "%.18i %.9P %.8j %.8u %.6c %.8b %.8m %.8T %.10M %.9l %.6D %R" -A $(PARTITION_NAME)'

alias sinfo='sinfo -p all,$(PARTITION1), $(PARTITION2) -el -o "%15N %.6D %.9P %.7T %.4c %.13G %.8z %.6m %.6w %20E"'

alias sqk='squeue -u $(USERNAME)'

@raeidsaqur
raeidsaqur / blender_installation_instructions.md
Last active October 15, 2019 16:16
Blender installation for Synthetic Image dataset generation

Simple steps:

  1. Download .tar.bz from official site and extract it. Version 2.79

    wget https://download.blender.org/release/Blender2.79/blender-2.79b-linux-glibc219-x86_64.tar.bz2 Extract: tar -xvf <blender_version>

  2. sudo mv /{path_to}/{Extracted folder} /opt/blender

  3. Create a symbolic link for use from the command line:

@raeidsaqur
raeidsaqur / wandb_run_identifier.py
Last active March 31, 2020 00:07
WandB Run Identifier (naive, untested example) to exemplify the idea
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time, logging, platform
import wandb
def wandb_init(opt, *args, **kwargs):
"""A quick naive example """
wandb_identifier = get_run_identifier(opt, *args, **kwargs)
wandb.init(project="aProj", name=wandb_identifier, notes="<Intriguing notes>")
@raeidsaqur
raeidsaqur / graph_top_sort.py
Created April 30, 2020 15:06
Py_3.9-TopologicalSorter
from functools import TopologicalSorter
graph = {"A": {"D"}, "B": {"D"}, "C": {"E", "H"}, "D": {"F", "G", "H"}, "E": {"G"}}
ts = TopologicalSorter(graph)
list(ts.static_order())
# ['H', 'F', 'G', 'D', 'E', 'A', 'B', 'C']
@raeidsaqur
raeidsaqur / conda_jupyter_snippets.sh
Created April 30, 2020 20:29
Handling Conda Environments in Jupyter Notebook
#!/bin/bash
# Create virtual env in Conda
conda create -n aenv python=3.8
conda activate aenv
# To [list|remove]
#conda env [list|remove] [-n aenv]
# Add Conda env to Jupyter Notebook
pip install --user ipykernel
@raeidsaqur
raeidsaqur / rsync_local2remote_v.sh
Last active October 2, 2021 19:01
[Vector Institute] Cron Rsync Script for LOCAL <-> REMOTE syncing
#!/bin/bash
# Author: Raeid Saqur
# Email: raeidsaqur@cs.toronto.edu
LOCAL_KEY=id_rsa
REMOTE_USER=raeidsaqur
REMOTE_SERVER="vdm1.vectorinstitute.ai" # use dedicated data mover server networked to Vaughan
PROJ_PATH="<SOME/PROJ/PATH>"
LOCAL_PROJ_DIR="$HOME/Research/projects/${PROJ_PATH}"
@raeidsaqur
raeidsaqur / virtual_x-server_setup
Created November 2, 2021 20:16
Setup a cluster (gpu) node for rendering unity (ALFRED or AI2Thor for e.g.) simulations using virutal X-Server
#!/bin/bash
# Author: Raeid Saqur
# Email: raeidsaqur@cs.toronto.edu
# Install NVIDIA driver:
sudo apt-get update
sudo apt-get install nvidia-driver-460
sudo reboot now
# Wait 3 minutes and reconnect