Skip to content

Instantly share code, notes, and snippets.

View lijunzh's full-sized avatar

Lijun Zhu lijunzh

View GitHub Profile
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
@lijunzh
lijunzh / pytorch.yml
Last active March 30, 2020 20:33
Conda environment file to set up latest PyTorch on Ubuntu
name: pytorch
channels:
- pytorch
dependencies:
- pip
- pytorch
- torchvision
- cudatoolkit=10.1
@lijunzh
lijunzh / conda_setup.sh
Last active March 30, 2020 20:48
Bash script that setup standard conda environment for scientific conputing from scratch.
#!/bin/bash
INSTALL_DIR=${HOME}/conda
INSTALL_SH='conda.sh'
# determin OS
OS=$(uname -s)
CONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-${OS/Darwin/MacOSX}-$(uname -m).sh"
# download installation file
@lijunzh
lijunzh / install_dotfiles
Last active March 18, 2020 14:49
Code snippets for install dotfile managed by a git bare repo following https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/
# Suorce: https://news.ycombinator.com/item?id=11071754
repo="https://github.com/lijunzh/dotfiles.git"
# Uncomment if initiate a new dotfiles bare repo
# git init --bare $HOME/.cfg
# Uncomment if install existing dotfiles repo
git clone --bare ${repo} ~/.cfg
# Set temporary config commend, alias should be added in .bashrc
@lijunzh
lijunzh / ndarray_as_tmp_file
Created March 17, 2018 11:05
Read and writing performance test between numpy.ndarray (.npy) vs obspy.Stream (.mseed).
Python 3.6.4 |Anaconda custom (64-bit)| (default, Mar 12 2018, 20:05:31)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import numpy as np
In [2]: import obspy
In [3]: data = np.random.randn(6000, 3, 2000)
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 1080 Ti"
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 6.1
Total amount of global memory: 11171 MBytes (11713708032 bytes)
(28) Multiprocessors, (128) CUDA Cores/MP: 3584 CUDA Cores
GPU Max Clock rate: 1582 MHz (1.58 GHz)