// MathJax

Analysis Envrionment

Operating System

lsb_release -a

 

Package Manager

[choco]: window

C:\\Program Files

#

 

[apt]: ubuntu

/usr/bin, /usr/sbin, /usr/lib, /usr/include, /usr/share

/etc/apt/source.list

dpkg -i [package]
dpkg -L [package]
dpkg -l
apt install build-essentials
apt list --installed

 

[update-alternatives]:  Debian

sudo update-alternatives --display <name>
sudo update-alternatives --config <name>
sudo update-alternatives --install <link> <name> <path> <priority>
sudo update-alternatives --remove <name> <path>
sudo update-alternatives --remove-all <name>
ln -s <path> <link>

 

[gcc/g++]: C, CPP

  • /usr/include/c++/9
  • /usr/include/x86_64-linux-gnu/c++/9
  • /usr/include/c++/9/backward
  • /usr/lib/gcc/x86_64-linux-gnu/9/include
  • /usr/local/include
  • /usr/include/x86_64-linux-gnu
  • /usr/include
$ echo | gcc -x c -E -Wp,-v - >/dev/null
$ echo | gcc -x c++ -E -Wp,-v - >/dev/null
$ pkg-config --cflags --libs [library] # /usr/lib/pkgconfig, /usr/local/lib/pkgconfig

 

 

 

[pip]: python

Packages for Analysis: PyMC3, Statsmodels, Tensorflow, Pytorch, Scikit-Learn, Visdom, Panel

import sys
sys.path
pip list
pip install/uninstall

 

 

cran: R

# installation R: https://irkernel.github.io/installation/#linux-panel
# https://www.r-bloggers.com/2022/08/installation-of-r-4-2-on-ubuntu-22-04-1-lts-and-tips-for-spatial-packages/

$ sudo apt install -y r-base r-base-core r-recommended r-base-dev
$ sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+

$ conda install -c r r-core
$ conda install -c r r-essentials
$ apt-get install libzmq3-dev libcurl4-openssl-dev libssl-dev jupyter-core jupyter-client

$ sudo rstudio-server start
$ sudo rstudio-server stop

Packages for Analysis: 

getwd()
setwd("~")

.libPaths()
.libPaths("~/cran-packages")

install.packages("svars", dependencies=TRUE)
library(svars)

 

 

 


Environment Variable

 

.bashrc

### GIT
alias gitlog='git log --all --graph --oneline'
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "



### XMING XSERVER
export DISPLAY_NUMBER="0.0"
export LIBGL_ALWAYS_INDIRECT=
export DISPLAY=:0



### ROS
source /opt/ros/noetic/setup.bash



# GAZEBO
source /usr/share/gazebo/setup.bash
export GAZEBO_RESOURCE_PATH=${GAZEBO_RESOURCE_PATH}:$HOME/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds:$HOME/project/worlds
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:$HOME/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models:$HOME/project/models
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:$HOME/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic:$HOME/project/plugins
$ echo $ENVIRONMENT_VARIABLE



 

 


Building Structure

Build:  CMakeLists.txt[cmake] > Makefile[make] > Executable File[gcc|g++]

gcc / g++ / ar / Make / Autotools / Premake / CMake / Sharpmake / Ninja / SCons / Meson / FASTbuild / Maven / Ant / Gradle

sudo apt update
sudo apt install build-essential
sudo apt install gcc make cmake
# m4
wget -c 'https://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz'
tar xvfz m4-1.4.16.tar.gz
cd m4-1.4.16 
./configure 
make && make install

# autoconf
wget -c 'http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz'
tar xzvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure
make && sudo make install

# automake
wget -c 'http://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.gz'
tar xzvf automake-1.14.1.tar.gz
cd automake-1.14.1
./configure
make && sudo make install

# libtool 
wget -c 'http://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz'
tar xzvf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure
make && sudo make install

 

 

In Source Builds: Directory Structure

Directory: src

File: main.cpp

.
 |-- src
     |-- main.cpp
./src$ g++ main.cpp # compile + assemble + liking
./src$ g++ main.cpp -o main # compile + assemble + liking

./src$ g++ -c main.cpp # compile + assemble
./src$ g++ main.o -o main # liking
# with libraries
./src$ g++ main.cpp `pkg-config --libs --cflags [library]`
./src$ g++ main.cpp `pkg-config --libs --cflags [library]` -o main

 

 

Directory: src

File: main.cpp / module.cpp / module.h

.
 |-- src
     |-- main.cpp
     |-- module.cpp
     |-- module.h
./src$ g++ -c main.cpp
./src$ g++ -c module.cpp
./src$ g++ main.o module.o -o main

 

Directory: src

File: main.cpp / module.cpp / module.h / Makefile

.
 |-- src
     |-- main.cpp
     |-- module.cpp
     |-- module.h
     |-- Makefile
# Makefile
module.o : module.h module.cpp
        g++ -c module.cpp

main.o : main.cpp module.cpp
        g++ -c main.cpp

main : module.o main.o
        g++ module.o main.o -o main
./src$ make main

 

 

