---
tags: tutorial
---
Geek way coding
===
This note introduces how to code geek!
Outline:
[TOC]
# Operating System
## Why Linux (Unix)?

- easily to use SSH connection
- complete package manager for many tools, which can be installed in command line
- easy to find solutions on StackOverflow etc. because most developers use it
- coding in only one window by using: docker, tmux, vim, etc...
- above can do on server
- using Windows edit *.sh file cause `\r` !!?? (after all *.sh is for Linux not for Windows)
## Windows Subsystem for Linux (WSL)

:::warning
WARNING: Reboot needed!
:::
# Touch Typing
## Typing without seeing keyboard.
## Logics
- __What is the bottleneck of operating system?__
<details>
<summary>Ans.</summary>
IO.
</details>
- __What is the bottleneck of a programmer?__
~~brain~~
<details>
<summary>Ans.</summary>
Typing speed/correctness.
</details>
## Why shouldn't I just type whatever I want?
- slow, not totally make use of 10 fingers.
- keep looking at keyboard.
- wanna be faster, faster and FASTER! ~~(摸斗嗨壓苦)~~
## Formal fingering

## Let's have a small [contest](https://www.typing-lessons.org/lesson_25.html).
Both accuracy and speed are important!

## Advance
Ctrl, Alt key combinations.
No formal fingering, need to define yourself
Frequently used in VIM, tmux.
# Tips on Ubuntu
## Vim
- __What is the definition of "Algorithm"?__
<details>
<summary>Ans.</summary>
Describe "step-by-step" procedures.
</details>
- __Difference of coding with $O(n)$ and $O(n^2)$ steps?__
Note that steps means how many keystrokes you press on your keyboard, which is independent of your typing speed.
<details>
<summary>Ans.</summary>
O(n) is asymptotically fewer "steps" when n is large.
</details>
- Memes
- Meme of learning curve



```
What Gives People
Feelings of Power
-----------------
:s | **
. | ***
@@ | *******
```
- [vim help](https://vimhelp.org/)
- Using vim key in chrome!!??
[Vimium](https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb)
:::success
:tada: Keyboard Is All You Need! :tada:
:::
## tmux
- Multi-window, multi-session in only one terminal window.
:::success
:tada: One Terminal Is All You Need! :tada:
:::
## dotfiles
- __What is the essence of "Dynamic Programming"?__
$\rightarrow$ CharlieL: D**** P****
<details>
<summary>Ans.</summary>
Memo (take notes). Previous tasks results would be directly helpful for future tasks.
</details>
- __How to "program dynamically"?__
<details>
<summary>Ans.</summary>
Once done, used forever.
</details>
- My dotfiles
https://github.com/deeperlearner/dotfiles
## Remote access
:::info
Code at everywhere by sshing to lab PC/server and use tmux and VIM
:sunglasses: __Fast, Smooth and Geek!__ :sunglasses:
:::
Using ssh only consumes very few network resource, which is much better than Teamviewer or other remote desktop app.
As a coder,
:::success
:tada: focusing on one terminal is all you need! :tada:
:::
## Jupyter
[Jupyter Note](/2591KbgQT9mwOYQAMr7UCw)
However, in some cases, you need to check the images file. You can use jupter as a remote image file explorer.
But it crashs when entering directory with large amounts of images, I have no solution currently.
## Follow *deeperlearner* 0v0
https://github.com/deeperlearner
:::success
~~:tada: Following deeperlearner Is All You Need! :wink: :tada:~~
:::
# Python
## Anaconda v.s. pip
- Anaconda
It has many preinstalled packages for data science & deep learning so that it is easily for start-up without installing packages manually.
- tradeoff
- larger disk usage (longer installation time)
- good compatability between packages
- usage
- https://www.anaconda.com/
- pip
If you are confirmed which packages you need, you can install packages manually by using pip.
- tradeoff
- smaller disk usage (shorter installation time)
- you can customize your package configuration yourself (decide which packages to install)
- sometimes it will encounter package conflict (that's why you need to use virtual environment)
- usage
- `sudo apt-get update`
- `sudo apt install python3-pip`
- `pip3 install <package_name>`
- `pip3 install -r requirements.txt [--upgrade]`
- `pip3 uninstall -r requirements.txt -y`
- `pip3 list`
- `pip3 freeze > requirements.txt`
## Virtual Environment
[Virtual Environment](/_xYQ7nRLRLWpn5OKWwqRXg)
## Basic
- check python version
`python3 -V`
- Check manual of python
`man python3`
- You can frequently use the following two functions and Google to check the usage of modules.
- `dir([object])`
check the attribute of object.
- `help([object])`
check the documentation of object.
## Useful modules
### Notes
Try to take your own notes.
[Python commonly-used packages note](/KA3cwMKeRyms2iKgOekxzQ)
### Frequently used packages in data science
- requirements.txt
Customize your requirments.txt and execute the following command will install all the packages in the file.
`pip install -r requirements.txt`
# ML coding
## CUDA & cuDNN
These two packages are for using gpu resources to train deep learning models.
[Procedures of reinstalling Nvidia driver, CUDA and cuDNN](/7eXZ54NBSqO8O2ENtXGZag)
## Why PyTorch?
- Install with CUDA automatically.
- 大金ML、DLCV、ADL choose pytorch as default package
## [Pytorch-Template](https://github.com/deeperlearner/pytorch-template)
- support tensorboard
- record training log
- It can deal with most kinds of machine learning models.
- To tune the model, all you need is to change the json file.
## [arXiv](https://arxiv.org/list/cs/recent)
## [paper with code](https://paperswithcode.com/)
# Ensemble Learning
Sharing geek tips with each others is the fastest way to learn.
- GitHub
- HackMD
# Explore more...
## Some suggestions for learning
- MIT missing semester: https://missing.csail.mit.edu/2020/
- [Hsuan-Tien Lin Youtube courses](https://www.youtube.com/channel/UC9Wi1Ias8t4u1OosYnHhi0Q)
- [Hung-yi Lee Youtube courses](https://www.youtube.com/channel/UC2ggjtuuWvxrHHHiaDH1dlQ)