diff --git a/README.md b/README.md index c052c17..4daaec5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ # klips -This repository is a collection of code snippets and configurations. These can be cloned or just viewed and copied as needed to lay out templates or automate tasks for larger projects. - -The snippets are organized within topic-labeled folders. +This repository is a collection of code snippets and configurations. This can be cloned or just viewed and copied as needed to lay out templates or automate tasks for larger projects. diff --git a/ansible/README.md b/ansible/README.md index afc9394..15666d9 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -11,9 +11,11 @@ Playbooks - nginx.yml - Playbook example for using nginx role - fail2ban.yml - Playbook example for using fail2ban role - postifx.yml - Playbook example for using postfix role + - bookstack-backup.yml - Playbook example for taking a backup of BookStack + - hexo-backup.yml - Playbook example for taking a backup of Hexo + - hexo-install.yml - Playbook example to install and deploy the Hexo site generator Roles - - Basic ansible role created with ansible-galaxy command - core - Role to configure a new host with basic authentication / package settings - docker - Role to install docker, docker-compose, configure docker user group (Debian / Ubuntu) - nginx - Role to install and configure a new nginx webserver on a host diff --git a/ansible/fail2ban.yml b/ansible/fail2ban.yml index 193d48f..7c52ecc 100644 --- a/ansible/fail2ban.yml +++ b/ansible/fail2ban.yml @@ -1,5 +1,5 @@ --- -- hosts: plumbi +- hosts: nginx-server become: yes roles: - fail2ban diff --git a/ansible/hexo-bak.yml b/ansible/hexo-bak.yml index 27199e6..710f443 100644 --- a/ansible/hexo-bak.yml +++ b/ansible/hexo-bak.yml @@ -1,5 +1,5 @@ --- -- hosts: hexo +- hosts: dev become: yes tasks: - name: Backup Hexo files diff --git a/ansible/hexo-install.yml b/ansible/hexo-install.yml index 26af9e3..80e0763 100644 --- a/ansible/hexo-install.yml +++ b/ansible/hexo-install.yml @@ -1,6 +1,6 @@ --- - name: Install Hexo static site generator - hosts: hexo + hosts: dev become: yes tasks: - name: Update apt sources and install npm diff --git a/ansible/nginx.yml b/ansible/nginx.yml index 3cac957..7b8de16 100644 --- a/ansible/nginx.yml +++ b/ansible/nginx.yml @@ -1,5 +1,5 @@ --- -- hosts: plumbi +- hosts: nginx-server become: yes roles: - nginx diff --git a/ansible/plays/apt-up.yml b/ansible/plays/apt-up.yml index a239535..1e84371 100644 --- a/ansible/plays/apt-up.yml +++ b/ansible/plays/apt-up.yml @@ -1,5 +1,5 @@ --- -- hosts: core +- hosts: nginx-server become: yes tasks: - name: Ensure package lists are up-to-date diff --git a/ansible/plays/bookstack-backup.yml b/ansible/plays/bookstack-backup.yml index a367cff..6cff473 100644 --- a/ansible/plays/bookstack-backup.yml +++ b/ansible/plays/bookstack-backup.yml @@ -1,5 +1,5 @@ --- -- hosts: bookstack +- hosts: docker-host become: yes tasks: - name: Create backup directory if it doesn't exist diff --git a/ansible/plays/hexo-backup.yml b/ansible/plays/hexo-backup.yml index e0bec07..3ffdf36 100644 --- a/ansible/plays/hexo-backup.yml +++ b/ansible/plays/hexo-backup.yml @@ -1,5 +1,5 @@ --- -- hosts: hexo +- hosts: dev become: yes tasks: - name: Backup Hexo files diff --git a/ansible/plays/hexo-install.yml b/ansible/plays/hexo-install.yml index ef8aa09..07fe26f 100644 --- a/ansible/plays/hexo-install.yml +++ b/ansible/plays/hexo-install.yml @@ -1,6 +1,6 @@ --- - name: Install Hexo static site generator - hosts: hexo + hosts: dev become: yes tasks: - name: Update apt sources and install npm diff --git a/ansible/postfix.yml b/ansible/postfix.yml index e88bbd2..8d7af8c 100644 --- a/ansible/postfix.yml +++ b/ansible/postfix.yml @@ -1,5 +1,5 @@ --- -- hosts: plumbi +- hosts: othergroup become: yes roles: - postfix diff --git a/ansible/roles/README.md b/ansible/roles/README.md index 42613a2..f60c053 100644 --- a/ansible/roles/README.md +++ b/ansible/roles/README.md @@ -41,3 +41,16 @@ nginx A simple role for installing and configuring nginx on a new Ubuntu host using Ansible. Supports templates for index.html and custom nginx.conf + +postfix +------------ + +A simple role for installing and configuring the postfix MTA on a new Ubuntu host using Ansible. Supports templates for main.cf and custom sasl_passwd + + +fail2ban +------------ + +A simple role for installing and configuring fail2ban on a new Ubuntu host using Ansible. Supports templates for jail.local settings and provides a custom filter.d directory copy custom filters to the remote host. + + diff --git a/ansible/roles/core.yml b/ansible/roles/core.yml index 653044f..6e6c772 100644 --- a/ansible/roles/core.yml +++ b/ansible/roles/core.yml @@ -1,5 +1,5 @@ --- -- hosts: core +- hosts: dev become: yes roles: - core diff --git a/configs/.vimrc b/configs/.vimrc deleted file mode 100644 index 27cfa95..0000000 --- a/configs/.vimrc +++ /dev/null @@ -1,154 +0,0 @@ -" Single-quote is a comment written to be read -" Double-quotes are commented out code and can be removed or added - -" General Vim Settings - -" Define function in vim to remove whitespace -fun! TrimWhitespace() - let l:save = winsaveview() - keeppatterns %s/\s\+$//e - call winrestview(l:save) -endfun -"Call this on every attempt to save a file of types defined below.. -autocmd BufWritePre *.cpp,*.h,*.c,*.php :call TrimWhitespace() -""autocmd BufWritePre *.cpp,*.h,*.c,*.php :%s/\s\+$//ge -" Set terminal title when opening file -"" autocmd BufEnter * let &titlestring = ' ' . expand("%:t") -"" set title - -" Set tabwidth=2, adjust Vim shiftwidth to the same -set tabstop=2 shiftwidth=2 - -" expandtab inserts spaces instead of tabs -set expandtab - -" autindent inserts the next line at your current depth -set autoindent - -" mouse=a allows for mouse interaction with vim when supported -set mouse=a - -set number - -" Use Powerline symbols -""let g:airline_powerline_fonts = 1 - -" Enable Syntax Highlighting in Vim -syntax on -" Use Sourcerer color scheme by Xero -colorscheme sourcerer - -" Fix plugin compatibility issues -set nocp -" Allow backspace to remove all types of characters -set backspace=indent,eol,start - -" Custom Vim Keybindings - -" nnoremap " Modify and remove leading quotation - -" CPP Compile -""autocmd FileType cpp nmap :w!g++ -o %:r % && ./%:r - -" Set window jump to custom binding -" default Ctrl-W conflict - closes browser tabs -nnoremap - -nnoremap :!make -C build/ - -" Vim Plugin Settings - -" set rtp+=/path/to/rtp/that/included/pathogen/vim " if needed -" Enable Pathogen plugin manager -execute pathogen#infect() -filetype plugin indent on - -" Set Vim Airline theme -" base16 soda base16_pop laederon night_owl kalisi* ayu_mirage* raven -let g:airline_theme='kalisi' - -" Gitgutter installed for + - diffs in gutters within repo files - -" Ale linter settings -" Hover detail info in preview window -let g:ale_hover_to_preview = 1 -" Hover detail info in balloons -""let g:ale_set_balloons = 1 -let g:ale_sign_error = '' -let g:ale_sign_warning = '' -highlight ALEWarningSign ctermbg=Yellow -highlight ALEWarningSign ctermfg=Black -highlight ALEWarning ctermbg=DarkYellow -highlight ALEWarning ctermfg=White -highlight ALEErrorSign ctermbg=DarkRed -highlight ALEErrorSign ctermfg=White -highlight ALEError ctermfg=DarkRed -nmap (ale_previous_wrap) -nmap (ale_next_wrap) - -" Syntastic syntax checker settings -" See :help syntastic -""set statusline+=%#warningmsg# -""set statusline+=%{SyntasticStatuslineFlag()} -""set statusline+=%* -""let g:syntastic_always_populate_loc_list = 1 -""let g:syntastic_auto_loc_list = 1 -""let g:syntastic_check_on_open = 1 -""let g:syntastic_check_on_wq = 0 - -" Clang_complete settings -let g:clang_library_path='/usr/lib/llvm-8/lib/' - -" Understand how the plugin works: :h signify-modus-operandi -" Spare the plugin some work and read: :h g:signify_vcs_list -" Signify plugin settings -" Diff gutter within Vim -"" let g:signify_vcs_list = ['git', 'hg'] -"" let g:signify_cursorhold_insert = 1 -"" let g:signify_cursorhold_normal = 1 -"" let g:signify_update_on_bufenter = 0 -"" let g:signify_update_on_focusgained = 1 -" -" Colorizer plugin settings -" See :h colorizer in Vim for more info -""let g:colorizer_colornames = 0 " Don't color literal names, like red, green, etc -let g:colorizer_auto_color = 1 -""let g:colorizer_skip_comments = 1 -""let g:colorizer_auto_filetype ='css,html,vim' -nnoremap :ColorToggle - -" Symbols important to vim / terminal layouts - -set termencoding=utf-8 -set encoding=utf-8 - -" air-line -let g:airline_powerline_fonts = 1 - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif - -" unicode symbols -let g:airline_left_sep = '»' -let g:airline_left_sep = '▶' -let g:airline_right_sep = '«' -let g:airline_right_sep = '◀' -let g:airline_symbols.linenr = '␊' -let g:airline_symbols.linenr = '␤' -let g:airline_symbols.linenr = '¶' -let g:airline_symbols.branch = '⎇' -let g:airline_symbols.paste = 'ρ' -let g:airline_symbols.paste = 'Þ' -let g:airline_symbols.paste = '∥' -let g:airline_symbols.whitespace = 'Ξ' - -" airline symbols -let g:airline_left_sep = '' -let g:airline_left_alt_sep = '' -let g:airline_right_sep = '' -let g:airline_right_alt_sep = '' -let g:airline_symbols.branch = '' -let g:airline_symbols.readonly = '' -let g:airline_symbols.linenr = '' - diff --git a/cpp/opengl/test-gl.cpp b/cpp/opengl/test-gl.cpp index 6ea2e18..c1e048f 100644 --- a/cpp/opengl/test-gl.cpp +++ b/cpp/opengl/test-gl.cpp @@ -1,5 +1,7 @@ /*############################################################################# ## Author: Shaun Reed ## +## Requires freeglut3-dev to be installed with your package manager ## +## To build an executable: `g++ test-gl.cpp -w -lGL -lGLU -lglut -o test` ## ## ## ## Testing building OpenGL projects with source code from lazyfoo - ## ## https://lazyfoo.net/tutorials/OpenGL/ ## diff --git a/cpp/sdl-cmake/apps/inherited.cpp b/cpp/sdl-cmake/apps/inherited.cpp index 4b958cd..ad36d8a 100644 --- a/cpp/sdl-cmake/apps/inherited.cpp +++ b/cpp/sdl-cmake/apps/inherited.cpp @@ -1,6 +1,8 @@ /*############################################################################# ## Author: Shaun Reed ## ## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ## +## Requires SDL: `sudo apt-get install libsdl2-dev` ## +## To build: `mkdir build && cd build && cmake .. cmake --build .` ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ############################################################################## diff --git a/cpp/sdl/inherited.cpp b/cpp/sdl/inherited.cpp index 119c5e9..505a41d 100644 --- a/cpp/sdl/inherited.cpp +++ b/cpp/sdl/inherited.cpp @@ -1,6 +1,8 @@ /*############################################################################# ## Author: Shaun Reed ## ## Legal: All Content (c) 2019 Shaun Reed, all rights reserved ## +## Requires SDL: `sudo apt-get install libsdl2-dev` ## +## To build an executable: `g++ inherited.cpp -lSDL2 -o test` ## ## ## ## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ## ############################################################################## diff --git a/scripts/adduser.sh b/scripts/newuser.sh similarity index 89% rename from scripts/adduser.sh rename to scripts/newuser.sh index c1d00e7..1ca8d24 100755 --- a/scripts/adduser.sh +++ b/scripts/newuser.sh @@ -1,12 +1,12 @@ #!/bin/bash ## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ## ## A custom bash script for creating new linux users. ## -## Syntax: ./adduser.sh ## +## Syntax: ./newuser.sh ## ############################################################################### if [ "$#" -ne 2 ]; then printf "Illegal number of parameters." - printf "\nUsage: sudo ./adduser.sh " + printf "\nUsage: sudo ./newuser.sh " printf "\n\nAvailable groupd IDs:" printf "\n60001......61183 Unused | 65520...............65533 Unused" printf "\n65536.....524287 Unused | 1879048191.....2147483647 Unused\n"