init
This commit is contained in:
37
all/templates/bash_aliases.j2
Normal file
37
all/templates/bash_aliases.j2
Normal file
@@ -0,0 +1,37 @@
|
||||
# General
|
||||
alias clear="printf '\033c'" # faster than ncurses clear by a lot
|
||||
alias c='clear'
|
||||
alias bashrc="vim ~/.bashrc && source ~/.bashrc"
|
||||
# LS
|
||||
alias ls='ls --color=auto -FAh'
|
||||
alias ll='ls -l'
|
||||
alias la='ls'
|
||||
alias l.='ls | egrep "^\."'
|
||||
alias l=ls
|
||||
# GREP
|
||||
alias grep='grep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
# GIT
|
||||
alias ga='git add'
|
||||
alias gc='git commit'
|
||||
alias gp='git push'
|
||||
alias lc='fc -nl $HISTCMD'
|
||||
# CADDY
|
||||
alias rc='caddy reload --config ~/Caddyfile'
|
||||
alias ft='caddy fmt --overwrite ~/Caddyfile'
|
||||
alias vt='caddy validate --config ~/Caddyfile'
|
||||
# DOCKER
|
||||
alias dockup='docker compose pull; docker compose down && docker compose up -d --build --remove-orphans'
|
||||
# Navigation
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../../'
|
||||
alias ....='cd ../../../'
|
||||
alias .....='cd ../../../../'
|
||||
# Readability
|
||||
alias cp="cp -iv"
|
||||
alias mv='mv -iv'
|
||||
alias rm='rm -iv'
|
||||
alias df='df -h'
|
||||
alias free='free -m'
|
||||
alias mkdir='mkdir -pv'
|
42
all/templates/bashrc.j2
Normal file
42
all/templates/bashrc.j2
Normal file
@@ -0,0 +1,42 @@
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
export HISTCONTROL=ignoredups:erasedups
|
||||
export HISTFILESIZE=
|
||||
export HISTSIZE=
|
||||
export HISTTIMEFORMAT="[%F %T] "
|
||||
# Change the file location because certain bash sessions truncate .bash_history file upon close.
|
||||
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
|
||||
export HISTFILE=~/.bash_history
|
||||
# Force prompt to write history after every command.
|
||||
# http://superuser.com/questions/20900/bash-history-loss
|
||||
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
|
||||
|
||||
shopt -s autocd # change to named directory
|
||||
shopt -s cdspell # autocorrects cd misspellings
|
||||
shopt -s cmdhist # save multi-line commands in history as single line
|
||||
shopt -s dotglob
|
||||
shopt -s histappend # do not overwrite history
|
||||
shopt -s expand_aliases # expand aliases
|
||||
shopt -s extglob
|
||||
#ignore upper and lowercase when TAB completion
|
||||
bind "set completion-ignore-case on"
|
||||
|
||||
# colored GCC warnings and errors
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
28
all/templates/profile.j2
Normal file
28
all/templates/profile.j2
Normal file
@@ -0,0 +1,28 @@
|
||||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
. "$HOME/.prompt"
|
57
all/templates/prompt.j2
Normal file
57
all/templates/prompt.j2
Normal file
@@ -0,0 +1,57 @@
|
||||
__sig() {
|
||||
# Giant switch case for getting the name of the signal (`kill -l`)
|
||||
a=0
|
||||
for i in $@; do
|
||||
a=$((a+1))
|
||||
case $i in
|
||||
126) printf ACCES ;;
|
||||
127) printf NOENT ;;
|
||||
129) printf HUP ;;
|
||||
130) printf INT ;;
|
||||
131) printf QUIT ;;
|
||||
132) printf ILL ;;
|
||||
133) printf TRAP ;;
|
||||
134) printf ABRT ;;
|
||||
135) printf BUS ;;
|
||||
136) printf FPE ;;
|
||||
137) printf KILL ;;
|
||||
138) printf USR1 ;;
|
||||
139) printf SEGV ;;
|
||||
140) printf USR2 ;;
|
||||
141) printf PIPE ;;
|
||||
142) printf ALRM ;;
|
||||
143) printf TERM ;;
|
||||
144) printf STKFLT ;;
|
||||
145) printf CHLD ;;
|
||||
146) printf CONT ;;
|
||||
147) printf STOP ;;
|
||||
148) printf TSTP ;;
|
||||
149) printf TTIN ;;
|
||||
150) printf TTOU ;;
|
||||
151) printf URG ;;
|
||||
152) printf XCPU ;;
|
||||
153) printf XFSZ ;;
|
||||
154) printf VTALRM ;;
|
||||
155) printf PROF ;;
|
||||
156) printf WINCH ;;
|
||||
157) printf IO ;;
|
||||
158) printf PWR ;;
|
||||
159) printf SYS ;;
|
||||
16[3-9]|1[7-8][0-9]|19[0-2]) printf RT$(($i-128)) ;; # Savagery
|
||||
*) printf $i ;; # Print exit code if not in list
|
||||
esac
|
||||
done
|
||||
}
|
||||
sig() {
|
||||
PLC=(${PIPESTATUS[@]})
|
||||
printf "$(__sig ${PLC[@]})"
|
||||
}
|
||||
NO_COLOUR="\[\033[0m\]"
|
||||
# Bold Colours
|
||||
RED="\[\033[01;31m\]"
|
||||
GREEN="\[\033[01;32m\]"
|
||||
YELLOW="\[\033[01;33m\]"
|
||||
BLUE="\[\033[01;34m\]"
|
||||
|
||||
PS1="[${RED}\$(sig)${NO_COLOUR}] [\t] [${RED}\u${NO_COLOUR}@${GREEN}\h${NO_COLOUR}|${BLUE}\w${NO_COLOUR}] [${YELLOW}#\#${NO_COLOUR}] ${GREEN}\$ ${NO_COLOUR}"
|
||||
|
15
all/templates/sshd_config.j2
Normal file
15
all/templates/sshd_config.j2
Normal file
@@ -0,0 +1,15 @@
|
||||
{% if inventory_hostname == 'eu' %}
|
||||
Port 222
|
||||
{% else %}
|
||||
Port 22
|
||||
{% endif %}
|
||||
PermitRootLogin prohibit-password
|
||||
PasswordAuthentication no
|
||||
PermitEmptyPasswords no
|
||||
ChallengeResponseAuthentication no
|
||||
UsePAM no
|
||||
X11Forwarding no
|
||||
PrintMotd yes
|
||||
UseDNS no
|
||||
AcceptEnv LANG LC_*
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
Reference in New Issue
Block a user