Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Raeid raeidsaqur

💭
I may be slow to respond.
View GitHub Profile
@raeidsaqur
raeidsaqur / headless_rendering_unity.py
Created Jun 24, 2022
Create a WSGI server to allow declarative headless rendering for unity based gaming environments.
View headless_rendering_unity.py
## For general architecture see: https://silverweed.github.io/assets/docs/distributed_rendering_in_vulkan.pdf
import Xlib.display
import glob
import warnings
import os
import ctypes.util
import xml.etree.ElementTree
@raeidsaqur
raeidsaqur / virtual_x-server_setup.sh
Created Apr 26, 2022
Bash script for Virtual X-server setup
View virtual_x-server_setup.sh
#!/bin/bash
# Install NVIDIA driver:
sudo apt-get update
sudo apt-get install nvidia-driver-460
sudo reboot now
# Wait 3 minutes and reconnect
sleep 3m
# Check that nvidia driver is loaded:
@raeidsaqur
raeidsaqur / wolf_requirements.txt
Last active Jan 12, 2022
Installed modules on `teach.cs.toronto.edu` ($python3 -m pip freeze > requirement.txt). For last year's (python 3.8) use $python3.8 -m pip freeze
View wolf_requirements.txt
astroid==2.7.3
attrs==20.3.0
certifi==2020.12.5
chardet==4.0.0
click==8.0.1
colorama==0.4.4
conllu==4.4.1
filelock==3.0.12
funcparserlib==0.3.6
huggingface-hub==0.0.17
@raeidsaqur
raeidsaqur / virtual_x-server_setup
Created Nov 2, 2021
Setup a cluster (gpu) node for rendering unity (ALFRED or AI2Thor for e.g.) simulations using virutal X-Server
View virtual_x-server_setup
#!/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
@raeidsaqur
raeidsaqur / rsync_local2remote_v.sh
Last active Oct 2, 2021
[Vector Institute] Cron Rsync Script for LOCAL <-> REMOTE syncing
View rsync_local2remote_v.sh
#!/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 / conda_jupyter_snippets.sh
Created Apr 30, 2020
Handling Conda Environments in Jupyter Notebook
View conda_jupyter_snippets.sh
#!/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 / graph_top_sort.py
Created Apr 30, 2020
Py_3.9-TopologicalSorter
View graph_top_sort.py
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 / wandb_run_identifier.py
Last active Mar 31, 2020
WandB Run Identifier (naive, untested example) to exemplify the idea
View wandb_run_identifier.py
#!/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 / ClusterBashAliases.md
Last active Oct 9, 2019
Cluster Usage Helpful Bash Aliases
View ClusterBashAliases.md

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 / jupyter.slurm
Last active Apr 5, 2022
SLURM script for opening a Jupyter Notebook tunnel
View jupyter.slurm
#!/bin/bash
#SBATCH -p p100
#SBATCH --gres=gpu:1
#SBATCH -c 4
#SBATCH --mem=16G
#SBATCH --nodes=1
#SBATCH --ntasks=1
##SBATCH --ntasks-per-node=1
#SBATCH --time=04:00:00
#SBATCH --job-name=jupyter-notebook