-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremember.txt
37 lines (19 loc) · 1.34 KB
/
remember.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
inux / Bash / general:
Kill process on port: lsof -ti:<port> | xargs kill
ssh tunnel: ssh -N -f -L localhost:<localPort>:localhost:<remoteport> <username@remoteHost>
List conda environments: conda info —envs
Create conda env from file: conda env create -f environment.yml
Re-Mount a drive: sudo mount /dev/xvdb ~/data
Mounting a drive from scratch: lsblk (to see your drives name… it’s `xvdb` in this case); sudo mkfs -t ext4 /dev/xvdb; mkdir /home/ubuntu/data; sudo mount /dev/xvdb /home/ubuntu/data; sudo chown -R ubuntu:ubuntu data; sudo chmod -R 755 data
Check size of directory: du -sh <directory_name>
How many files in a directory: ls -l | wc -l
See memory usage on gpu: watch -d -n 0.5 nvidia-smi
Grep showing line number (`-n`): grep -r -n “text to find” ./
Show the size of all directories in order of size: du -sk * | sort -n
Show the size of all directories in human redable size: du -sh *
Python/ Jupyter Notebooks
Set pandas to display all columns: pd.set_option('display.max_columns', None)
Profile code in jupyter sorted by total time: %prun -s cumulative <code_to_be_profiled>
use pep8 in jupyter notebooks: %load_ext pycodestyle_magic; %flake8_on
Reload a module in jupyter: from importlib import reload: reload(<moduleName>)
Install package from jupyter notebook: !conda install --yes --prefix {sys.prefix} <packageName>