Skip to content

Instantly share code, notes, and snippets.

View chao1224's full-sized avatar
🎯
Focusing

Shengchao Liu chao1224

🎯
Focusing
View GitHub Profile
#!/bin/bash
echo Cluster $cluster
echo Process $process
echo RunningOn $runningon
mkdir $transfer_output_files
transfer_output_files=$transfer_output_files/$cluster
echo $transfer_output_files
mkdir $transfer_output_files
%% Matrix defined by n * m
% Want to find k points
n = 256;
m = 256;
k = 5;
matrix = zeros(n, m);
%% Sample five points
[n, m] = size(matrix);
found_points_number = 0;
#!/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"
@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
@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
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
ssh -N -n -L localhost:xxx(local port):localhost:1224(remote port) user@host
alias python='/home/ubuntu(user)/anaconda2/bin/python2.7'
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
#!/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 *