export ZSH="/home/{{ target_user }}/.oh-my-zsh" ENABLE_CORRECTION=true plugins=(git common-aliases history systemd sudo zsh-autosuggestions zsh-syntax-highlighting eza fzf direnv taskwarrior zoxide) source $ZSH/oh-my-zsh.sh ### add .local/bin to PATH ### export PATH=$HOME/.local/bin:$PATH ### zsh autosuggestions color ### ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=8,underline" # Solarized theme # ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=10,underline" ### Ruby gems ### if which ruby >/dev/null && which gem >/dev/null; then PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH" fi ### editor ### export EDITOR=hx alias vim="nvim -p" alias alacrittyconf="$EDITOR ~/.config/alacritty/alacritty.yml" alias kittyconf="$EDITOR ~/.config/kitty/kitty.conf" ### git aliases ### export GIT_EDITOR=$EDITOR alias gcs="git commit --gpg-sign --signoff --verbose" alias gcsp="git commit --gpg-sign --signoff --verbose --patch" ### tokens ### source ~/.tokens ### gpg as ssh key ### function gpg_for_ssh() { export GPG_TTY=$(tty) export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) gpgconf --launch gpg-agent } gpg_for_ssh ### direnv & nixpkg ### if [[ $(command -v direnv 2> /dev/null) ]]; then eval "$(direnv hook zsh)"; fi if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer ### Rust ### # export RUSTUP_HOME=/opt/rustup # export CARGO_HOME=/opt/cargo # export PATH=/opt/cargo/bin:$PATH # For user-space installation # export PATH=~/.cargo/bin:$PATH # For ‹/opt› installation # export PATH=/opt/cargo/bin:$PATH # [[ -s "/opt/cargo/env" ]] && source /opt/cargo/env ### Go ### export GOPATH=$HOME/.go export PATH="$HOME/.go/bin:$PATH" ### SDKMan ### export SDKMAN_DIR="/opt/sdkman" [[ -s "/opt/sdkman/bin/sdkman-init.sh" ]] && source "/opt/sdkman/bin/sdkman-init.sh" ### Bitwarden ### eval "$(bw completion --shell zsh); compdef _bw bw;" function bwu() { local VAULT=$(basename $BITWARDENCLI_APPDATA_DIR) local PASS=$(kdialog --password "Master password for Bitwarden Vault @ $VAULT") export BW_SESSION=$(bw unlock --raw "$PASS") } alias bwl='export BW_SESSION=' function bwpublic() { export BITWARDENCLI_APPDATA_DIR="$HOME/.config/Bitwarden CLI/vault.bitwarden.com" } function bwvps() { export BITWARDENCLI_APPDATA_DIR="$HOME/.config/Bitwarden CLI/{{ vaultwarden_address }}" } bwvps function gen_pass() { LENGTH=12 if [[ -n $1 ]]; then LENGTH=$1 fi bw generate -uln --length $LENGTH } function gen_passphrase() { LENGTH=2 if [[ -n $1 ]]; then LENGTH=$1 fi bw generate -p --words $LENGTH } ### HashiCorp Vault ### export VAULT_ADDR="https://{{ hashicorp_vault_address }}" function hcvu() { local PASS=$(kdialog --password "Password for HashiCorp Vault @ {{ hashicorp_vault_address }}") vault login -method=userpass -no-print username=$(whoami) password=$PASS } # SSH variables for HashiCorp Vault export VSSH_ROLE=$(whoami) export VSSH_PRINCIPALS="$(whoami),me@mfocko.xyz" ### public_html ### function from_phrase() { bw list items --search $2 | jq --raw-output ".[] | select(.folderId == \"$1\") | .fields[] | select(.value == \"$3\") | .name" } function to_phrase() { bw list items --search $2 | jq --raw-output ".[] | select(.folderId == \"$1\") | .fields[] | select(.name == \"$3\") | .value" } function get_link() { FOLDER=$(bw list folders --search public_html | jq --raw-output ".[0].id") if [[ "$1" == "aisa" ]]; then PREFIX="https://fi.muni.cz/~xfocko"; elif [[ "$1" == "poincare" ]]; then PREFIX="https://me.mfocko.xyz"; fi; echo $PREFIX/$(to_phrase $FOLDER $1 $2) } function ls_links() { FOLDER=$(bw list folders --search public_html | jq --raw-output ".[0].id") bw list items --search $1 | jq ".[] | select(.folderId == \"$FOLDER\") | .fields[].name" } ### Red Hat ### function _rh_pass() { local PIN=$(bw get password "Red Hat - SSO") local TOKEN=$(kdialog --password 'Token for Red Hat - SSO') echo "$PIN$TOKEN" } export RH_VPN_ENDPOINT="Brno (BRQ)" function rh_vpn() { PASS=$(_rh_pass) echo $PASS | nmcli --ask connection up "$RH_VPN_ENDPOINT" } function rh_vpn_rdu2() { RH_VPN_ENDPOINT="Raleigh (RDU2)" rh_vpn } alias rh_ticket='echo "$(bw get password Red\ Hat\ -\ Kerberos)" | kinit mfocko@REDHAT.COM' ### Fedora ### alias fk='echo "$(bw get password Fedora\ Accounts)$(bw get totp Fedora\ Accounts)" | fkinit' ### FI ### alias fi_vpn='echo "$(bw get password Faculty\ Pass)" | nmcli --ask connection up VPN\ FI\ MU' ### C(XX)FLAGS ### # export CC=gcc # export CFLAGS="-std=c11 -Wall -Werror" # export CXXFLAGS="-std=c++14 -Wall -Werror" # export LDLIBS="-lm -lkarel -lcurses" # export LDLIBS="-lm" export LANG=en_US.UTF-8 ### Lazy aliases ### alias q="exit" alias k="exit" alias ts="tmux new -As default" alias Reset="reset && tmux clear-history" alias ff=fastfetch ### Java ### export PATH="/opt/jdk-18/bin:$PATH" ### fzf ### # source $HOME/.oh-my-zsh/custom/plugins/fzf-tab-completion/zsh/fzf-zsh-completion.sh # bindkey '^I' fzf_completion # if [[ "$TMUX" == "" && "$VSCODE_SHELL_INTEGRATION" == "" ]]; then # tmux new -s # fi; ### Bat ### export BAT_THEME=Dracula ### sprunge ### function sprunge_paste() { echo "Paste your code: " cat - | curl -F 'sprunge=<-' http://sprunge.us } ### Zig ### export PATH="$HOME/.zig:$PATH" ### rg wrapper with delta ### function rgd() { rg -C2 --json $@ | delta } ### Starship ### eval "$(starship init zsh)"