Out-of-Source Builds: Directory Structure

  • inc: header files
  • lib: modules
  • test: unit test
  • path control
    • relative: src
    • absolute: ${PROJECT_SOURCE_DIR}/src

 

Structure: src/build

Directory: src/build

File: main.cpp | CMakeLists.txt

.
 |-- src
     |-- main.cpp
     |-- CMakeLists.txt
     |-- build
# CMakeLists.txt
cmake_minimum_required(VERSION 3.11)
project(Name)
add_executable(main main.cpp)
.src/build$ cmake .. && make 
.src/build$ cmake .. && cmake --build ./
.src$ cmake -H. -Bbuild && cmake --build ./build

 

 

Directory: src/build

File: main.cpp | module.cpp | module.h | CMakeLists.txt

.
 |-- src
     |-- main.cpp
     |-- module.cpp
     |-- module.h
     |-- CMakeLists.txt
     |-- build
# CMakeLists.txt
cmake_minimum_required(VERSION 3.11)
project(Name)
add_executable(main main.cpp module.cpp)
.src/build$ cmake .. && make 
.src/build$ cmake .. && cmake --build /.
.src$ cmake -H. -Bbuild && cmake --build ./build


Directory: src/build | lib

File: main.cpp | module.cpp | module.h | CMakeLists.txt

.
 |-- src
     |-- main.cpp
     |-- CMakeLists.txt
     |-- lib
         |-- module.cpp
         |-- module.h
     |-- build

 

 

Directory: src/build | inc

File: main.cpp | module.cpp | module.h | CMakeLists.txt

.
 |-- src
     |-- main.cpp
     |-- module.cpp
     |-- CMakeLists.txt
     |-- inc
         |-- module.h
     |-- build

 

Directory: src/build | lib | inc

File: main.cpp | module.cpp | module.h | CMakeLists.txt

.
 |-- src
     |-- main.cpp
     |-- CMakeLists.txt
     |-- lib
         |-- module.cpp
     |-- inc
         |-- module.h
     |-- build

 

Structure: src | build

Directory: src | build

File:  main.cpp | module.cpp | module.h | [2] CMakeLists.txt

.
 |-- CMakeLists.txt
 |-- src
     |-- main.cpp     
     |-- module.cpp     
     |-- module.h     
     |-- CMakeLists.txt
 |-- build
# CMakeLists.txt
cmake_minimum_required(VERSION 3.11)
project(Name)
add_subdirectory(src) # relative path
# src/CMakeLists.txt
add_executable(main main.cpp module.cpp)
./build$ cmake .. && make 
./build$ cmake .. && cmake --build ./
$ cmake -H. -Bbuild && cmake --build ./build

 

 

Directory: src | inc | build

.
 |-- CMakeLists.txt
 |-- src
     |-- main.cpp     
     |-- module.cpp     
     |-- CMakeLists.txt
 |-- inc
     |-- module.h     
     |-- CMakeLists.txt
 |-- build
# CMakeLists.txt
cmake_minimum_required(VERSION 3.11)
project(Name)
add_subdirectory(src)
add_subdirectory(inc)

 

 

Directory: inc | lib | build

.
 |-- CMakeLists.txt
 |-- main.cpp
 |-- inc
     |-- module.h     
 |-- lib
     |-- module.cpp     
     |-- CMakeLists.txt
 |-- build

 

 

Directory: src | inc | lib | build

.
 |-- src
     |-- main.cpp     
     |-- module.cpp     
 |-- inc
     |-- module.h     
 |-- lib
 |-- build

 

 

Directory: src | inc | lib | test | build

.
 |-- src
     |-- main.cpp     
     |-- module.cpp     
 |-- inc
     |-- module.h     
 |-- lib
 |-- test
 |-- build

 

 

 

Libraries

