Skip to content

Instantly share code, notes, and snippets.

View chao1224's full-sized avatar
🎯
Focusing

Shengchao Liu chao1224

🎯
Focusing
View GitHub Profile
export HOME=$PWD
export PATH=$PATH:/usr/local/cuda/bin
wget -q –retry-connrefused –waitretry=10 https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
chmod 777 *
./Anaconda2-4.3.1-Linux-x86_64.sh -b -p ./anaconda > /dev/null
export PATH=$PWD/anaconda/bin:$PATH
#keras stuff
conda install --yes pyyaml > /dev/null
conda create -n name python=3.6 pandas scipy pytorch torchvision tqdm toolz
codna install -c conda-forge python-blosc
conda install -c anaconda mpi4py
conda install -c anaconda distributed
#!/bin/bash
export HOME=$PWD
wget -q –retry-connrefused –waitretry=10 https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh #here I get the anaconda file from squid
chmod 777 * #wget does strange things
./Anaconda2-4.3.1-Linux-x86_64.sh -b -p ./anaconda > /dev/null #install anaconda, I also add an argument to the directory name
export PATH=$PWD/anaconda/bin:$PATH
echo 'Done installing anaconda'
chmod 777 *
r = 5
c = 10
matrix_ = matrix(0, r, c)
assign <- function(matrix_, r, c){
count = 1
for (i in 1:r) {
for (j in 1:c) {
matrix_[i,j] = count
count = count + 1
alias python='/home/ubuntu(user)/anaconda2/bin/python2.7'
ssh -N -n -L localhost:xxx(local port):localhost:1224(remote port) user@host
export HOME=$PWD
wget -q –retry-connrefused –waitretry=10 https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
chmod 777 *
./Anaconda2-4.3.1-Linux-x86_64.sh -b -p ./anaconda > /dev/null
export PATH=$PWD/anaconda/bin:$PATH
echo 'Done installing anaconda'
chmod 777 *
conda install -y -c omnia openbabel=2.4.0 > /dev/null
@chao1224
chao1224 / pytorch_gradients_example.py
Last active August 19, 2022 14:55
PyTorch gradients example
from torch.autograd._functions import *
from torch.autograd import Variable, Function
from sklearn import datasets
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as auto
from torch.autograd import Variable
@chao1224
chao1224 / conda_env.sh
Created July 21, 2017 19:46
solve the exception `Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so`
# create conda virtual env, named xxx
conda create -n xxx
# enter virtual env
source activate xxx
conda install nomkl numpy scipy scikit-learn numexpr
conda remove mkl mkl-service
# quit virtual env
#!/bin/sh
git filter-branch --force --env-filter '
OLD_EMAIL="xxx"
CORRECT_NAME="chao1224"
CORRECT_EMAIL="shengchao.hacker@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"