diff --git a/.aliases b/.aliases index fdd4be4..fdd73c5 100644 --- a/.aliases +++ b/.aliases @@ -1,23 +1,26 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. -# Custom alias definitions. This file must be include on `.bashrc` file. +# Custom alias definitions. This file must be included in the `.bashrc` file for +# proper functioning. -# Aliases for SSH connection to my home lab host. -alias rpi0='ssh mdsanima@192.168.1.27' -alias rpi1='ssh mdsanima@192.168.1.32' -alias rpi2='ssh mdsanima@192.168.1.34' -alias rpi3='ssh mdsanima@192.168.1.20' -alias rpi4='ssh mdsanima@192.168.1.33' -alias rpi5='ssh mdsanima@192.168.1.37' -alias rpi6='ssh mdsanima@192.168.1.35' -alias rpi7='ssh mdsanima@192.168.1.36' -alias jet1='ssh mdsanima@192.168.1.24' -alias jet2='ssh mdsanima@192.168.1.30' -alias macb='ssh mdsanima@192.168.1.44' -# Aliases for the weather script. -alias weahter='mdsanima-weather' -alias pogoda='mdsanima-weather' +# Aliases for SSH connection to my Home Labs hosts +alias rpi0="ssh mdsanima@192.168.1.27" +alias rpi1="ssh mdsanima@192.168.1.32" +alias rpi2="ssh mdsanima@192.168.1.34" +alias rpi3="ssh mdsanima@192.168.1.20" +alias rpi4="ssh mdsanima@192.168.1.33" +alias rpi5="ssh mdsanima@192.168.1.37" +alias rpi6="ssh mdsanima@192.168.1.35" +alias rpi7="ssh mdsanima@192.168.1.36" +alias jet1="ssh mdsanima@192.168.1.24" +alias jet2="ssh mdsanima@192.168.1.30" +alias macb="ssh mdsanima@192.168.1.44" -# Aliases for the K3S Clusters. -alias k='kubectl' +# Aliases for the weather script +alias weahter="mdsanima-weather" +alias pogoda="mdsanima-weather" + +# Aliases for the Kubernetes Cluster +alias k="kubectl" diff --git a/.bashrc b/.bashrc index 4ba7c5c..844caf4 100644 --- a/.bashrc +++ b/.bashrc @@ -1,46 +1,47 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. -# Custom config `.bashrc` file for Ubuntu. You can use this script on all -# available hosts in the home labs network and a cloud servers thats you have. +# This is a custom configuration `.bashrc` file for Linux system. You can use +# this script for all available hosts in your network. -# Python script WARNING which is not on PATCH. + +# Python script `WARNING` which is not on $PATH export PATH=$HOME/.local/bin:$PATH -# If not running interactively, don't do anything. +# If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac -# Don't put duplicate lines or lines starting with space in the history. +# Don't put duplicate lines or lines starting with space in the history HISTCONTROL=ignoreboth -# Append to the history file, don't overwrite it. +# Append to the history file, don't overwrite it shopt -s histappend -# History settings. -HISTSIZE=50000 # History lines stored in memory. -HISTFILESIZE=20000 # History lines stored on disk. -HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " # Adding date time before each commands. +# History settings +HISTSIZE=50000 # History lines stored in memory +HISTFILESIZE=20000 # History lines stored on disk +HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " # Adding date time before each commands -# Check the window size after each command and, if necessary, update the values -# of LINES and COLUMNS. +# Check the window size after each command shopt -s checkwinsize -# Make less more friendly for non-text input files. +# Make less more friendly for non-text input files [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" -# Set variable identifying the chroot you work in used in the prompt below. +# Set variable identifying the chroot you work in used in the prompt below if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi -# Set a fancy prompt non-color. +# Set a fancy prompt non-color case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac -# Shell color prompt. +# Shell color prompt force_color_prompt=yes if [ -n "$force_color_prompt" ]; then @@ -52,13 +53,13 @@ if [ -n "$force_color_prompt" ]; then fi if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ ' + PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ " else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\n\$ ' + PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\n\$ " fi unset color_prompt force_color_prompt -# If this is an xterm set the title to user@host:dir on host. +# If this is an xterm set the title to user@host:dir on host case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" @@ -67,30 +68,30 @@ xterm*|rxvt*) ;; esac -# Enable color support of ls and also add handy aliases. +# Enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - alias grep='grep --color=auto' - alias dir='dir --color=auto' - alias vdir='vdir --color=auto' + alias ls="ls --color=auto" + alias grep="grep --color=auto" + alias dir="dir --color=auto" + alias vdir="vdir --color=auto" - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' + alias fgrep="fgrep --color=auto" + alias egrep="egrep --color=auto" fi -# Colored GCC warnings and errors. -export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' +# Colored GCC warnings and errors +export GCC_COLORS="error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01" -# Some more ls aliases. -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' +# Some more ls aliases +alias ll="ls -alF" +alias la="ls -A" +alias l="ls -CF" -# Add an alert alias for long running commands. +# Add an alert alias for long running commands alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' -# Enable programmable completion features. +# Enable programmable completion features if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion @@ -99,18 +100,18 @@ if ! shopt -oq posix; then fi fi -# Cuda toolkit `nvcc` path on nVidia Jetson Nano. -if [[ $HOST == 'jet-1' || $HOST == 'jet-2' ]]; then +# Cuda toolkit `nvcc` path on nVidia Jetson Nano hosts +if [[ $HOST == "jet-1" || $HOST == "jet-2" ]]; then export PATH=/usr/local/cuda/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} fi -# Alias definitions from bash. +# Alias definitions for BASH if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi -# Alias definitions from zsh. +# Alias definitions for ZSH if [ -f ~/.aliases ]; then . ~/.aliases fi diff --git a/.dircolors b/.dircolors index df0f8f4..728b259 100644 --- a/.dircolors +++ b/.dircolors @@ -1,16 +1,20 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. -# This ia a custom colors definition for directory and specific files. +# This is a custom configuration for the colors definition for directories and +# specific files. + +# Configuration file for dircolors, a utility to help you set the `LS_COLORS` +# environment variable used by GNU ls with the --color option. -# Configuration file for dircolors, a utility to help you set the -# LS_COLORS environment variable used by GNU ls with the --color option. # Copyright (C) 1996-2017 Free Software Foundation, Inc. # Copying and distribution of this file, with or without modification, # are permitted provided the copyright notice and this notice are preserved. -# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the -# slackware version of dircolors) are recognized but ignored. -# Below are TERM entries, which can be a glob patterns, to match -# against the TERM environment variable to determine if it is colorizable. + +# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the slackware version of +# dircolors) are recognized but ignored. Below are TERM entries, which can be +# a glob patterns, to match against the TERM environment variable to determine +# if it is colorizable. # For information on dircolors files refer to dir_colors Linux Man Pages. # https://www.systutorials.com/docs/linux/man/5-dir_colors/ @@ -18,18 +22,20 @@ # Documentation reference pages. # http://www.mail-archive.com/bug-coreutils@gnu.org/msg11030.html -# Standard colors setup configuration info. + +# Standard colors configuration information # Attribute code: 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed # Text code: 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white # Bacground code: 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white -# 256 colors setup configuration info. +# 256 colors configuration information # Text code: 38;5;COLOR_NUMBER # Bacground code: 48;5;COLOR_NUMBER # Example basic: 48;5;147;01 - lavender background, bold # Example 256: 48;5;167;38;5;193;04 - red background, lime-green text, underscore -# Term configuration setup. + +# Term configuration TERM Eterm TERM ansi TERM *color* @@ -63,7 +69,7 @@ TERM tmux* TERM vt100 TERM xterm* -# Global defaults configuration file formats colors setup. +# Global defaults configuration file formats RESET 0 # reset to normal color NORMAL 00 # no color FILE 00 # normal @@ -85,7 +91,7 @@ OTHER_WRITABLE 38;5;42;01 # cyan, bold STICKY 48;5;67 # blue bg, white STICKY_OTHER_WRITABLE 48;5;30 # teal bg, white -# Archives or compressed file formats colors setup. +# Archives or compressed file formats .7z 38;5;147;01 # lavender, bold .ace 38;5;147;01 # lavender, bold .alz 38;5;147;01 # lavender, bold @@ -135,7 +141,7 @@ STICKY_OTHER_WRITABLE 48;5;30 # teal bg, white .zoo 38;5;147;01 # lavender, bold .zst 38;5;147;01 # lavender, bold -# Audio file formats colors setup. +# Audio file formats .aac 38;5;193 # lime .au 38;5;193 # lime .axa 38;5;193 # lime @@ -154,7 +160,7 @@ STICKY_OTHER_WRITABLE 48;5;30 # teal bg, white .wav 38;5;193 # lime .xspf 38;5;193 # lime -# Image file formats colors setup. +# Image file formats .bmp 38;5;229 # yellow .cgm 38;5;229 # yellow .CR2 38;5;229 # yellow @@ -186,7 +192,7 @@ STICKY_OTHER_WRITABLE 48;5;30 # teal bg, white .xwd 38;5;229 # yellow .yuv 38;5;229 # yellow -# Video file formats colors setup. +# Video file formats .anx 38;5;222 # orange .asf 38;5;222 # orange .avi 38;5;222 # orange @@ -217,7 +223,7 @@ STICKY_OTHER_WRITABLE 48;5;30 # teal bg, white .webm 38;5;222 # orange .wmv 38;5;222 # orange -# Other file formats colors setup. +# Other file formats .c 00 # noraml .cc 00 # noraml .cpp 00 # noraml @@ -252,7 +258,7 @@ STICKY_OTHER_WRITABLE 48;5;30 # teal bg, white *readme.txt 00 # noraml *README.txt 00 # noraml -# Backup and logs uninportant file formats colors setup. +# Backup and logs uninportant file formats .aux 38;5;248 # gray .bak 38;5;248 # gray .bbl 38;5;248 # gray @@ -273,7 +279,7 @@ STICKY_OTHER_WRITABLE 48;5;30 # teal bg, white .tmp 38;5;248 # gray .toc 38;5;248 # gray -# Custom mdsanima file formats colors setup. +# Custom MDSANIMA file formats .cfg 38;5;69 # violet .conf 38;5;11 # yellow .json 38;5;30 # blue diff --git a/.dockerignore b/.dockerignore index 7806095..5a9d723 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,33 +1,66 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. -# This directories and files are not copied into the container during the build. +# This directories and files are not copied into the container during the build process. + + +# Dependency directories node_modules npm-debug.log + +# Container bulds files Dockerfile Dockerfile.dev Dockerfile.prod Dockerfile.test + +*.dockerfile +*.dockerfile.dev +*.dockerfile.prod +*.dockerfile.test + +# Nginx configuration file nginx.config + +# Kubernetes files manifest.yaml deploy.yaml + +# Markdown files README.md CHANGELOG.md -.next -.git -.gitignore -.dockerignore + +# Environment variable files .env + .env.test .env.local .env.secret -.env.dev .env.development -.env.prod +.env.staging .env.production -.env*.test -.env*.local -.env*.secret -.env*.dev -.env*.development -.env*.prod -.env*.production +.env.dev +.env.stage +.env.prod +.env.ci +.env.demo +.env.backup + +.env.*.test +.env.*.local +.env.*.secret +.env.*.development +.env.*.staging +.env.*.production +.env.*.dev +.env.*.stage +.env.*.prod +.env.*.ci +.env.*.demo +.env.*.backup + +# Other files and dirs +.next +.git +.gitignore +.dockerignore diff --git a/.editorconfig b/.editorconfig index a34a3ab..7646fed 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,9 +1,14 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. + +# This is a configuration file that helps maintain consistent coding styles for +# multiple developers working on the same project across various editors and IDEs. +# Documentation: https://editorconfig.org -# https://editorconfig.org root = true + [*] charset = utf-8 end_of_line = lf @@ -92,6 +97,9 @@ max_line_length = off indent_size = 4 indent_style = space +[.commitlintrc] +indent_size = 2 + [.bashrc] indent_size = 4 indent_style = space diff --git a/.eslintignore b/.eslintignore index 2de9fc4..bfc901b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,10 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. -# Ignore this directories and files. +# This is a configuration file for ignoring eslint files on this repository. + + +# Ignore this files and dirs **/node_modules/** **/apps/**/*.d.ts **/next.config.js diff --git a/.eslintrc b/.eslintrc index ee766fb..079ddbf 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,4 +1,5 @@ -// Copyright © 2023 MDSANIMA +// Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +// Licensed under the MIT license. { "extends": ["@eslint:recommended"], @@ -8,6 +9,10 @@ "linebreak-style": ["error", "unix"], "quotes": ["error", "double"], "semi": ["error", "never"], - "header/header": ["error", "block", [" Copyright © 2023 MDSANIMA "]] + "header/header": [ + "error", + "block", + [" Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. ", " Licensed under the MIT license. "] + ] } } diff --git a/.flake8 b/.flake8 index 4886d3e..c647cc7 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,8 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. + +# This is a configuration file for Python package style checking. + [flake8] max-line-length = 120 diff --git a/.local/bin/mdsanima-colors b/.local/bin/mdsanima-colors index 9e769cc..2542a61 100644 --- a/.local/bin/mdsanima-colors +++ b/.local/bin/mdsanima-colors @@ -1,12 +1,14 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. -# Defining default color names and color code variables in Bash terminal script +# Defining default color names with color code variables in Bash terminal script # to colorize your output in a fancy way. -# To use this color palette, add this line `source mdsanima-colors` to your -# Bash script and apply for ANSI sequences. +# To use this color palette, add this line `source mdsanima-colors` to your Bash +# script and apply for ANSI sequences. -# Default color names and color code. + +# Default color names with color code CYAN="50" SKY="39" BLUE="27" diff --git a/.local/bin/mdsanima-shell b/.local/bin/mdsanima-shell index b409578..0f0d2ce 100644 --- a/.local/bin/mdsanima-shell +++ b/.local/bin/mdsanima-shell @@ -1,31 +1,33 @@ #!/usr/bin/env bash -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. # This script is for showing help information like application name and version # number only. The version number is from current tag on this repository. -# Get the current tag from the Git repository. + +# Get the current tag from the Git repository CURRENT_TAG=$(git describe --tags) -# Application name and version number exports. +# Application name and version number exports export MDSANIMA_SHELL_APP_NAME="mdsanima-shell" export MDSANIMA_SHELL_APP_VERSION=$CURRENT_TAG -# Script setup. -USAGE_HELP="usage: mdsanima-shell [-h] [-v]" -if [[ $1 == '-v' || $1 == '--version' ]]; then +# Script configuration +USAGE_HELP="Usage: mdsanima-shell [options]" +if [[ $1 == "-v" || $1 == "--version" ]]; then echo $MDSANIMA_SHELL_APP_NAME $MDSANIMA_SHELL_APP_VERSION -elif [[ $1 == '-h' || $1 == '--help' ]]; then +elif [[ $1 == "-h" || $1 == "--help" ]]; then echo $USAGE_HELP printf "\nMDSANIMA SHELL is a command-line interface for custom shell config.\n" - printf "You can use this script on all available hosts in your home labs\n" + printf "You can use this script on all available hosts in your Home Labs\n" printf "network and the cloud servers thats you have.\n\n" - printf "options:\n" - printf " -h, --help show this help message and exit\n" - printf " -v, --version show program's version number and exit\n\n" - printf "Copyright © 2023 MDSANIMA\n" -elif [[ $1 != '-h' || $1 != '--help' ]]; then + printf "Options:\n" + printf " -v, --version Show version\n" + printf " -h, --help Show help\n\n" + printf "Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. Licensed under the MIT license.\n" +elif [[ $1 != "-h" || $1 != "--help" ]]; then echo $USAGE_HELP echo "error: unrecognized argument: "$1 fi diff --git a/.local/bin/mdsanima-weather b/.local/bin/mdsanima-weather index ab7b80f..dc4fd54 100644 --- a/.local/bin/mdsanima-weather +++ b/.local/bin/mdsanima-weather @@ -1,15 +1,17 @@ #!/usr/bin/env bash -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. # You can use this in the terminal by typing `mdsanima-weather` which will show # the weather in your nearest location or by typing `mdsanima-weather city` for -# a specific city. +# a specific target city. -# Basic terminal setting. + +# Basic terminal settings set -o errexit set -o pipefail set -o nounset -# This is actual weather. +# Get the actual weather curl "https://wttr.in/${1:-}" diff --git a/.p10k.zsh b/.p10k.zsh index cb6b0dd..939f90d 100644 --- a/.p10k.zsh +++ b/.p10k.zsh @@ -1,7 +1,11 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. + +# This is a configuration file for the `Oh My Zsh` terminal customization. + +# We have removed all unused commands and help comments from this configuration +# file. Type in the reminal `p10k configure` to generate new config. -# Removed all unused command and help comment on this config file. -# Type `p10k configure` to generate new config. #########################[ temporarily change options ]######################### 'builtin' 'local' '-a' 'p10k_config_opts' diff --git a/.pylintrc b/.pylintrc index 77dd7eb..3a84945 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,44 +1,46 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. + +# This is a configuration file for code linting in Python package. [MASTER] -# Add files or directories to the blacklist. They should be base names, not paths. +# Add files or dirs to the blacklist, they should be base names, not paths ignore=.git,flake8.egg-info,conf.py -# Add files or directories matching the regex patterns to the blacklist. -# The regex matches against base names, not paths. +# Add files or dirs matching the regex patterns to the blacklist, they should be base names, not paths ignore-patterns=.*_test.py,.*_tmp.py -# Use multiple processes to speed up Pylint. +# Use multiple processes to speed up Pylint jobs=4 [FORMAT] -# Maximum number of characters on a single line. +# Maximum number of characters on a single line max-line-length=120 -# Regexp for a line that is allowed to be longer than the limit. +# Regexp for a line that is allowed to be longer than the limit ignore-long-lines=^\s+:([A-Za-z]+( [A-Za-z]+)+)_[A-Za-z]+:.*$ -# Maximum number of lines in a module. +# Maximum number of lines in a module max-module-lines=1000 [DESIGN] -# Maximum number of arguments for function / method. +# Maximum number of arguments for function / method max-args=20 -# Maximum number of locals for function / method body. +# Maximum number of locals for function / method body max-locals=30 -# Maximum number of return / yield for function / method body. +# Maximum number of return / yield for function / method body max-returns=6 -# Maximum number of branch for function / method body. +# Maximum number of branch for function / method body max-branches=20 -# Maximum number of statements in function / method body. +# Maximum number of statements in function / method body max-statements=50 diff --git a/.vimrc b/.vimrc index 9541c3b..385e4ae 100644 --- a/.vimrc +++ b/.vimrc @@ -1,25 +1,29 @@ -" Copyright © 2023 MDSANIMA +" Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +" Licensed under the MIT license. -" BASE CONFIGS -colorscheme pablo " Editor color theme. -syntax on " Syntax coloring. -set encoding=utf-8 " Character encoding. -set number " Line numbering. -set relativenumber " Relative number of lines. -set scrolloff=10 " Lines after and befor the cursor. -set tabstop=4 " Ident spaces. -set shiftwidth=4 " Offset spaces. -set expandtab " Override mode for TAB. -set nobackup " Dont make backups. -set nowritebackup " Dont save backups. +" This is a basic configuration script file for Vim editor. -" CURSOR -let &t_EI = "\e[2 q" " Block on NORMAL mode. -let &t_SI = "\e[6 q" " Bar on INSERT mode. -" KEYBOARD SHORTCUTS -map :w " Save file. CTRL+S -map :q " Exit Vim. CTRL+S +" Base setup +colorscheme pablo " Editor color theme +syntax on " Syntax coloring +set encoding=utf-8 " Character encoding +set number " Line numbering +set relativenumber " Relative number of lines +set scrolloff=10 " Lines after and before cursor +set tabstop=4 " Ident spaces +set shiftwidth=4 " Offset spaces +set expandtab " Override mode for TAB +set nobackup " Dont make backups +set nowritebackup " Dont save backups -" SHOWS HIDDEN +" Cursor setup +let &t_EI = "\e[2 q" " Block on NORMAL mode +let &t_SI = "\e[6 q" " Bar on INSERT mode + +" Keyboard shortcuts setup +map :w " Save file CTRL+S +map :q " Exit Vim CTRL+S + +" Shows hidden setup set list listchars=tab:»\ ,extends:→,precedes:←,nbsp:·,trail:·, diff --git a/.zshrc b/.zshrc index a630c75..6b83d92 100644 --- a/.zshrc +++ b/.zshrc @@ -1,42 +1,45 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. -# Custom config `.zshrc` file for Ubuntu. You can use this script on all -# available hosts in the home labs network and a cloud servers thats you have. +# This is a custom configuration `.zshrc` file for Linux system. You can use +# this script for all available hosts in your network. # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. + + +# Instant prompt if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi -# If you come from bash you might have to change your $PATH. +# If you come from bash you might have to change your $PATH export PATH=$HOME/bin:/usr/local/bin:$PATH -# Python script WARNING which is not on PATCH. +# Python script `WARNING` which is not on $PATH export PATH=$HOME/.local/bin:$PATH -# Initial host name and user name. +# Initial host name and user name name=$( ( echo $USER ) ) nhos=$( ( echo "$(cat /etc/hostname)" ) ) -# Color WARNING! on powerlevel9k.zsh-theme +# Color `WARNING` on powerlevel9k.zsh-theme export TERM="xterm-256color" -# Disabled underline zsh-syntax-highlighting. +# Disabled underline (( ${+ZSH_HIGHLIGHT_STYLES} )) || typeset -A ZSH_HIGHLIGHT_STYLES ZSH_HIGHLIGHT_STYLES[path]=none ZSH_HIGHLIGHT_STYLES[path_prefix]=none -# Checking host and export path to oh-my-zsh installation. +# Checking host and export $PATH to `.oh-my-zsh` installation if [[ $name = 'mdsanima' ]]; then export ZSH="/home/mdsanima/.oh-my-zsh" elif [[ $name = 'ubuntu' ]]; then export ZSH="/home/ubuntu/.oh-my-zsh" fi -# Set automatically run zsh script from `/etc/profile.d` directory. -# Don't run this on wsl-1 and jammy hosts. +# Set auto run zsh script from `/etc/profile.d` directory, dont run on wsl if [[ $nhos != 'wsl-1' && $nhos != 'jammy' ]]; then if [[ -d /etc/profile.d ]]; then for i in /etc/profile.d/*.sh; do @@ -48,33 +51,33 @@ if [[ $nhos != 'wsl-1' && $nhos != 'jammy' ]]; then fi fi -# Set name of the theme to load. +# Set name of the theme to load ZSH_THEME="powerlevel10k/powerlevel10k" -# Execution time stamp shown in the history command output. +# Execution time stamp shown in the history command output HIST_STAMPS="yyyy-mm-dd" -# Adjustment to the right side. +# Adjustment to the right side ZLE_RPROMPT_INDENT=0 -# History settings. -HISTSIZE=50000 # History lines stored in memory. -HISTFILESIZE=20000 # History lines stored on disk. -HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " # Adding date time before each commands. +# History settings +HISTSIZE=50000 # History lines stored in memory +HISTFILESIZE=20000 # History lines stored on disk +HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " # Adding date time before each commands -# Custom plugins to load. +# Custom plugins to load plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search) -# Add zsh terminal. +# Add zsh terminal source $ZSH/oh-my-zsh.sh -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh -# Type `dircolors --print-database` in terminal. +# Type `dircolors --print-database` in terminal [[ -e $HOME/.dircolors ]] && eval "`dircolors --sh $HOME/.dircolors`" -# Checking host and set the colors and icons. +# Checking host and set the colors and icons if [[ $nhos = 'none' ]]; then none=none elif [[ $nhos == 'jammy' ]]; then @@ -145,16 +148,16 @@ elif [[ $nhos == 'rpi-1' || $nhos == 'rpi-2' || $nhos == 'rpi-3' || $nhos == 'rp typeset -g POWERLEVEL9K_DIR_PREFIX='💩 ' fi -# This is a extensions for zsh. +# This is a extensions for zsh, uncomment this if you want to turn on this ext # autoload predict-on # predict-on -# Alias definitions from bash. +# Alias definitions for BASH if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi -# Alias definitions from zsh. +# Alias definitions for ZSH if [ -f ~/.aliases ]; then . ~/.aliases fi diff --git a/install.ps1 b/install.ps1 index 11ecb69..3c22286 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,16 +1,18 @@ -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. # This is a installation script for `Oh My Posh` a prompt theme engine. # This installer is only available for Windows on PowerShell terminal. -# Input switch parameters when the script is started. + +# Input switch parameters when the script is started param ( [switch]$version = $false, [switch]$help = $false, [switch]$install = $true ) -# Initial necessary variables. +# Initial necessary variables [string]$currentPath = $PWD.Path [string]$fileName = "Microsoft.PowerShell_profile.ps1" [string]$themeName = "mdsanima.omp.json" @@ -23,7 +25,7 @@ param ( [string]$themePath = Join-Path $currentPath ".config\omp\$themeName" [string]$profilePath = Join-Path $powerShellFolder $fileName -# Profile content data config for auto generated file. +# Profile content data config for auto generated file [string]$profileContent = @" # This file has been auto generated by installation script. # For more info please check the event log below. @@ -32,61 +34,61 @@ param ( # Generated: $getDate # System: $operatingSystem # Version: $getLastGitTag -# Repository: https://github.com/mdsanima-dev/dotfiles +# Repository: https://github.com/mdsanima-dev/dotfiles/ # Commit: $getLastCommit # Script: $currentPath\install.ps1 # Theme: $themePath # Profile: $profilePath -# Initial setup prompt theme. +# Initial setup prompt theme oh-my-posh init pwsh --config $themePath | Invoke-Expression -# Import necessary modules. +# Import necessary modules Import-Module -Name Terminal-Icons Import-Module -Name PSReadLine -# Config history options. +# Config history options Set-PSReadLineOption -PredictionSource History Set-PSReadLineOption -PredictionViewStyle ListView Set-PSReadLineOption -EditMode Windows "@ -# Writing the event log info. +# Writing the event logs info function Write-ShowInfo { param($BgColor, $FgColor, [string]$LogInfo) Write-Host "" Write-Host " " -NoNewLine - Write-Host " MDSANIMA-DEV " -ForegroundColor White -BackgroundColor $BgColor -NoNewLine + Write-Host " MDSANIMA DEV " -ForegroundColor White -BackgroundColor $BgColor -NoNewLine Write-Host " $LogInfo" -ForegroundColor $FgColor } -# Writing the version and app name. +# Writing the version and app name function Write-ShowVersion { Write-ShowInfo DarkGray Blue "dotfiles $getLastGitTag" Write-Host "" } -# Writing the help instruction. +# Writing the help instruction function Write-ShowHelp { Write-ShowVersion Write-Host " This installer is only available for Windows on PowerShell terminal." -ForegroundColor White Write-Host "" - Write-Host " Copyright © 2023 MDSANIMA" -ForegroundColor Blue + Write-Host " Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. Licensed under the MIT license." -ForegroundColor Blue Write-Host "" } -# Creating the PowerShell profile for current user. +# Creating the PowerShell profile for current user function Out-CreateProfile { $content = $profileContent - # Checking if the `PowerShell` folder exists, if not, create it. + # Checking if the `PowerShell` folder exists, if not, create it if (-not (Test-Path -Path $powerShellFolder -PathType Container)) { New-Item -Path $powerShellFolder -ItemType Directory > $null Write-ShowInfo Green DarkGray "A 'PowerShell' folder has been successfully created in the user's Documents directory." Write-Host " Path:" -ForegroundColor Green -NoNewLine; Write-Host " $powerShellFolder" } - # Checking if the profile exist, if yes, create backup file. + # Checking if the profile exist, if yes, create backup file if (Test-Path -Path $profilePath) { $fileInfo = Get-Item -Path $profilePath $timestamp = Get-Date -Format "yyyyMMdd_HHmmss" @@ -99,25 +101,25 @@ function Out-CreateProfile { Write-Host " Path:" -ForegroundColor Green -NoNewLine; Write-Host " $newFilePath" } - # Creating new profile. + # Creating new profile $content | Out-File -FilePath $profilePath -Encoding UTF8 Write-ShowInfo Green DarkGray "The new profile has been successfully created in the 'PowerShell' folder." Write-Host " Path:" -ForegroundColor Green -NoNewLine; Write-Host " $profilePath" } -# Showing the latest tag from git repo when type `-version` or `-v` options. +# Showing the latest tag from git repo when type `-version` or `-v` options if ($version -like $true) { $install = $false Write-ShowVersion } -# Showing the help instruction when type `-help` or `-h` options. +# Showing the help instruction when type `-help` or `-h` options if ($help -like $true) { $install = $false Write-ShowHelp } -# Runing the main installation script. +# Runing the main installation script if ($install -like $true) { Write-ShowVersion diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 9ec0124..b3ec0cf --- a/install.sh +++ b/install.sh @@ -1,22 +1,25 @@ #!/usr/bin/env bash -# Copyright © 2023 MDSANIMA +# Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. +# Licensed under the MIT license. # This is a installation script for `Oh My Zsh` terminal configuration. This # script also colorize print text in a fancy way. -# List of packages to install. + +# List of packages to install APT_PACKAGES="python3-pip zsh powerline fonts-powerline zsh-theme-powerlevel9k" APT_PACKAGES_OPTIONAL="curl git htop vim tmux mc neofetch cmatrix ffmpeg" -# Get the current tag from the Git repository. +# Get the current tag from the Git repository CURRENT_GIT_TAG=$(git describe --tags) -# Import default color definition. -source "$PWD/.local/bin/mdsanima-color" +# Import default colors definition +source "$PWD/.local/bin/mdsanima-colors" + -# Help function for printing text in color. -function color_print() { +# Help function for printing text in colors +function _color_print() { local text="$1" local fg_color local bg_color @@ -24,7 +27,6 @@ function color_print() { shift 1 - # Iterate over all arguments. while [[ $# -gt 0 ]]; do case "$1" in -fg) @@ -69,29 +71,34 @@ function color_print() { fi } -# Printing the event log info. -function print_show_info() { + +# Event logs information +function _print_event() { local bg_color="$1" local fg_color="$2" local log_info="$3" - color_print " MDSANIMA-DEV " -fg WHITE -bg $bg_color -nonewline - color_print " $log_info" -fg $fg_color + _color_print " MDSANIMA DEV " -fg WHITE -bg $bg_color -nonewline + _color_print " $log_info" -fg $fg_color } -# Printing the version and app name. -function print_show_version() { - color_print "" - print_show_info GRAY ORANGE "dotfiles $CURRENT_GIT_TAG" - color_print "" + +# Version and application name +function show_version() { + _color_print "" + _print_event GRAY SKY "dotfiles $CURRENT_GIT_TAG" + _color_print "" } -# Printing the help instruction. -function print_show_help() { - print_show_version - color_print "This installer is only available for Linux system." -fg WHITE - color_print "" - color_print "Copyright © 2023 MDSANIMA" -fg ORANGE - color_print "" + +# Help instruction +function show_help() { + _color_print "This installer is only available for Linux system." -fg WHITE + _color_print "" + _color_print "Copyright (c) 2023-2024 MDSANIMA DEV. All rights reserved. Licensed under the MIT license." -fg RED + _color_print "" } -print_show_help + +# Run these functions +show_version +show_help