diff --git a/itdominator-base-image/Dockerfile b/itdominator-base-image/Dockerfile index 3bae942..a8b95d5 100644 --- a/itdominator-base-image/Dockerfile +++ b/itdominator-base-image/Dockerfile @@ -10,9 +10,10 @@ FROM nginx # 1. B: Set ENV Variables ENV TERM=xterm-256color -# 2. Set the working directory inside the container +# 2. Setup home user RUN groupadd -g 1000 abaddon RUN useradd -u 1000 -g 1000 -r -s /bin/false abaddon +COPY env/* /home/abaddon/ RUN mkdir -p /home/abaddon/Code RUN mkdir -p /home/abaddon/Downloads RUN mkdir -p /home/abaddon/LazyShare @@ -20,6 +21,7 @@ RUN mkdir -p /home/abaddon/.local RUN mkdir -p /home/abaddon/.config RUN mkdir -p /home/abaddon/.cache RUN mkdir -p /home/abaddon/.thumbnails +RUN chown abaddon:abaddon -R /home/abaddon # 3. A: Install dependencies RUN apt-get update @@ -43,6 +45,7 @@ RUN apt-get install -y \ bat \ 7zip \ zip \ + unzip \ tar \ curl \ wget \ diff --git a/itdominator-base-image/env/.bash_aliases b/itdominator-base-image/env/.bash_aliases new file mode 100644 index 0000000..65477df --- /dev/null +++ b/itdominator-base-image/env/.bash_aliases @@ -0,0 +1,52 @@ +# Aliases + + +alias ls="ls --block-size=M" +alias lsd="ls -d --block-size=M */" +alias lines-of-code="cloc --no3 --by-file-by-lang" +alias list-biggest-dirs="du -a . | sort -n -r | head -n 50" +alias list-biggest-files="find -type f -exec du -Sh {} + | sort -rh | head -n 50" +alias fman="compgen -c | fzf | xargs man" + +# Docker +alias docker="podman" + +# Archiving +alias ltar="tar -ztvf" +alias untar="tar -zxvf" +alias atar="tar -cvzf" + +# NPM +alias npm-list-global='npm list -g --depth 0' +alias npm-update-npm='npm install -g npm' +alias npm-list-local='npm list --depth 0' + +# Common used command +alias wget='wget -c' +alias cls='clear' +alias less="less -S +G" +alias ls="ls -F -h -s --group-directories-first --color=always" +alias lt='ls --human-readable --size -1 -S --classify' +alias count='find . -type f | wc -l' +alias refresh-bash='. ~/.bashrc' +alias du="du -h -d 1" +#alias grep="grep -n -R" + +#gdb no copyright start and use better gui look +alias gdb='gdb -tui -q' + +#Git +alias gitA="git add -A ." +alias gitC="git commit -m" +alias gitP="git push" + +# Python +alias pySimpleServer='python -m http.server' # Python 3 +#alias pySimpleServer='python -m SimpleHTTPServer' # Python 2 +alias pyCgiServer='python -m CGIHTTPServer' +alias py-venv='python3 -m venv' +alias py-src-activate='source ./bin/activate' +alias py-freeze='pip freeze --local > requirements.txt' +alias py-upgrade-all='python -m pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U' +#alias py-trace='python -m trace --ignore-dir=../lib --trace' +#alias py-trace="python -m trace --ignore-dir=$(python -c 'import sys ; print(\":\".join(sys.path)[1:])') --trace" diff --git a/itdominator-base-image/env/.bash_colors b/itdominator-base-image/env/.bash_colors new file mode 100644 index 0000000..59c605e --- /dev/null +++ b/itdominator-base-image/env/.bash_colors @@ -0,0 +1,50 @@ +# Simpler colors in terminal scripts +bold=`echo -en "\e[1m"` +underline=`echo -en "\e[4m"` +dim=`echo -en "\e[2m"` +strickthrough=`echo -en "\e[9m"` +blink=`echo -en "\e[5m"` +reverse=`echo -en "\e[7m"` +hidden=`echo -en "\e[8m"` +normal=`echo -en "\e[0m"` +black=`echo -en "\e[30m"` +red=`echo -en "\e[31m"` +green=`echo -en "\e[32m"` +orange=`echo -en "\e[33m"` +blue=`echo -en "\e[34m"` +purple=`echo -en "\e[35m"` +aqua=`echo -en "\e[36m"` +gray=`echo -en "\e[37m"` +darkgray=`echo -en "\e[90m"` +lightred=`echo -en "\e[91m"` +lightgreen=`echo -en "\e[92m"` +lightyellow=`echo -en "\e[93m"` +lightblue=`echo -en "\e[94m"` +lightpurple=`echo -en "\e[95m"` +lightaqua=`echo -en "\e[96m"` +white=`echo -en "\e[97m"` +default=`echo -en "\e[39m"` +BLACK=`echo -en "\e[40m"` +RED=`echo -en "\e[41m"` +GREEN=`echo -en "\e[42m"` +ORANGE=`echo -en "\e[43m"` +BLUE=`echo -en "\e[44m"` +PURPLE=`echo -en "\e[45m"` +AQUA=`echo -en "\e[46m"` +GRAY=`echo -en "\e[47m"` +DARKGRAY=`echo -en "\e[100m"` +LIGHTRED=`echo -en "\e[101m"` +LIGHTGREEN=`echo -en "\e[102m"` +LIGHTYELLOW=`echo -en "\e[103m"` +LIGHTBLUE=`echo -en "\e[104m"` +LIGHTPURPLE=`echo -en "\e[105m"` +LIGHTAQUA=`echo -en "\e[106m"` +WHITE=`echo -en "\e[107m"` +DEFAULT=`echo -en "\e[49m"` +export LESS_TERMCAP_so=${white}${BLACK} # begin standout-mode - info box +export LESS_TERMCAP_mb=${lightred} # begin blinking +export LESS_TERMCAP_md=${lightyellow} # begin bold +export LESS_TERMCAP_us=${lightgreen} # begin underline +export LESS_TERMCAP_me=${default}${DEFAULT} # end mode +export LESS_TERMCAP_se=${default}${DEFAULT} # end standout-mode +export LESS_TERMCAP_ue=${default}${DEFAULT} # end underline diff --git a/itdominator-base-image/env/.bash_exports b/itdominator-base-image/env/.bash_exports new file mode 100644 index 0000000..1e27f52 --- /dev/null +++ b/itdominator-base-image/env/.bash_exports @@ -0,0 +1,20 @@ +# Python +export PYTHONDONTWRITEBYTECODE=1 + + +# Launchpad Config Parts +shopt -s cdspell +shopt -s autocd shift_verbose +shopt -s dirspell + + +# Bash history settings +export HISTSIZE=3000 +export HISTCONTROL=$HISTCONTROL:ignoredups + +# Default Editor +export EDITOR=nano + +# Default FZF +# Note: bat is cat but with colors +export FZF_DEFAULT_OPTS="--layout=reverse --height=100% --preview='bat -p --color=always {}'" diff --git a/itdominator-base-image/env/.bash_functions b/itdominator-base-image/env/.bash_functions new file mode 100644 index 0000000..6da60e8 --- /dev/null +++ b/itdominator-base-image/env/.bash_functions @@ -0,0 +1,48 @@ +# Functions + + +# Python based scripts + +function py-trace() { + python -m trace --ignore-dir=$(python -c 'import sys ; print(":".join(sys.path)[1:])') --trace "$@" +} + +# Everything else + +function git-branch() { + branch=`git branch | fzf | xargs` + git checkout "${branch}" +} + +function ex() { + if [ -f $1 ]; then + case $1 in + *.tar.bz2) tar xjf $1 ;; + *.tar.gz) tar xzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xf $1 ;; + *.tbz2) tar xjf $1 ;; + *.tgz) tar xzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.7z) 7z x $1 ;; + *.deb) ar x $1 ;; + *.tar.xz) tar xf $1 ;; + *.tar.zst) tar xf $1 ;; + *) echo "'$1' cannot be extracted using ex()" ;; + esac + else + echo "'$1' is not a valid file" + fi + +} + +function php-server() { + if [ $1 <= 1024 ]; then + authbind php -S 0.0.0.0:"$1" + else + php -S 0.0.0.0:"$1" + fi +} diff --git a/itdominator-base-image/env/.bash_ps1 b/itdominator-base-image/env/.bash_ps1 new file mode 100644 index 0000000..1c03f02 --- /dev/null +++ b/itdominator-base-image/env/.bash_ps1 @@ -0,0 +1,17 @@ +#sysInfo="$(screenfetch)" +#export PS1="${sysInfo} + + + +function prompt_command() { + _COMMAND="parts = '$(pwd)'.split('/'); print('$(pwd)') if not len(parts) > 3 else print(f'.../{parts[-3]}/{parts[-2]}/{parts[-1]}')" + _PATH=$(python <<< "${_COMMAND}" || pwd) + _BRANCH="$(git rev-parse --symbolic-full-name --abbrev-ref HEAD 2>/dev/null)" + + # Week Day/Month/Day : Time -- user@group -- current dir path -- git branch + PS1="\[\e[32m\]\d\[\e[m\]: \[\e[36m\]\@\[\e[m\] -- \[\e[31m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\] -- \[\e[35m\]${_PATH}\[\e[m\] -- ${_BRANCH} \\$ " +} + + + +export PROMPT_COMMAND=prompt_command diff --git a/itdominator-base-image/env/.bashrc b/itdominator-base-image/env/.bashrc new file mode 100644 index 0000000..a3ca88e --- /dev/null +++ b/itdominator-base-image/env/.bashrc @@ -0,0 +1,42 @@ +# Colors +if [ -e $HOME/.bash_colors ]; then + source $HOME/.bash_colors +fi + +# Exports Variable Settings +if [ -e $HOME/.bash_exports ]; then + source $HOME/.bash_exports +fi + +# Paths +if [ -e $HOME/.bash_paths ]; then + source $HOME/.bash_paths +fi + +if [ -e $HOME/.bash_ld_library_path ]; then + source $HOME/.bash_ld_library_path +fi + +# Aliases +if [ -e $HOME/.bash_aliases ]; then + source $HOME/.bash_aliases +fi + +# Functions +if [ -e $HOME/.bash_functions ]; then + source $HOME/.bash_functions +fi + +# Auto complete -- Note: Must have bash-completion package +if [ -f /etc/bash_completion ]; then + . /etc/bash_completion +fi + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash + + +# Terminal look and feel with logo and then custom prompt line +echo "${lightred}Welcome to the dark side of the moon, $(whoami)!${default}" +if [ -e $HOME/.bash_ps1 ]; then + source $HOME/.bash_ps1 +fi diff --git a/itdominator-base-image/env/.gitconfig b/itdominator-base-image/env/.gitconfig new file mode 100644 index 0000000..2f82ea3 --- /dev/null +++ b/itdominator-base-image/env/.gitconfig @@ -0,0 +1,8 @@ +[user] + email = 1itdominator@gmail.com + name = itdominator +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true