From 080109e9c3b47d664305aef0533428349eab4c88 Mon Sep 17 00:00:00 2001 From: hugogogo Date: Fri, 3 Jun 2022 11:04:23 +0200 Subject: [PATCH 1/2] few changes, in makefile added colors --- config_files/skeleton_makefile | 26 ++++++++++++++++++++++++++ install.sh | 2 +- tutos/git.txt | 5 ++++- tutos/shell.txt | 5 ++++- tutos/vim.txt | 6 ++++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/config_files/skeleton_makefile b/config_files/skeleton_makefile index d12189c..dfe2907 100644 --- a/config_files/skeleton_makefile +++ b/config_files/skeleton_makefile @@ -1,3 +1,29 @@ +# - - - - - - - # +# # +# COLORS # +# # +# - - - - - - - # + +GRAY = "\e[0;30m" +RED = "\e[0;31m" +GREEN = "\e[0;32m" +YELLOW = "\e[0;33m" +BLUE = "\e[0;34m" +PURPLE = "\e[0;35m" +CYAN = "\e[0;36m" +WHITE = "\e[0;37m" + +B_GRAY = "\e[1;30m" +B_RED = "\e[1;31m" +B_GREEN = "\e[1;32m" +B_YELLOW = "\e[1;33m" +B_BLUE = "\e[1;34m" +B_PURPLE = "\e[1;35m" +B_CYAN = "\e[1;36m" +B_WHITE = "\e[1;37m" + +RESET = "\e[0m" + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # . name = value \ . += append to a variable # # VARIABLES . value . != set result of command # diff --git a/install.sh b/install.sh index 845a1e8..9996405 100644 --- a/install.sh +++ b/install.sh @@ -74,7 +74,7 @@ function install install "$HOME/.screenrc" install "$HOME/.vimrc" install "$HOME/.zshrc" -install "$HOME/.vim/templates/skeleton_color.h" +install "$HOME/.vim/templates/skeleton_colors.h" install "$HOME/.vim/templates/skeleton.cpp" install "$HOME/.vim/templates/skeleton.hpp" install "$HOME/.vim/templates/skeleton_main.cpp" diff --git a/tutos/git.txt b/tutos/git.txt index 5ff2708..4b9af56 100644 --- a/tutos/git.txt +++ b/tutos/git.txt @@ -33,7 +33,10 @@ **git stash pop** reapply the stashed changes and removes them from the stash area **git stash apply** reaply the stashed changes and keep them in the stash area **git config --global credential.helper store** store the passwords in .git-credentials in the HOME directory (thanks to global, as opposed to the project directory) so you don't have tot type it each time -**git cherry-pick NAME_OF_BRANCH** ti merge a branch into the actual one, but only with the last commit +**git config --global core.editor "vim"** change the git editor for vim +**git cherry-pick NAME_OF_BRANCH** it merge a branch into the actual one, but only with the last commit +**git log --graph** show the graph of the commits with branchs +**git log --first-parent master** show all the commits directly on master (or other branch) **relier dossier sur serveur en local avec git** **acceder au serveur via ssh :** `ssh hugugtzx@world-370.fr.planethoster.net -p 5022` diff --git a/tutos/shell.txt b/tutos/shell.txt index ba4b723..fd7b678 100644 --- a/tutos/shell.txt +++ b/tutos/shell.txt @@ -7,9 +7,12 @@ **mkdir file{1..10}** creer 10 dossiers nommés de file1 à file10 **pwd** print working directory **xdg-open .** open working directory +**du -sh** directory sizes **ncdu** (visual version of 'du' command) quick presentation of directories size -**ssh username@ssh.server.com -p 0000** se connecter a un serveur via ssh en precisant un port +**ssh username@ssh.server.domain -p XXXX** se connecter a un serveur via ssh en precisant un port +**sftp -P XXXX username@ssh.server.domain** se connecter a un server ssh avec le protocol ftp +**vim scp://username@ssh.server.domain:XXXX//home/path/to/file** edit a remote file from local vim **pdftotext** transforme un pdf en un fichier texte **^** designe le debut d'une ligne diff --git a/tutos/vim.txt b/tutos/vim.txt index b418aa9..ea24399 100644 --- a/tutos/vim.txt +++ b/tutos/vim.txt @@ -1,3 +1,9 @@ +/SYNTAX/ +to create a new syntax file, just copy an existing one : + cp /usr/share/vim/vimXX/syntax/extension.vim ~/.vim/syntax/ +and change the name to match the extension +and change the content to whatever you want + /MODE INSERTION/ **i** mode insertion avant le curseur **I** mode insertion au debut de la ligne From 921d9b5e36a2bd085f073f07323daea6d99f266b Mon Sep 17 00:00:00 2001 From: hugogogo Date: Fri, 3 Jun 2022 12:47:53 +0200 Subject: [PATCH 2/2] add tests.hpp --- config_files/.vimrc | 5 +++ config_files/skeleton_makefile | 64 +++++++++++++++++---------------- config_files/skeleton_tests.hpp | 30 ++++++++++++++++ install.sh | 1 + 4 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 config_files/skeleton_tests.hpp diff --git a/config_files/.vimrc b/config_files/.vimrc index fc9699f..336d6a6 100644 --- a/config_files/.vimrc +++ b/config_files/.vimrc @@ -130,12 +130,17 @@ endfunction function! COLORFile() silent! 0r $HOME/.vim/templates/skeleton_colors.h endfunction +" to autofill a new tests.hpp file +function! TESTSFile() + silent! 0r $HOME/.vim/templates/skeleton_tests.hpp +endfunction " autofill calls autocmd BufNewFile *.hpp call HPPFile() autocmd BufNewFile *.cpp if @% == 'main.cpp' | call MAINCPPFile() | else | call CPPFile() autocmd BufNewFile Makefile call MAKEFile() autocmd BufNewFile colors.h call COLORFile() +autocmd BufNewFile testss.hpp call TESTSFile() diff --git a/config_files/skeleton_makefile b/config_files/skeleton_makefile index dfe2907..0849683 100644 --- a/config_files/skeleton_makefile +++ b/config_files/skeleton_makefile @@ -1,8 +1,8 @@ -# - - - - - - - # -# # -# COLORS # -# # -# - - - - - - - # +# - - - - - - # +# # +# COLORS # +# # +# - - - - - - # GRAY = "\e[0;30m" RED = "\e[0;31m" @@ -30,43 +30,43 @@ RESET = "\e[0m" # . name is case sensitive . ?= set if not already set # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # -NAME = a.out +NAME = a.out -#TYPE = c -TYPE = cpp +#CC = c +#EXT = c +CC = c++ +EXT = cpp -ifeq "$(TYPE)" "c" - CC = c - EXT = c -else ifeq "$(TYPE)" "cpp" - CC = c++ - EXT = cpp -endif +CFLAGS = -Wall -Wextra -Werror $(INCLUDES) +#CFLAGS += -std=c++98 +CFLAGS += -g3 -CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -ifeq "$(TYPE)" "cpp" - CFLAGS += -std=c++98 -endif +VPATH = $(D_SRCS) -VPATH = $(D_SRCS) +LIBS = -LIBS = +F_INCLUDES = $(HEADERS:%=$(D_HEADERS)/%) \ + $(TEMPLATES:%=$(D_TEMPLATES)/%) +INCLUDES = -I$(D_HEADERS) \ + -I$(D_TEMPLATES) -INCLUDES = -I$(D_HEADERS) +D_SRCS = ./srcs +SRCS = main.c -D_SRCS = . -SRCS = main.cpp +D_HEADERS = ./headers +HEADERS = colors.h \ + tests.hpp -D_HEADERS = . -HEADERS = colors.h +D_TEMPLATES = ./templates +TEMPLATES = template.tpp -D_OBJS = builds -OBJS = $(SRCS:%.$(EXT)=$(D_OBJS)/%.o) +D_OBJS = builds +OBJS = $(SRCS:%.$(EXT)=$(D_OBJS)/%.o) ifeq "$(D_OBJS)" "." - RM_OBJS = rm -f $(OBJS) + RM_OBJS = rm -f $(OBJS) else - RM_OBJS = rm -rf $(D_OBJS) + RM_OBJS = rm -rf $(D_OBJS) endif @@ -79,14 +79,16 @@ endif all: $(NAME) $(D_OBJS)/%.o: %.$(EXT) | $(D_OBJS) + @echo $(CYAN)"compilation (objects.o) :"$(RESET) $(CC) $(CFLAGS) -c $< -o $@ $(D_OBJS): mkdir $@ -$(OBJS): $(HEADERS:%=$(D_HEADERS)/%) +$(OBJS): $(F_INCLUDES) $(NAME): $(OBJS) + @echo $(CYAN)"linkage (link objects.o) :"$(RESET) $(CC) $(OBJS) -o $@ $(LIBS) leaks: $(NAME) diff --git a/config_files/skeleton_tests.hpp b/config_files/skeleton_tests.hpp new file mode 100644 index 0000000..a81a63c --- /dev/null +++ b/config_files/skeleton_tests.hpp @@ -0,0 +1,30 @@ +#ifndef TESTS_H +# define TESTS_H + +#include +#include + +# define TEST(s) \ + {\ + test_title = #s;\ + struct tester : public test_base {\ + void func() + +# define TESTEND \ + };\ + test = new(tester);\ + test->title = test_title;\ + test_list.push_back(test);\ + } + +struct test_base { + std::string title; + virtual void func() {} +}; + +std::vector test_list; +test_base *test; +std::string test_title; + +#endif + diff --git a/install.sh b/install.sh index 9996405..813b18e 100644 --- a/install.sh +++ b/install.sh @@ -75,6 +75,7 @@ install "$HOME/.screenrc" install "$HOME/.vimrc" install "$HOME/.zshrc" install "$HOME/.vim/templates/skeleton_colors.h" +install "$HOME/.vim/templates/skeleton_tests.hpp" install "$HOME/.vim/templates/skeleton.cpp" install "$HOME/.vim/templates/skeleton.hpp" install "$HOME/.vim/templates/skeleton_main.cpp"