Browse Source

bashrc/zshrc update

master
chodak166 3 weeks ago
parent
commit
191679bb00
  1. 24
      .bashrc
  2. 4
      .gitignore
  3. 72
      .zshrc
  4. 2
      README.md

24
.bashrc

@ -1,8 +1,3 @@
### Added by Codeium. These lines cannot be automatically removed if modified
if command -v termium > /dev/null 2>&1; then
eval "$(termium shell-hook show pre)"
fi
### End of Codeium integration
# ~/.bashrc: executed by bash(1) for non-login shells. # ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples # for examples
@ -123,8 +118,8 @@ fi
######### GIT-AWARE-PROMPT ######### ######### GIT-AWARE-PROMPT #########
export GITAWAREPROMPT=/usr/share/git-aware-prompt #export GITAWAREPROMPT=/usr/share/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh" #source "${GITAWAREPROMPT}/main.sh"
export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ " export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
@ -153,20 +148,19 @@ PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
alias pbgit='git config user.name "Łukasz Chodyła" && git config user.email "lukasz.chodyla@platformabiznesu.net"' alias git-config-pb='git config user.name "Łukasz Chodyła" && git config user.email "lukasz.chodyla@platformabiznesu.net"'
alias git-cofig-ch='git config user.name "chodak166" && git config user.email "chodak166@op.pl"
alias bashI="bash --init-file <(echo '. ~/.bashrc; unset HISTFILE')" alias ibash="bash --init-file <(echo '. ~/.bashrc; unset HISTFILE')"
alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all" alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
alias bat=batcat
# source /usr/share/doc/fzf/examples/key-bindings.bash
[ -f ~/.fzf.bash ] && source ~/.fzf.bash [ -f ~/.fzf.bash ] && source ~/.fzf.bash
alias cat=batcat
### Added by Codeium. These lines cannot be automatically removed if modified
if command -v termium > /dev/null 2>&1; then
eval "$(termium shell-hook show post)"
fi
### End of Codeium integration
. "$HOME/.local/bin/env" . "$HOME/.local/bin/env"

4
.gitignore vendored

@ -1,4 +0,0 @@
# ---> Diff
*.patch
*.diff

72
.zshrc

@ -163,79 +163,15 @@ if [[ "$TERM" == screen* ]]; then
PROMPT_COMMAND="screen_set_window_title; $PROMPT_COMMAND" PROMPT_COMMAND="screen_set_window_title; $PROMPT_COMMAND"
fi fi
edit_secure() {
# Using $HOME is safer than ~ inside scripts
local plain_file="$HOME/.scripts/secure_functions.sh"
local encrypted_file="${plain_file}.gpg"
# 1. Check if the encrypted file exists
if [[ -f "$encrypted_file" ]]; then
# It exists: Decrypt it so we can edit
gpg -q -o "$plain_file" -d "$encrypted_file" || return 1
else
# It doesn't exist: Create the directory just in case
mkdir -p "$(dirname "$plain_file")"
echo "Creating new secure file..."
fi
# 2. Open editor (Defaults to nano if EDITOR is not set)
${EDITOR:-nano} "$plain_file"
# 3. Encrypt and Cleanup
# Only encrypt if the file actually exists (in case you exited editor without saving)
if [[ -f "$plain_file" ]]; then
echo "Encrypting..."
# Encrypt (-c) AND THEN remove the plaintext file (rm) only if encryption succeeded (&&)
gpg -c "$plain_file" && rm "$plain_file"
echo "Done. Secrets saved to $encrypted_file"
else
echo "Aborted: No file saved."
fi
}
_run_secure_func() {
local func_name="$1"
local encrypted_file="$HOME/.scripts/secure_functions.sh.gpg"
[[ -f "$encrypted_file" ]] || {
echo "Error: Encrypted file not found" >&2
return 1
}
# SECURITY CRITICAL: Run in isolated subshell with history disabled
(
# Cross-shell history disabling
unset HISTFILE # Disables history file in BOTH shells
HISTSIZE=0 # Bash: disable in-memory history
SAVEHIST=0 # Zsh: disable history saving
# Zsh-specific hardening (safe to run in bash too)
[ -n "${ZSH_VERSION:-}" ] && setopt no_history no_hist_save no_hist_verify 2>/dev/null || true
# Decrypt → source → execute (all in-memory)
gpg --quiet --decrypt "$encrypted_file" 2>/dev/null | {
source /dev/stdin
"$func_name"
}
)
# Optional: Invalidate cache after use (prevents lingering secrets)
#{ sleep 1; echo RELOADAGENT | gpg-connect-agent >/dev/null 2>&1; } &
}
test_secure() {
_run_secure_func _test_secure
}
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
alias bat=batcat alias bat=batcat
alias ll='eza --icons=auto -T --level 2 -lah --group-directories-first --color=always | less' alias ll='eza --icons=auto -T --level 2 -lah --group-directories-first --color=always | less'
alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
alias git-config-pb='git config user.name "Łukasz Chodyła" && git config user.email "lukasz.chodyla@platformabiznesu.net"'
alias git-cofig-ch='git config user.name "chodak166" && git config user.email "chodak166@op.pl"
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
export VCPKG_ROOT=/opt/vcpkg export VCPKG_ROOT=/opt/vcpkg
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
. "$HOME/.local/bin/env" . "$HOME/.local/bin/env"

2
README.md

@ -1,2 +0,0 @@
# dotfiles
Loading…
Cancel
Save