Skip to content

Instantly share code, notes, and snippets.

View YefanZhou's full-sized avatar
🎯
Focusing

Yefan YefanZhou

🎯
Focusing
View GitHub Profile
@YefanZhou
YefanZhou / gist:17726483a48dfbcfb7ecf5e48402aaf1
Created May 1, 2020 12:20
Jupyter note execute py file
if need to print info in every referred file
```python
!python "script.py"
```
if need to visualize image
```python
%run -i 'script.py'
```
@YefanZhou
YefanZhou / gist:8786cc57765c3b14bb0849632ef9458e
Created May 3, 2020 08:10
Multiprocessing pool progress bar
pip install parmap
https://github.com/zeehio/parmap
parmap.map(..., ..., pm_pbar=True) # show a progress bar (requires tqdm)
Normalize data before activation layer of internal layer to train the network faster.
https://towardsdatascience.com/batch-normalization-in-neural-networks-1ac91516821c
@YefanZhou
YefanZhou / gist:b69e8741a5eddf9f555a3626822fdb6f
Created May 7, 2020 06:16
remote server pytorch tensorboard
ssh -L 16006:127.0.0.1:6006 olivier@my_server_ip
command line:tensorboard --logdir args.tensorboard_dir
remote port: 6006
local machine:
http://127.0.0.1:16006
https://stackoverflow.com/questions/37987839/how-can-i-run-tensorboard-on-a-remote-server
@YefanZhou
YefanZhou / gist:ecac9acd3d9813af3f3ac3c731a98a30
Created May 15, 2020 08:48
Latex Footnote cycled problem
\usepackage{pifont}
\usepackage[perpage]{footmisc} %每页脚注重新编号
\renewcommand{\thefootnote}{\ding{\numexpr191+\value{footnote}}}
-----------------------------------------------------------------------
bug\footnote{text}
@YefanZhou
YefanZhou / gist:e0e10b7d2d55763a0b4ba410530ee835
Created May 25, 2020 08:27
Nohup output to specific file
nohup some_command &> NEW_name.out&
@YefanZhou
YefanZhou / gist:6d5c1e87e2b730f8d598299ea391607f
Created June 25, 2020 09:29
configuration (sftp.json) of sftp in vscode
{
"name": "NAME OF FOLDER",
"host": "ADDRESS",
"protocol": "sftp",
"port": 22,
"username": "USERNAME BEFORE @",
"password": "PASSWORD",
"remotePath": "/home/fanuc/Xinghao/ContraGrasp",
"uploadOnSave": true,
"ignore": [
@YefanZhou
YefanZhou / train_all_mat.sh
Created July 7, 2020 12:29
Bash define variable, for loop, if condition, arithmetic, parallell
#!/bin/bash
declare -i TRENDS=17 # Trends used to compute
declare -i MAT_SIZE=36757 # Size of distance matrix
declare -i START_INDEX=0
declare -i STEP=100 # Step between START_INDEX and
declare -i END_INDEX=0
END_INDEX=`expr $START_INDEX + $STEP`
declare -i INCREMENTAL_STEP=300
for i in $(seq 1 1 $TRENDS)
@YefanZhou
YefanZhou / bashout.sh
Created July 7, 2020 14:46
Bash command to redirect output
python -u test.py # force the stdout and stderr streams to be unbuffered
nohup python -u test.py > test.out &
@YefanZhou
YefanZhou / .gitignore
Created July 11, 2020 03:36
Python gitignore setup
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/