Update dotfiles/.local/share/chezmoi/private_dot_config/Brewfile.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/fd/ignore, dotfiles/.local/share/chezmoi/private_dot_config/git/ignore, dotfiles/.local/share/chezmoi/private_dot_config/git/config.tmpl, dotfiles/.local/share/chezmoi/private_dot_config/k9s/plugin.yml, dotfiles/.local/share/chezmoi/private_dot_config/shell/aliases, dotfiles/.local/share/chezmoi/private_dot_config/shell/functions, dotfiles/.local/share/chezmoi/private_dot_config/shell/exports.sh, dotfiles/.local/share/chezmoi/private_dot_config/asdf/default-npm-packages, dotfiles/.profile, dotfiles/.local/share/chezmoi/private_dot_config/shell/motd, dotfiles/.bash_profile, dotfiles/.bashrc, dotfiles/.zshrc, dotfiles/.local/share/chezmoi/private_dot_config/ripgrep/config, dotfiles/.local/share/chezmoi/private_dot_config/readline/inputrc, dotfiles/.local/share/chezmoi/private_dot_config/pg/.gitkeep, dotfiles/.local/share/chezmoi/private_dot_config/putty/.gitkeep, dotfiles/.npmrc, dotfiles/.local/share/chezmoi/private_dot_config/npm/npmrc.tmpl, dotfiles/.local/share/chezmoi/dot_local/state/bash/.gitkeep, dotfiles/.local/share/chezmoi/dot_vim/vimrc, dotfiles/.local/share/chezmoi/dot_profile.tmpl

This commit is contained in:
Brian Zalewski 2022-11-22 04:00:41 +00:00
parent b56118310b
commit 36038a3c70
23 changed files with 941 additions and 237 deletions

View file

