Skip to content

Instantly share code, notes, and snippets.

View jimmyahacker's full-sized avatar

Shuo jimmyahacker

View GitHub Profile
@jimmyahacker
jimmyahacker / idx_reader.py
Created July 8, 2018 18:17
How to extract data from idx file
import numpy as np
def _read(dimensions, stream):
if len(dimensions) == 0:
return ord(stream.read(1))
elif len(dimensions) == 1:
return [val for val in stream.read(dimensions[0])]
else:
res = []
for _ in range(dimensions[0]):
@jimmyahacker
jimmyahacker / README.md
Last active May 1, 2023 20:55
Install and run original GAN using pylearn2 on cuda backend

Prerequisites

  1. Use python2 not python3
  2. Suppose the current working directory is $CWD
  3. Suppose the data path is $DATA_PATH
  4. Suppose the current shell is bash
  5. Download following requirements.txt to current working directory
  6. Old version of cuda installed(tested on v8.0.44)
  7. Old version of cudnn installed(tested on 7.0v4.0)

Install pylearn2

@jimmyahacker
jimmyahacker / README.md
Last active December 1, 2023 18:25
How to run Jupyter Notebook on NYU HPC to run tensorflow

Usage

  1. If you don't have a virtual environment, download create_venv.sh and do this in your working directory:
    source create_venv.sh
  2. Run run-jupyter.sbatch and follow the instructions in NYU Prince Tutorial on how to run Jupyter Notebook:
    sbatch run-jupyter.sbatch
@jimmyahacker
jimmyahacker / README.md
Last active June 29, 2021 18:56
Configure StarCraft II environment for DeepMind challenge on NYU Prince Cluster

Prerequisites

  1. Load singularity module:
module load singularity/2.4.4
  1. Download and unzip StarCraft II for Linux: here I take StarCraft II 3.16 for example, you could replace the link and zip file name according to SC2 Official Linux Downloads
    1. Download zip
    wget http://blzdistsc2-a.akamaihd.net/Linux/SC2.3.16.1.zip
@jimmyahacker
jimmyahacker / create_venv.sh
Last active March 25, 2020 03:55
Create virtual environment on NYU HPC Prince Cluster using tensorflow 1.7 or later in python3
# activate existed python3 module to get virtualenv
module load python3/intel/3.6.3
# create virtual environment with python3
virtualenv -p python3 $HOME/py3tf
# activate virtual environment
source $HOME/py3tf/bin/activate
# install tensorflow-gpu
@jimmyahacker
jimmyahacker / DisjointSet.java
Last active March 4, 2018 21:24
Disjoint Set(Union Set)
import java.util.*;
// a DisjointSet instance stands for a disjoint set that knows all its nodes
public class DisjointSet<T> {
// the nodes in each DisjointSet instance
public static class Node<T> {
// the value of each node
public final T val;
// the parent of each node, defaut itself