Skip to content

Instantly share code, notes, and snippets.

# create conda environment
conda create -n dgl-graph-classifier-env python=3.9
conda activate dgl-graph-classifier-env
# install torch
conda config --add channels conda-forge
conda install pytorch-cpu==1.8.0
# install install deep graph library
conda install -c dglteam dgl
@nashid
nashid / private_fork.md
Created June 23, 2021 04:35 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@nashid
nashid / install_packages_conda.sh
Last active June 24, 2021 06:56 — forked from luiscape/install_packages.sh
Install Python dependency packages from requirements.txt Using conda.
#
# Original solution via StackOverflow:
# http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t
#
#
# Install via `conda` directly.
# This will fail to install all
# dependencies. If one fails,
# all dependencies will fail to install.
@nashid
nashid / condaenv.txt
Last active June 24, 2021 07:12 — forked from pratos/condaenv.txt
To package a conda environment (Requirement.txt and virtual environment)
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder
@nashid
nashid / tmux_vs_screen.md
Created July 15, 2021 20:06 — forked from P7h/tmux_vs_screen.md
tmux vs screen commands

tmux vs. screen commands


Action tmux screen
start a new session tmux
tmux new
tmux new-session
screen
start a new session with a name tmux new -s name screen -S name
re-attach a detached session tmux attach
tmux attach-session
screen -r
re-attach a detached session with a name tmux attach -t name
tmux a -t name
screen -r name
re-attach an attached session (detaching it from elsewhere) tmux attach -dtmux attach-session -d screen -dr
@nashid
nashid / .md
Created September 23, 2021 17:02 — forked from rahulrajaram/.md
Python: Write to a file from multiple threads

I recently came across the need to spawn multiple threads, each of which needs to write to the same file. Since the file will experience contention from multiple resources, we need to guarantee thread-safety.

NOTE: The following examples work with Python 3.x. To execute the following programs using Python 2.7, please replace threading.get_ident() with thread.get_ident(). As a result, you would need to import thread and not threading.

  1. (The following example will take a very long time). It will create 200 threads, each of which will wait until a global lock is available for acquisition.
# threading_lock.py
import threading
@nashid
nashid / github-all-the-things.sh
Last active February 20, 2022 04:32
github - all the things
# remove lage files from commit history
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
git push origin --force --all
# git commit in the past
git commit --date="5 day ago" -m "Your commit message"
# setup credential.helper store
$ git config credential.helper store
@nashid
nashid / code-listing-with-color-latex.tex
Created December 7, 2021 03:10
Code listing with highlighting in latex
\definecolor{ashgrey}{rgb}{0.7, 0.75, 0.71}
\begin{lstlisting}[firstnumber=1]
'use strict';
const common = require('../common');
...
\end{lstlisting}
\vspace{-\baselineskip}
\begin{lstlisting}[firstnumber=10, backgroundcolor=\color{ashgrey}]
function main({ len, n }) {
@nashid
nashid / clean.sh
Created December 29, 2021 20:15
Mac storage taking too much space
# nvm cache could get very large
nvm cache clear