@ -1,6 +1,11 @@
# Prefer US English
export LANG="en_US"
# Detect support for advanced terminal features
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
export BASH_SUPPORT=true
fi
chmod +x ~/.local/bin/*
### Clean Up

View file

@ -3,8 +3,13 @@
# Prefer US English
export LANG="en_US"
### Fig / LC_ALL
# Detect support for advanced terminal features
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
export BASH_SUPPORT=true
fi
### Fig / LC_ALL
if [ "$BASH_SUPPORT" = 'true' ]; then
if [[ "$(hostname)" != *'-minimal' ]]; then
export LC_ALL="en_US.UTF-8"
fi
@ -26,13 +31,10 @@ if command -v shopt >/dev/null; then
fi
### History
HISTCONTROL=ignoreboth
HISTSIZE=5000
HISTFILESIZE=5000
HISTFILE=~/.local/bash_history
export HISTFILE="$XDG_STATE_HOME/bash/history"
# Prompt (on bash only)
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
if [ "$BASH_SUPPORT" = 'true' ]; then
if [[ "$(hostname)" != *'-minimal' ]]; then
### Styled Terminal
case "$TERM" in
@ -42,15 +44,15 @@ if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
esac
### Directory Colors (https://github.com/trapd00r/LS_COLORS)
# command -v gdircolors > /dev/null 2>&1 || gdircolors() { dircolors "$@"; }
# if command -v gdircolors > /dev/null && [ -f "$HOME/.config/dircolors" ]; then
# eval "$(gdircolors -b "$HOME/.config/dircolors")"
# fi
command -v gdircolors > /dev/null 2>&1 || gdircolors() { dircolors "$@"; }
if command -v gdircolors > /dev/null && [ -f "$HOME/.config/dircolors" ]; then
eval "$(gdircolors -b "$HOME/.config/dircolors")"
fi
fi
fi
### Bash Completions
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
if [ "$BASH_SUPPORT" = 'true' ]; then
### direnv
if command -v direnv > /dev/null; then
eval "$(direnv hook bash)"

View file

@ -1 +1,5 @@
HOSTNAME={{- .chezmoi.hostname }}
### VIM
export GVIMINIT='let $MYGVIMRC="$XDG_CONFIG_HOME/vim/gvimrc" | source $MYGVIMRC'
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'

View file

@ -0,0 +1,54 @@
silent! call plug#begin()
Plug '~/.vim/plugged/typescript-vim'
Plug '~/.vim/plugged/vim-airline'
Plug '~/.vim/plugged/lightline.vim'
Plug '~/.vim/plugged/vim-javascript'
Plug '~/.vim/plugged/vim-jsx'
Plug '~/.vim/plugged/vim-markdown'
Plug '~/.vim/plugged/dockerfile.vim'
Plug '~/.vim/plugged/php.vim'
Plug '~/.vim/plugged/python-syntax'
Plug '~/.vim/plugged/nerdtree'
Plug '~/.vim/plugged/vim-five'
Plug '~/.vim/plugged/vim-prettier'
Plug '~/.vim/plugged/vim-sensible'
Plug '~/.vim/plugged/editorconfig-vim'
Plug '~/.vim/plugged/vimgutter'
Plug '~/.vim/plugged/vim-surround'
Plug '~/.vim/plugged/vim-carbon-now-sh'
Plug '~/.vim/plugged/vim-multiple-cursors'
Plug '~/.vim/plugged/ale'
Plug '~/.vim/plugged/fzf'
Plug '~/.vim/plugged/fzf.vim'
if executable('node')
Plug '~/.vim/plugged/coc.nvim'
endif
Plug '~/.vim/plugged/syntastic'
Plug '~/.vim/plugged/vim-devicons'
Plug '~/.vim/plugged/zoxide.vim'
Plug '~/.vim/plugged/vim-go'
Plug '~/.vim/plugged/ansible-vim', {'do': './UltiSnips/generate.sh'}
call plug#end()
syntax enable
set background=dark
colorscheme betelgeuse
" set g:lightline = { 'colorscheme': 'ThemerVimLightline' }
" Settings for plugin https://github.com/neoclide/coc.nvim.git
autocmd FileType json syntax match Comment +\/\/.\+$+
" Settings for plugin https://github.com/vim-syntastic/syntastic.git
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Settings for plugin https://github.com/ryanoasis/vim-devicons.git
set encoding=UTF-8
" Automatically apply with Chezmoi anytime a source file is modified
autocmd BufWritePost ~/.local/share/chezmoi/* ! chezmoi apply --source-path "%"

View file

@ -0,0 +1,3 @@
{{- if (eq .host.distro.family "darwin") -}}
{{- includeTemplate "darwin/brewfile" . -}}
{{- end -}}

View file

@ -0,0 +1,6 @@
# EXCLUDE BACKUP FILES
*.bak
# EXCLUDE LIBRARIES ON MACOS
/Library/**
/Users/Library/**

View file

@ -0,0 +1,95 @@
[branch]
autosetuprebase = always
[color]
ui = auto
diff = auto
status = auto
branch = auto
interactive = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
autocrlf = false
safecrlf = warn
pager = delta -w ${FZF_PREVIEW_COLUMNS:-$COLUMNS}
editor = code --wait
whitespace = trailing-space,space-before-tab
[diff]
renamelimit = 0
mnemonicprefix = true
renames = copies
[fetch]
prune = true
[help]
autocorrect = 1
[init]
defaultBranch = main
[interactive]
diffFilter = delta --color-only
[merge]
ff = only
renamelimit = 0
summary = true
stat = true
conflictstyle = diff3
tool = vscode
[mergetool "vscode"]
cmd = code --wait $MERGED
[pack]
threads = 0
[pull]
rebase = true
[push]
autoSetupRemote = true
default = upstream
followTags = true
[rebase]
autosquash = true
[rerere]
enabled = true
autoupdate = true
[transfer]
fsckobjects = true
[status]
showUntrackedFiles = all
[delta]
features = side-by-side line-numbers decorations
syntax-theme = Dracula
plus-style = syntax "#003800"
minus-style = syntax "#3f0001"
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
hunk-header-decoration-style = cyan box ul
[delta "line-numbers"]
line-numbers-left-style = cyan
line-numbers-right-style = cyan
line-numbers-minus-style = 124
line-numbers-plus-style = 28
[user]
name = "{{ .user.name }}"
email = "{{ .user.email }}"
[credential "https://github.com"]
helper = !gh auth git-credential
[credential "https://gist.github.com"]
helper = !gh auth git-credential
[include]
path = ~/.config/git/local.toml

View file

@ -0,0 +1,30 @@
# COMPILED SOURCE
*.o
*.so
*.com
*.dll
*.exe
*.class
# BINARY ARCHIVE FILES
*.7z
*.gz
*.dmg
*.iso
*.jar
*.rar
*.tar
*.zip
*.war
# LOGS
*.log
# OS RELATED FILES
._*
.Trashes
Thumbs.db
.DS_Store
.DS_Store?
ehthumbs.db
.Spotlight-V100

View file

@ -0,0 +1,70 @@
plugin:
# dive image layers
dive:
shortCut: d
confirm: false
description: "Dive image"
scopes:
- containers
command: dive
background: false
args:
- $COL-IMAGE
# get all resources in a namespace using the krew get-all plugin
get-all:
shortCut: g
confirm: false
description: get-all
scopes:
- all
command: sh
background: false
args:
- -c
- "kubectl get-all -n $NAMESPACE | less"
edit-secret:
shortCut: Ctrl-X
confirm: false
description: "Edit Decoded Secret"
scopes:
- secrets
command: kubectl
background: false
args:
- modify-secret
- --namespace
- $NAMESPACE
- --context
- $CONTEXT
- $NAME
# View resource logs using stern
stern:
shortCut: Ctrl-L
confirm: false
description: "Logs <Stern>"
scopes:
- pods
command: stern
background: false
args:
- --tail
- 50
- $FILTER
- -n
- $NAMESPACE
- --context
- $CONTEXT
# watch events on selected resources
# requires linux "watch" command
# change '-n' to adjust refresh time in seconds
watch-events:
shortCut: Shift-E
confirm: false
description: Get Events
scopes:
- all
command: sh
background: false
args:
- -c
- "watch -n 5 kubectl get events --context $CONTEXT --namespace $NAMESPACE --field-selector involvedObject.name=$NAME"

View file

@ -0,0 +1,6 @@
cache=${XDG_CACHE_HOME}/npm
init.license=MIT
init.version=0.0.1
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
prefix=${XDG_DATA_HOME}/npm
store-dir=${XDG_DATA_HOME}/pnpm-store

View file

@ -0,0 +1,46 @@
## SMARTER TAB-COMPLETION (Readline bindings) ##
# Perform file completion in a case insensitive fashion
set completion-ignore-case on
# Treat hyphens and underscores as equivalent
set completion-map-case on
# Display matches for ambiguous patterns at first tab press
set show-all-if-ambiguous on
# Immediately add a trailing slash when autocompleting symlinks to directories
set mark-symlinked-directories on
# Use the text that has already been typed as the prefix for searching through
# commands (basically more intelligent Up/Down behavior)
"\e[A": history-search-backward
"\e[B": history-search-forward
# Do not autocomplete hidden files unless the pattern explicitly begins with a dot
set match-hidden-files off
# Show all autocomplete results at once
set page-completions off
# If there are more than 200 possible completions for a word, ask to show them all
set completion-query-items 200
# Show extra file information when completing, like `ls -F` does
set visible-stats on
# Be more intelligent when autocompleting by also looking at the text after
# the cursor. For example, when the current line is "cd ~/src/mozil", and
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the
# Readline used by Bash 4.)
set skip-completed-text on
# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456'
set input-meta on
set output-meta on
set convert-meta off
# Use Alt/Meta + Delete to delete the preceding word
"\e[3;3~": kill-word

View file

@ -0,0 +1,173 @@
### bat
if command -v bat > /dev/null; then
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
alias bathelp='bat --plain --language=help'
alias cat='bat -pp'
alias less='bat --paging=always'
help() {
"$@" --help 2>&1 | bathelp
}
fi
### curlie
if command -v curlie > /dev/null; then
alias curl='curlie'
fi
### exa
if command -v exa > /dev/null; then
alias ls='exa --long --all --color auto --icons --sort=type'
alias tree='exa --tree'
alias la='ls -la'
alias lt='ls --tree --level=2'
fi
### gping
# Replacement for ping that includes graph
if command -v gping > /dev/null; then
alias ping='gping'
fi
### mitmproxy / mitmweb
if command -v mitmproxy > /dev/null; then
alias mitmproxy="mitmproxy --set confdir=$XDG_CONFIG_HOME/mitmproxy"
fi
if command -v mitmweb > /dev/null; then
alias mitmweb="mitmweb --set confdir=$XDG_CONFIG_HOME/mitmproxy"
fi
### ripgrep
if command -v rg &> /dev/null; then
alias grep='rg'
fi
# Fix for auto expansion (source: https://wiki.archlinux.org/title/Sudo#Passing_aliases)
alias sudo='sudo '
# Reload current shell
alias reload="exec ${SHELL} -l"
# Create an Authelia password hash
alias autheliapassword='docker run authelia/authelia:latest authelia hash-password'
# Shows IP addresses that are currently banned by fail2ban
alias banned='sudo zgrep "Ban" /var/log/fail2ban.log*'
alias connections='nm-connection-editor'
# Make copy command verbose
alias cp='cp -v'
# Command-line DNS utility
alias dog="docker run -it --rm dog"
# Download a file
alias download='curl --continue-at - --location --progress-bar --remote-name --remote-time'
# Download a website
alias downloadsite='wget --mirror -p --convert-links -P'
# Flush DNS
alias flushdns='sudo systemd-resolve --flush-caches && sudo systemd-resolve --statistics'
# FontBook for macOS
alias fontbook="open -b com.apple.FontBook"
# Get the possible GRUB resolutions
alias grubresolutions='sudo hwinfo --framebuffer'
# Execute git command with sudo priviledges while retaining .gitconfig
alias gsudo='sudo git -c "include.path="${XDG_CONFIG_DIR:-$HOME/.config}/git/config\" -c \"include.path=$HOME/.gitconfig\"'
# Create hashed password for Ansible user creation
alias hashpassword='mkpasswd --method=sha-512'
# Show full output when using ls
alias ls='ls -AlhF --color=auto'
# Create parent directories automatically
alias mkdir='mkdir -pv'
# Make mount command output readable
alias mount='mount | column -t'
# Make mv command verbose
alias mv='mv -v'
# Show IP address
alias myip='curl http://ipecho.net/plain; echo'
# Shows local IP addresses
alias mylocalip="ifconfig | grep -Eo 'inet (addr:|adr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'"
# Link pip to pip3
alias pip='pip3'
# Show open ports
alias ports='sudo netstat -tulanp'
# Shuts down the computer, skipping the shutdown scripts
alias poweroff='sudo /sbin/poweroff'
# Open the Rclone web GUI
alias rclonegui='rclone rcd --rc-web-gui --rc-user=admin --rc-pass=pass --rc-serve'
# Reboot the computer
alias reboot='sudo /sbin/reboot'
# Make rm command verbose
alias rm='rm -vi'
# Launch the Python Simple HTTP Server
alias serve='python -m SimpleHTTPServer'
# Generate a SHA1 digest
alias sha1='openssl sha1'
# Shutdown the computer
alias shutdown='sudo /sbin/shutdown'
# Speed test
alias speedtest='wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip'
# Shortcut for config file
alias sshconfig='${EDITOR:code} ~/.ssh/config'
# Pastebin
alias sprunge='curl -F "sprunge=<-" http://sprunge.us'
# Disable Tor for current shell
alias toroff='source torsocks off'
# Enable Tor for current shell
alias toron='source torsocks on'
# Test Tor connection
alias tortest='curl --socks5-hostname 127.0.0.1:9050 --silent https://check.torproject.org/ | head -25'
# Unban IP address (e.g. unban 10.14.24.14)
alias unban='sudo fail2ban-client set sshd unbanip'
# Recursively encrypts files using Ansible Vault
alias unvaultdir='find . -type f -printf "%h/\"%f\" " | xargs ansible-vault decrypt'
# Alias for updating software
alias update='sudo apt-get update && sudo apt-get upgrade'
# Sets v as an alias for vim
alias v='vim'
# Recursively encrypts files using Ansible Vault
alias vaultdir='find . -type f -printf "%h/\"%f\" " | xargs ansible-vault encrypt'
# Shows nice looking report of weather
alias weather='curl -A curl wttr.in'
# Change .wget-hsts file location
alias wget="wget --hsts-file ~/.config/.wget-hsts"
### Yarn
alias yarn='yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"'
# Running this will update GPG to point to the current YubiKey
alias yubikey-gpg-stub='gpg-connect-agent "scd serialno" "learn --force" /bye'

View file

@ -0,0 +1,277 @@
#!/usr/bin/env sh
### XDG
# Source: # https://wiki.archlinux.org/index.php/XDG_Base_Directory
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_RUNTIME_DIR=
{{- if eq .host.distro.family "darwin" -}}
"$TMPDIR"
{{- else if not .host.headless -}}
"/run/user/$(id -u)"
{{- else -}}
"/tmp"
{{- end }}
{{- if not .host.headless }}
export XDG_MUSIC_DIR="$HOME/Music"
export XDG_VIDEOS_DIR="$HOME/Videos"
export XDG_DESKTOP_DIR="$HOME/Desktop"
export XDG_PICTURES_DIR="$HOME/Pictures"
export XDG_DOWNLOAD_DIR="$HOME/Downloads"
export XDG_DOCUMENTS_DIR="$HOME/Documents"
export XDG_TEMPLATES_DIR="$HOME/Templates"
export XDG_PUBLICSHARE_DIR="$HOME/Public"
{{- end }}
### Theme
export COLOR_SCHEME=dark
export GTK_RC_FILES="$XDG_CONFIG_HOME/gtk-1.0/gtkrc"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
{{- if eq .host.distro.family "linux" -}}
### Homebrew
if [ -d /home/linuxbrew/.linuxbrew/bin ]; then
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar"
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew"
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}"
export WHALEBREW_INSTALL_PATH="/home/linuxbrew/.linuxbrew/whalebrew"
fi
{{- end }}
### Android Studio
{{- if eq .host.distro.family "darwin" -}}
if [ -d ~/Library/Android ]; then
export PATH="$PATH:~/Library/Android/sdk/cmdline-tools/latest/bin"
export PATH="$PATH:~/Library/Android/sdk/platform-tools"
export PATH="$PATH:~/Library/Android/sdk/tools/bin"
export PATH="$PATH:~/Library/Android/sdk/tools"
fi
{{- end }}
export ANDROID_SDK_HOME="$XDG_DATA_HOME/android-sdk"
### ASDF
export ASDF_CONFIG_FILE="$XDG_CONFIG_HOME/asdf/asdfrc"
export ASDF_DIR="$XDG_DATA_HOME/asdf"
export ASDF_DATA_DIR="$ASDF_DIR"
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-cargo-pkgs"
export ASDF_GEM_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-ruby-pkgs"
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-golang-pkgs"
export ASDF_NPM_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-npm-packages"
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="$XDG_CONFIG_HOME/asdf/default-python-pkgs"
### AWS CLI
export AWS_SHARED_CREDENTIALS_FILE="$XDG_CONFIG_HOME/aws/credentials"
export AWS_CONFIG_FILE="$XDG_CONFIG_HOME/aws/config"
### Azure CLI
export AZURE_CONFIG_DIR="$HOME/.config/azure"
### bat
export BAT_CONFIG_PATH="$HOME/.config/batrc"
### Cargo
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export PATH="$PATH:$CARGO_HOME/bin"
### Bash
export BASH_COMPLETION_USER_FILE="$XDG_CONFIG_HOME/bash-completion/bash_completion"
### BitWarden
# https://bitwarden.com/help/cli/#using-an-api-key
# BW_CLIENTID client_id
# BW_CLIENTSECRET
### Docker
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export MACHINE_STORAGE_PATH="$XDG_DATA_HOME/docker-machine"
### Elastic Agent
# https://www.elastic.co/guide/en/fleet/current/agent-environment-variables.html#env-common-vars
### ffmpeg
export FFMPEG_DATADIR="$XDG_CONFIG_HOME/ffmpeg"
### fzf
if command -v fd > /dev/null; then
export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
### Git
export GIT_MERGE_AUTOEDIT=no
### gitfuzzy
if command -v delta > /dev/null; then
export GF_BAT_STYLE=changes
export GF_BAT_THEME=zenbur
export GF_SNAPSHOT_DIRECTORY="$XDG_DATA_HOME/git-fuzzy-snapshots"
export GF_PREFERRED_PAGER="delta --theme=gruvbox --highlight-removed -w __WIDTH__"
fi
### Go
export GOPATH="$XDG_DATA_HOME/go"
export GO111MODULE=on
export PATH="$PATH:${GOPATH}/bin"
if command -v go > /dev/null && which go | grep -q 'asdf' > /dev/null && command -v asdf > /dev/null; then
GOROOT="$(asdf where golang)/go"
export GOROOT
export PATH="$PATH:${GOROOT}/bin"
elif command -v go > /dev/null && command -v brew > /dev/null; then
GOROOT="$(brew --prefix go)/libexec"
export GOROOT
export PATH="$PATH:${GOROOT}/bin"
fi
### Gradle
export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle"
### Homebrew
export HOMEBREW_BUNDLE_FILE="$XDG_CONFIG_HOME/Brewfile"
{{- if (and (eq .host.distro.family "darwin") (.host.restricted)) }}
export HOMEBREW_CASK_OPTS="--appdir=~/Applications"
{{- end }}
### HTTPie
export HTTPIE_CONFIG_DIR="$XDG_CONFIG_HOME/httpie"
### IPFS
export IPFS_PATH="$XDG_DATA_HOME/ipfs"
### Java
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java"
### k9s
export K9SCONFIG="$XDG_CONFIG_HOME/k9s"
### KDE
export KDEHOME="$XDG_CONFIG_HOME/kde"
### Kodi
export KODI_DATA="$XDG_DATA_HOME/kodi"
### McFly
export MCFLY_FUZZY=2
export MCFLY_RESULTS=14
export MCFLY_KEY_SCHEME=vim
### minikube
export MINIKUBE_HOME="$XDG_DATA_HOME/minikube"
### MySQL
export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history"
### nnn
if command -v nnn > /dev/null; then
alias n='nnn -de'
alias N='sudo -E nnn -dH'
alias nnn-install-plugins='curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh'
export NNN_RCLONE='rclone mount --read-only --no-checksum'
export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
fi
### Node.js
export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history"
### NPM
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
### Parallels
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
### Pass
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
### Poetry
export POETRY_HOME="$XDG_DATA_HOME/poetry"
export PATH="$POETRY_HOME/bin:$PATH"
### Postgres
export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
export PSQL_HISTORY="$XDG_STATE_HOME/psql_history"
export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"
### Readline
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
### Rear
# https://github.com/rear/rear/blob/master/doc/user-guide/03-configuration.adoc
### Redis
export REDISCLI_HISTFILE="$XDG_DATA_HOME/redis/rediscli_history"
export REDISCLI_RCFILE="$XDG_CONFIG_HOME/redis/redisclirc"
### ripgrep
export RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config"
### Ruby
export GEM_HOME="$XDG_DATA_HOME/gems"
export PATH="$PATH:$GEM_HOME/bin"
### Rustup
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
### SDKMan
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
### Vagrant
export VAGRANT_ALIAS_FILE="$XDG_DATA_HOME/vagrant/aliases"
export VAGRANT_DEFAULT_PROVIDER=virtualbox
export VAGRANT_HOME="$XDG_DATA_HOME/vagrant.d"
### Volta
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### wget
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
### Whalebrew
export WHALEBREW_CONFIG_DIR="$HOME/.config/whalebrew"
### Man pages
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
export LESSHISTFILE=-
export MANPAGER="less -X"
### Line Wrap
setterm -linewrap on 2>/dev/null
### History
export HISTCONTROL=ignoreboth
export HISTSIZE=5000
export HIST_STAMPS=mm/dd/yyyy
export SAVEHIST=5000
### Editor
{{- if not .host.headless }}
if command -v code > /dev/null; then
export EDITOR='code --wait'
else
# Source: https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference
export EDITOR='vi -e'
fi
{{- else -}}
export EDITOR='vi -e'
{{- end -}}
export VISUAL="$EDITOR"
{{- if eq .host.type "wsl" }}
### WSL
export LIBGL_ALWAYS_INDIRECT="1"
export BROWSER='/mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe'
{{- end }}
### PATH
export PATH="$PATH:$HOME/.local/bin"

View file

@ -0,0 +1,118 @@
# Install WebDriverAgent on iOS device
appiumwebdriver() {
# read -r "Enter the UDID of the device you wish to install WebDriverAgent on: " UDID_INPUT
mkdir -p Resources/WebDriverAgent.bundle
bash ./Scripts/bootstrap.sh -d
cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent || return
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=${UDID_INPUT}" test
}
# Change directories and view contents at the same time
cl() {
DIR="$*"
# if no DIR given, go home
if [ $# -lt 1 ]; then
DIR=$HOME
fi
builtin cd "${DIR}" &&
# use your preferred ls command
ls -F --color=auto
}
# Safer cp with progress bar and backup to /tmp
cpv() {
rsync -pogbr -hhh --backup-dir="/tmp/rsync-${USERNAME}" -e /dev/null --progress "$@"
}
# Checks status of a website on downforeveryoneorjustme.com
down4me() {
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
}
# Easier version of find command
find() {
if [ $# = 1 ]; then
# shellcheck disable=SC2145
command find . -iname "*$@*"
else
command find "$@"
fi
}
# Opens current repository in browser
gitopen() {
git remote -v | head -n 1 | awk -F "@" '{print $2}' | awk -F " " '{print $1}' | sed 's/:/\//g' | sed 's/.git//g' | awk '{print "http://"$1}' | xargs open
}
# Open Mac OS X desktop on a Linux machine
macosx() {
docker run -it --device /dev/kvm -p 50922:10022 -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:big-sur
}
# Generate a random string of X length
randomstring() {
if [ -z "$1" ]; then
head /dev/urandom | tr -dc A-Za-z0-9 | head -c "$1"
else
echo "Pass the number of characters you would like the string to be. Example: randomstring 14"
fi
}
# Reset Docker to factory settings
resetdocker() {
set +e
CONTAINER_COUNT="$(docker ps -a -q | wc -l)"
if [ "$CONTAINER_COUNT" -gt 0 ]; then
docker stop "$(docker ps -a -q)"
docker rm "$(docker ps -a -q)"
fi
VOLUME_COUNT="$(docker volume ls -q | wc -l)"
if [ "$VOLUME_COUNT" -gt 0 ]; then
docker volume rm "$(docker volume ls -q)"
fi
NETWORK_COUNT="$(docker network ls -q | wc -l)"
if [ "$NETWORK_COUNT" -gt 0 ]; then
docker network rm "$(docker network ls -q)"
fi
docker system prune -a --force
}
# ripgrep-all
rgafzf() {
RG_PREFIX="rga --files-with-matches"
local file
file="$(
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
--phony -q "$1" \
--bind "change:reload:$RG_PREFIX {q}" \
--preview-window="70%:wrap"
)" &&
echo "opening $file" &&
xdg-open "$file"
}
# Easy file sharing from the command line, using transfer.sh
transfer() {
if [ $# -eq 0 ]; then
echo -e "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>" >&2
return 1
fi
if tty -s; then
file="$1"
file_name=$(basename "$file")
if [ ! -e "$file" ]; then
echo "$file: No such file or directory" >&2
return 1
fi
if [ -d "$file" ]; then
file_name="$file_name.zip"
(cd "$file" && zip -r -q - .) | curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null,
else
curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" <"$file" | tee /dev/null
fi
else
file_name=$1
curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null
fi
}

View file

@ -0,0 +1,25 @@
### MOTD
# Add file named .hushlogin in the user's home directory to disable the MOTD
if [ "$BASH_SUPPORT" = 'true' ] && [ ! -f ~/.hushlogin ] && [ "$SHLVL" -eq 1 ]; then
if [ -f "$HOME/.local/motd.sh" ] && { [ -n "$SSH_CONNECTION" ] && [[ $- == *i* ]]; } || command -v qubes-vmexec > /dev/null || command -v qubes-dom0-update > /dev/null || { [ -d /Applications ] && [ -d /System ]; }; then
if { [ -z "$MOTD" ] || [ "$MOTD" -ne 0 ]; } && [[ "$(hostname)" != *'-minimal' ]]; then
. "$HOME/.local/motd.sh"
# TODO - -- services
if [ -n "$SSH_CONNECTION" ]; then
# SSH
bash_motd --banner --processor --memory --diskspace --docker --updates --letsencrypt --login
elif command -v qubes-vmexec > /dev/null; then
# Qubes AppVM
bash_motd --banner --memory --diskspace --docker --updates
elif command -v qubes-dom0-update > /dev/null; then
# Qubes dom0
bash_motd --banner --updates
elif [ -d /Applications ] && [ -d /System ]; then
# macOS
bash_motd --banner
else
bash_motd --banner --processor --memory --diskspace --docker --updates --letsencrypt --login
fi
fi
fi
fi

View file

@ -1,2 +1,3 @@
init.license=MIT
init.version=0.0.1
store-dir=${XDG_DATA_HOME}/pnpm-store

View file

@ -1,25 +1,5 @@
# shellcheck disable=SC1090,SC1091
### Miscellaneous
export VISUAL=vim
export EDITOR=$VISUAL
### Theme
export COLOR_SCHEME=dark
### Colorize man pages
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
export LESSHISTFILE=-
### Line Wrap
setterm -linewrap on 2>/dev/null
# Aliases / Functions
if [ -f "$HOME/.local/aliases" ]; then
. "$HOME/.local/aliases"
@ -29,7 +9,7 @@ if [ -f "$HOME/.local/functions" ]; then
fi
### Bash / ZSH
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ] || [ "$0" = 'zsh' ] || [ "$0" = '/bin/zsh' ]; then
if [ "$BASH_SUPPORT" = 'true' ]; then
### OS Detection
if [ -f /etc/os-release ]; then
. /etc/os-release
@ -90,42 +70,9 @@ if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ] || [ "$0" = 'zsh' ] || [ "$0" = '
fi
### ASDF
if [ -f "$HOME/.local/asdf/asdf.sh" ]; then
export ASDF_CONFIG_FILE="$HOME/.config/asdf/asdfrc"
export ASDF_DIR="$HOME/.local/asdf"
export ASDF_DATA_DIR="$HOME/.local/asdf-data"
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="$HOME/.config/asdf/default-cargo-pkgs
export ASDF_GEM_DEFAULT_PACKAGES_FILE="$HOME/.config/asdf/default-ruby-pkgs
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="$HOME/.config/asdf/default-golang-pkgs
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="$HOME/.config/asdf/default-python-pkgs
if [ -f "$ASDF_DIR/asdf.sh" ]; then
. "$HOME/.local/asdf/asdf.sh"
fi
### MOTD
# Add file named .hushlogin in the user's home directory to disable the MOTD
if [ ! -f ~/.hushlogin ] && [ "$SHLVL" -eq 1 ]; then
if [ -f "$HOME/.local/motd.sh" ] && { [ -n "$SSH_CONNECTION" ] && [[ $- == *i* ]]; } || command -v qubes-vmexec > /dev/null || command -v qubes-dom0-update > /dev/null || { [ -d /Applications ] && [ -d /System ]; }; then
if { [ -z "$MOTD" ] || [ "$MOTD" -ne 0 ]; } && [[ "$(hostname)" != *'-minimal' ]]; then
. "$HOME/.local/motd.sh"
# TODO - -- services
if [ -n "$SSH_CONNECTION" ]; then
# SSH
bash_motd --banner --processor --memory --diskspace --docker --updates --letsencrypt --login
elif command -v qubes-vmexec > /dev/null; then
# Qubes AppVM
bash_motd --banner --memory --diskspace --docker --updates
elif command -v qubes-dom0-update > /dev/null; then
# Qubes dom0
bash_motd --banner --updates
elif [ -d /Applications ] && [ -d /System ]; then
# macOS
bash_motd --banner
else
bash_motd --banner --processor --memory --diskspace --docker --updates --letsencrypt --login
fi
fi
fi
fi
fi
### Colorize
@ -154,167 +101,16 @@ command -v bashtop > /dev/null && alias top='bashtop'
command -v bpytop > /dev/null && alias top='bpytop'
command -v glances > /dev/null && alias top='glances'
# vim as default
export EDITOR="vim"
# Dont clear the screen after quitting a manual page
export MANPAGER="less -X"
### .local/bin
export PATH="$PATH:$HOME/.local/bin"
### Cargo
if [ -f "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
### GTK
export XDG_CONFIG_HOME="$HOME/.config"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
### Homebrew
if [ -d /home/linuxbrew/.linuxbrew/bin ]; then
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar"
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew"
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}"
export WHALEBREW_INSTALL_PATH="/home/linuxbrew/.linuxbrew/whalebrew"
fi
### Whalebrew
export WHALEBREW_CONFIG_DIR="$HOME/.config/whalebrew"
### Go
export GOPATH="${HOME}/.local/go"
export GO111MODULE=on
export PATH="$PATH:${GOPATH}/bin"
if command -v go > /dev/null && which go | grep -q 'asdf' > /dev/null && command -v asdf > /dev/null; then
GOROOT="$(asdf where golang)/go"
export GOROOT
export PATH="$PATH:${GOROOT}/bin"
elif command -v go > /dev/null && command -v brew > /dev/null; then
GOROOT="$(brew --prefix go)/libexec"
export GOROOT
export PATH="$PATH:${GOROOT}/bin"
fi
### Android Studio
if [ -d ~/Library/Android ]; then
export PATH="$PATH:~/Library/Android/sdk/cmdline-tools/latest/bin"
export PATH="$PATH:~/Library/Android/sdk/platform-tools"
export PATH="$PATH:~/Library/Android/sdk/tools/bin"
export PATH="$PATH:~/Library/Android/sdk/tools"
fi
export ANDROID_SDK_HOME="$HOME/.local/android-sdk"
### Azure CLI
export AZURE_CONFIG_DIR="$HOME/.config/azure"
### bat
export BAT_CONFIG_PATH="$HOME/.config/batrc"
if command -v bat > /dev/null; then
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
alias bathelp='bat --plain --language=help'
alias cat='bat -pp'
alias less='bat --paging=always'
help() {
"$@" --help 2>&1 | bathelp
}
fi
### BitWarden
# https://bitwarden.com/help/cli/#using-an-api-key
# BW_CLIENTID client_id
# BW_CLIENTSECRET
### curlie
if command -v curlie > /dev/null; then
alias curl='curlie'
fi
### Elastic Agent
# https://www.elastic.co/guide/en/fleet/current/agent-environment-variables.html#env-common-vars
### exa
if command -v exa > /dev/null; then
alias ls='exa --long --all --color auto --icons --sort=type'
alias tree='exa --tree'
alias la='ls -la'
alias lt='ls --tree --level=2'
fi
### fzf
if command -v fd > /dev/null; then
export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
### Git
export GIT_MERGE_AUTOEDIT=no
### gitfuzzy
export GF_BAT_STYLE=changes
export GF_BAT_THEME=zenbur
export GF_SNAPSHOT_DIRECTORY="$HOME/.local/git-fuzzy-snapshots"
if command -v delta > /dev/null; then
export GF_PREFERRED_PAGER="delta --theme=gruvbox --highlight-removed -w __WIDTH__"
fi
### gping
# Replacement for ping that includes graph
if command -v gping > /dev/null; then
alias ping='gping'
fi
### McFly
export MCFLY_FUZZY=2
export MCFLY_RESULTS=14
export MCFLY_KEY_SCHEME=vim
### nnn
if command -v nnn > /dev/null; then
alias n='nnn -de'
alias N='sudo -E nnn -dH'
alias nnn-install-plugins='curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh'
export NNN_RCLONE='rclone mount --read-only --no-checksum'
export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
fi
### Poetry
export POETRY_HOME="$HOME/.local/poetry"
export PATH="$POETRY_HOME/bin:$PATH"
### Rear
# https://github.com/rear/rear/blob/master/doc/user-guide/03-configuration.adoc
### ripgrep
export RIPGREP_CONFIG_PATH="$HOME/.config/ripgreprc"
if command -v rg &> /dev/null; then
alias grep='rg'
fi
### Ruby
export GEM_HOME="$HOME/.local/gems"
export PATH="$PATH:$GEM_HOME/bin"
### Volta
export VOLTA_HOME="$HOME/.local/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### SDKMan
if command -v brew > /dev/null && command -v sdkman-cli > /dev/null; then
export SDKMAN_DIR="$(brew --prefix sdkman-cli)/libexec"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
elif [ -f "$SDKMAN_DIR/bin/sdkman-init.sh" ]; then
export SDKMAN_DIR="$HOME/.local/sdkman"
export SDKMAN_DIR="$XDG_DATA_HOME/sdkman"
. "$SDKMAN_DIR/bin/sdkman-init.sh"
fi
### Vagrant
export VAGRANT_DEFAULT_PROVIDER=virtualbox
export VAGRANT_HOME="$HOME/.local/vagrant.d"
### wget
export WGETRC="$HOME/.config/wgetrc"

View file

@ -4,15 +4,15 @@
export LANG="en_US"
export LC_ALL="en_US.UTF-8"
### Advanced Bash-features are supported
export BASH_SUPPORT=true
### Misc.
HISTFILE=~/.local/zsh_history
HIST_STAMPS=mm/dd/yyyy
HISTSIZE=5000
SAVEHIST=5000
ZLE_RPROMPT_INDENT=0
WORDCHARS=${WORDCHARS//\/}
PROMPT_EOL_MARK=
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
export HISTFILE=~/.local/zsh_history
export ZLE_RPROMPT_INDENT=0
export WORDCHARS=${WORDCHARS//\/}
export PROMPT_EOL_MARK=
export TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
### Antigen
export ADOTDIR="$HOME/.local/antigen"
@ -67,9 +67,6 @@ zstyle ':completion:*' verbose true
# shellcheck disable=SC2016
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
### For Debugging (clears completion cache each time)
zstyle ":completion:*:commands" rehash 1
# Key bindings
bindkey -e
bindkey '^U' backward-kill-line
@ -245,10 +242,10 @@ xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
esac
# https://github.com/trapd00r/LS_COLORS
#command -v gdircolors >/dev/null 2>&1 || alias gdircolors="dircolors"
#if type gdircolors &> /dev/null && [ -f "$HOME/.config/dircolors" ]; then
# eval "$(gdircolors -b "$HOME/.config/dircolors")"
#fi
command -v gdircolors >/dev/null 2>&1 || alias gdircolors="dircolors"
if type gdircolors &> /dev/null && [ -f "$HOME/.config/dircolors" ]; then
eval "$(gdircolors -b "$HOME/.config/dircolors")"
fi
### Antigen
if [ -f "$HOME/.local/antigen.zsh" ]; then
@ -321,10 +318,6 @@ if command -v zoxide > /dev/null; then
zstyle ':autocomplete:recent-dirs' backend zoxide
fi
# oh-my-zsh might be overwriting the ls command so placing it here as well as fix
# command -v lsd > /dev/null && alias ls='lsd --group-dirs first' && \
# alias tree='lsd --tree'
### direnv
if command -v direnv > /dev/null; then
eval "$(direnv hook zsh)"