Extension OS Library
*.a Linux static
*.so Linux dynamic
*.lib Window static
*.dll Window dynamic

 

  • sudo ldconfig
    • LD_LIBRARY_PATH
    • /etc/ld.so.conf.d/*.config

 

 

 


Programming Language

Bash

File System

 

File I/O

 

Regular Expression

 

 

C++

File System

 

File I/O

 

Regular Expression

 

Library Import/Export

 

 

Python

File System

 

File I/O

 

Regular Expression

 

 

Library Import/Export

 

 

 

 

 

 

 


Git

  • branch
    • remote tracking branch: origin/* branch
    • local branch: master branch
sudo apt install git
git --version
git config --list
git config --global user.name [user_name]
git config --global user.email [user_email_address]
git config --global core.editor "[editor]"
git init
git init [folder_name]    # mkdir [folder_name];cd [folder_name];git init

git add [file_name]
git status

git commit -m "[massage]"       # staging area to repository [commit]
git commit -am "[massage]"      # working directory to staging area to repository [add + commit]
git commit --amend              # amend(modifty)
git log
git log --pretty=format:"%h %s" --graph    # simple message log
git log                                    # message log
git log --stat                             # message log with file name
git log -p                                 # message log with file name and changed contents(diff)
git log --all                              # message all log
git log --all --graph                      # graphical message all log
git log --all --graph --oneline            # oneline graphical message all log
git reflog
git tag
git tag -l "v0.0.*"
git init
git remote add [ALIAS_OF_URL] [URL]     # connect remote repository
git remote update

git checkout tags/[version]
git checkout [commit_id_on_log]     # return to a moment in past
git checkout master                 # return back to present

git branch -al                    # list up all branches
git branch -r                     # list up remote branches
git branch [branch_name]          # create branch
git branch -m [new_branch_name]   # rename branch
git branch -d [branch_name]       # delete fully merged branch
git branch -D [branch_name]       # delete branch (even if not merged)

git merge [branch_name]
git remote add [REPO_NAME] [REPO_URL]     # connect remote repository
git remote rename [REPO_NAME] [REPO_RENAME]
git remote remove [REPO_NAME]
git remote                              # REPO_NAME of connected remote repository 
git remote -v                           # URL of connected remote repository
git remote update                       # all branch > .git

git fetch                               # latest branch > .git
git merge

git pull
git push
git push origin [BRANCH_NAME]
git push origin --delete [BRANCH_NAME]
git push [-u|--set-upstream] origin master               # up-stream setting

git clone [URL]
git clone [URL] --recursive
git submodule add [REPO_URL] [PATH]
git submodule update --init
git submodule update --remote
git submodule update --recursive

 

 

 

 

 


Utility

Terminal

[OS] Window: Terminal

Shortcuts Action
Alt Shift - horizental split window
Alt Shift + vertical split window
Ctrl d terminate window
Alt arrow move cursur 

 

[OS] Linux: Terminal

vim

sudo add-apt-repository ppa:jonathonf/vim
sudo apt update
sudo apt install vim universal-ctags

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
git clone https://github.com/preservim/tagbar.git
mv tagbar ~/.vim/bundle

.vimrc: https://vimawesome.com/

set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'lfv89/vim-interestingwords'
Plugin 'mattesgroeger/vim-bookmarks'

call vundle#end()
filetype plugin indent on
 
set hlsearch
set tabstop=4
set shiftwidth=4

" Plugin setup "
""""""""""""""""

" nerdtree
map <Tab> :NERDTreeToggle<CR>

" tagbar
let g:Tlist_Ctags_Cmd='/usr/bin/ctags'
map <leader><Tab> :TagbarToggle<CR>
 
" vim-interestingwords
let g:interestingWordsGUIColors = ['#00FF7C', '#0400FF', '#00FFF0', '#FF0000', '#FFEC00', '#FFB3FF', '#A70C03', '#B81055', '#C606A9', '#BC3FEC', '#9A78FD', '#6AA2F9', '#2BC1E4', '#14D9C2', '#4BEF8D', '#8EFE15']
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
nnoremap <silent> <leader>k :call InterestingWords('n')<cr>
nnoremap <silent> <leader>K :call UncolorAllWords()<cr>
nnoremap <silent> n :call WordNavigation('forward')<cr>
nnoremap <silent> N :call WordNavigation('backward')<cr>
set termguicolors
 
" vimspector
"let g:vimspector_enable_mappings = 'HUMAN'
"packadd! vimspector

" vim-bookmarks
highlight BookmarkSign ctermbg=NONE ctermfg=160
highlight BookmarkLine ctermbg=194 ctermfg=NONE
let g:bookmark_sign = '♥'
let g:bookmark_highlight_lines = 1

" :source %
" :PluginInstall

 

Shortcuts Action
sp [file] horizental split window
vs [file] vertical split window
e [file] current window
Ctrl w arrow move cursur
:Ctrl d command list
:%s/[matching_text]/[replace_text]/[g][c][i] replace text
   
   
   

 

tmux

Shortcuts Action
Ctrl b Shift ' horizental split window
Ctrl b Shift 5 vertical split window
Ctrl b c new session
Ctrl b , session name
Ctrl b arrow move cursur
Ctrl b z zoom in/out
Ctrl b q  
Ctrl b w  
Ctrl b [number] session change

 

.tmux.conf

unbind C-b
set -g prefix C-a

 

 

 

 

Text Editor

jupyter, vim, vscode, notepadd++, tmux

 

 

Anaconda/Jupyter

$ pip install --upgrade pip
$ conda update -n base conda
$ conda update --all
# anaconda3/envs/

$ conda --version
$ conda update conda
$ conda create --name [env_name] python=[version]
$ conda create --name [env_name] [package] python=[version]
$ conda remove --name [env_name] --all
$ conda info --envs                 # same to below
$ conda env list                    # same to above
$ conda list                        # list of packages
$ conda activate [env_name]
$ conda deactivate
$ conda install [package]

 

 

 

Command Summary

Conda

#

 

Docker

#

 

 

 


Network

[ssh] Secure Shell

 

 

 

 

 

 

 

 

 

 


Reference

https://www.devkuma.com/docs/git/

 

'quantitative analysis > programming' 카테고리의 다른 글

CPP Build System and Library  (0) 2024.07.06
Intermediate CPP Programming  (0) 2024.07.06
Basic CPP Programming  (1) 2024.07.06
Bash Programming  (0) 2024.02.26

+ Recent posts