useful_functions

Useful functions

Useful functions in daily life website

============= Python =============

Config conda env to make it available in jupyter

conda install ipykernel
python -m ipykernel install --user --name=mask_rcnn_torch

https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084

Accelerate num checking

image

============= Bash =============

Check and release GPU memory

In terminal:

lsof /dev/nvidia-uvm
for i in {23723..23807}; do kill -9 $i; done;

If not sure which is the pid you want:

ps (pid)  # process status command

Mathematical symbols

https://dept.math.lsa.umich.edu/~kesmith/295handout1-2010.pdf

============= R =============

When your R package is not available

Visit https://cran.r-project.org/src/contrib/Archive/.

Find the package you want to install with Ctrl + F

Click the package name

Determine which version you want to install

Open RStudio

install.packages("https://cran.r-project.org/src/contrib/Archive/[NAME OF PACKAGE]/[VERSION NUMBER].tar.gz", repos = NULL, type="source")

https://stackoverflow.com/questions/25721884/how-should-i-deal-with-package-xxx-is-not-available-for-r-version-x-y-z-wa

Change data types in R

Suppose x is a data matrix or data frame, than simply

> class(x) <- "numeric" (or "character") 

would change the data type.

“as.numeric” or “as.character” only works for vector.

============= c++ =============

Setup environment:

1) C++ -> general -> include additional dir: ($SolutionDir)external\opencv; ($SolutionDir)external\tensorRT\include

2) Linker -> general -> dependency: ($SolutionDir)external\opencv; ($SolutionDir)external\tensorRT\lib

3) Link -> input -> additional dependency:

============= Word tricks =============

1) Insert seperator for word format: Ctrl + Alt + Enter.

2) Show hidden markers (e.g., page break, section break): Ctrl + Shift + 8

============= Reading list =============