Update dotfiles/.config/bashtop/bashtop.cfg, dotfiles/.config/inkscape/palettes/flat-remix-palette.gpl, dotfiles/.config/qt5ct/qt5ct.conf, dotfiles/.config/tilix/schemes/Flat-Remix.json, dotfiles/.local/share/qt5ct/colors/flat-remix-dark.conf, dotfiles/.local/share/qt5ct/colors/flat-remix-light.conf, dotfiles/.local/share/qt5ct/qss/fusion-simple-scrollbar.qss, dotfiles/.bashrc, .gitattributes, dotfiles/.gitconfig, dotfiles/.zshrc, dotfiles/.local/p10k.zsh, dotfiles/.local/antigen.zsh, dotfiles/.local/fzf.zsh, dotfiles/.profile

This commit is contained in:
Brian Zalewski 2022-08-30 01:45:16 +00:00
parent 2ccfd01e67
commit afa3ed3a0a
15 changed files with 4837 additions and 1 deletions

4
.gitattributes vendored Normal file
View file

@ -0,0 +1,4 @@
*.gif diff=image
*.jpg diff=image
*.png diff=image
*.svg diff=image

View file

@ -0,0 +1,186 @@
### Fig
[[ -f "$HOME/.fig/shell/bashrc.pre.bash" ]] && . "$HOME/.fig/shell/bashrc.pre.bash"
### ~/.profile
[[ -f "$HOME/.profile" ]] && . "$HOME/.profile"
COLOR_SCHEME=dark # dark/light
alias ..='cd ..'
alias cp='cp -v'
alias rm='rm -I'
alias mv='mv -iv'
alias ln='ln -sriv'
alias xclip='xclip -selection c'
command -v vim > /dev/null && alias vi='vim'
### Colorize commands
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
alias pacman='pacman --color=auto'
### LS & TREE
alias ll='ls -la'
alias la='ls -A'
alias l='ls -F'
command -v lsd > /dev/null && alias ls='lsd --group-dirs first' && \
alias tree='lsd --tree'
command -v colorls > /dev/null && alias ls='colorls --sd --gs' && \
alias tree='colorls --tree'
### CAT & LESS
command -v bat > /dev/null && \
alias bat='bat --theme=ansi' && \
alias cat='bat --pager=never' && \
alias less='bat'
# in debian the command is batcat
command -v batcat > /dev/null && \
alias batcat='batcat --theme=ansi' && \
alias cat='batcat --pager=never' && \
alias less='batcat'
### TOP
command -v htop > /dev/null && alias top='htop'
command -v gotop > /dev/null && alias top='gotop -p $([ "$COLOR_SCHEME" = "light" ] && echo "-c default-dark")'
command -v ytop > /dev/null && alias top='ytop -p $([ "$COLOR_SCHEME" = "light" ] && echo "-c default-dark")'
command -v btm > /dev/null && alias top='btm $([ "$COLOR_SCHEME" = "light" ] && echo "--color default-light")'
# themes for light/dark color-schemes inside ~/.config/bashtop; Press ESC to open the menu and change the theme
command -v bashtop > /dev/null && alias top='bashtop'
command -v bpytop > /dev/null && alias top='bpytop'
### Settings
shopt -s globstar
shopt -s histappend
shopt -s checkwinsize
HISTCONTROL=ignoreboth
HISTSIZE=5000
HISTFILESIZE=5000
HISTFILE=~/.bash_history
# Bash Completion
if [ -f /usr/share/bash-completion/bash_completion ]
then
source /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]
then
source /etc/bash_completion
fi
# Add new line before prompt
PROMPT_COMMAND="PROMPT_COMMAND=echo"
# Prompt
PS1='\[\033[;32m\]┌──(\[\033[1;34m\]\u@\h\[\033[;32m\])-[\[\033[0;1m\]\w\[\033[;32m\]]\n\[\033[;32m\]└─\[\033[1;34m\]\$\[\033[0m\] '
### Miscellaneous
export VISUAL=vim
export EDITOR=$VISUAL
# enable terminal linewrap
setterm -linewrap on 2> /dev/null
# 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=-
# colorize ls
[ -x /usr/bin/dircolors ] && eval "$(dircolors -b)"
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
;;
esac
### Functions
glog() {
setterm -linewrap off 2> /dev/null
git --no-pager log --all --color=always --graph --abbrev-commit --decorate --date-order \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' "$@" \
| sed -E \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+ /├\1─╮\2/' \
-e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m /\1├─╯\x1b\[m/' \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+/├\1╮\2/' \
-e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m/\1├╯\x1b\[m/' \
-e 's/╮(\x1b\[[0-9;]*m)+\\/╮\1╰╮/' \
-e 's/╯(\x1b\[[0-9;]*m)+\//╯\1╭╯/' \
-e 's/(\||\\)\x1b\[m (\x1b\[[0-9;]*m)/╰╮\2/' \
-e 's/(\x1b\[[0-9;]*m)\\/\1╮/g' \
-e 's/(\x1b\[[0-9;]*m)\//\1╯/g' \
-e 's/^\*|(\x1b\[m )\*/\1⎬/g' \
-e 's/(\x1b\[[0-9;]*m)\|/\1│/g' \
| command less -r $([ $# -eq 0 ] && echo "+/[^/]HEAD")
setterm -linewrap on 2> /dev/null
}
find() {
if [ $# = 1 ]
then
command find . -iname "*$@*"
else
command find "$@"
fi
}
rga-fzf() {
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"
}
### fd
[ -e /usr/local/src/fd/fd ] && source /usr/local/src/fd/autocomplete/fd.bash-completion
### Hyperfine
[ -e /usr/local/src/hyperfine/hyperfine ] && source /usr/local/src/hyperfine/autocomplete/hyperfine.bash-completion
### mcfly
export MCFLY_KEY_SCHEME=vim
[ -e /usr/local/src/mcfly/mcfly ] && eval "$(mcfly init bash)"
### wp-cli
[ -e /usr/local/bin/wp ] && source /usr/local/src/wp-cli/wp-completion.bash
### direnv
[ -e /usr/local/bin/direnv ] && eval "$(direnv hook bash)"
### Googler
[ -e /usr/local/bin/googler ] && source /usr/local/src/googler/googler-completion.bash
[ -e /usr/local/bin/googler ] && source /usr/local/src/googler/googler_at
### FZF
[ -f ~/.local/fzf.bash ] && source ~/.local/fzf.bash
### Google Cloud SDK
if type brew &> /dev/null; then
[[ ! -f "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc" ]] || source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
[[ ! -f "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" ]] || source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"
fi
### zoxide
type zoxide &> /dev/null && eval "$(zoxide init bash)"
### Fig
[[ -f "$HOME/.fig/shell/bashrc.post.bash" ]] && . "$HOME/.fig/shell/bashrc.post.bash"

View file

@ -0,0 +1 @@
color_theme="flat-remix"

View file

@ -0,0 +1,143 @@
GIMP Palette
Name: flat-remix-palette
#
255 255 255 #FFFFFF
230 230 230 #E6E6E6
204 204 204 #CCCCCC
179 179 179 #B3B3B3
153 153 153 #999999
128 128 128 #808080
102 102 102 #666666
76 76 76 #4C4C4C
51 51 51 #333333
25 25 25 #191919
0 0 0 #000000
115 118 128 #737680
96 99 110 #60636E
76 79 92 #4C4F5C
56 60 74 #383C4A
51 54 67 #333643
45 48 59 #2D303B
39 42 52 #272A34
189 151 119 #BD9777
180 137 100 #B48964
170 122 80 #AA7A50
161 107 61 #A16B3D
145 97 55 #916137
129 86 49 #815631
113 75 43 #714B2B
149 129 113 #958171
134 112 93 #86705D
119 94 73 #775E49
104 76 53 #684C35
94 69 48 #5E4530
83 61 42 #533D2A
73 53 37 #493525
174 122 196 #AE7AC4
163 104 188 #A368BC
151 85 179 #9755B3
140 66 171 #8C42AB
126 60 154 #7E3C9A
112 53 137 #703589
98 46 120 #622E78
205 92 129 #CD5C81
198 69 112 #C64570
191 46 94 #BF2E5E
184 23 76 #B8174C
166 21 69 #A61545
147 18 61 #93123D
129 16 53 #811035
225 94 94 #E15E5E
221 71 71 #DD4747
216 48 48 #D83030
212 25 25 #D41919
191 23 23 #BF1717
170 20 20 #AA1414
149 18 18 #951212
254 113 113 #FE7171
253 93 93 #FD5D5D
253 73 73 #FD4949
253 53 53 #FD3535
228 48 48 #E43030
202 42 42 #CA2A2A
178 37 37 #B22525
254 164 76 #FEA44C
253 151 51 #FD9733
253 138 25 #FD8A19
253 125 0 #FD7D00
255 216 110 #FFD86E
255 210 89 #FFD259
255 204 68 #FFCC44
255 199 48 #FFC730
250 232 149 #FAE895
249 229 134 #F9E586
249 225 119 #F9E177
248 222 104 #F8DE68
84 189 142 #54BD8E
61 180 126 #3DB47E
36 170 110 #24AA6E
12 161 94 #0CA15E
11 145 85 #0B9155
10 129 75 #0A814B
8 113 66 #087142
94 189 171 #5EBDAB
71 180 159 #47B49F
48 170 147 #30AA93
25 161 135 #19A187
23 145 122 #17917A
20 129 108 #14816C
18 113 95 #12715F
101 207 212 #65CFD4
79 200 206 #4FC8CE
57 193 200 #39C1C8
35 186 194 #23BAC2
32 168 175 #20A8AF
28 149 155 #1C959B
25 131 136 #198388
128 198 237 #80C6ED
110 190 235 #6EBEEB
92 182 232 #5CB6E8
74 174 230 #4AAEE6
67 157 207 #439DCF
59 139 184 #3B8BB8
52 122 161 #347AA1
114 162 244 #72A2F4
94 149 243 #5E95F3
74 136 241 #4A88F1
54 123 240 #367BF0
49 111 216 #316FD8
43 98 192 #2B62C0
38 86 168 #2656A8
103 139 200 #678BC8
81 123 193 #517BC1
59 106 185 #3B6AB9
38 90 177 #265AB1
34 81 160 #2251A0
30 72 142 #1E488E
27 63 124 #1B3F7C
91 115 157 #5B739D
68 96 143 #44608F
44 76 129 #2C4C81
21 56 115 #153873
19 51 104 #133368
17 45 92 #112D5C
15 39 81 #0F2751

View file

@ -0,0 +1,13 @@
[Appearance]
custom_palette=true
icon_theme=Flat-Remix-Blue-Dark
color_scheme_path=/usr/share/qt5ct/colors/flat-remix-light.conf
standard_dialogs=default
style=Fusion
[Interface]
stylesheets=/usr/share/qt5ct/qss/fusion-simple-scrollbar.qss
[Fonts]
fixed=@Variant(\0\0\0@\0\0\0\x12\0\x46\0i\0r\0\x61\0 \0\x43\0o\0\x64\0\x65@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x39\x10)
general=@Variant(\0\0\0@\0\0\0\x12\0\x43\0\x61\0n\0t\0\x61\0r\0\x65\0l\0l@&\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)

View file

@ -0,0 +1,35 @@
{
"background-color": "#272A34",
"badge-color": "#AC7EA8",
"bold-color": "#FFFFFF",
"comment": "",
"cursor-background-color": "#000000",
"cursor-foreground-color": "#FFFFFF",
"foreground-color": "#FFFFFF",
"highlight-background-color": "#000000",
"highlight-foreground-color": "#FFFFFF",
"name": "Flat-Remix",
"palette": [
"#1F2229",
"#D41919",
"#5EBDAB",
"#FEA44C",
"#367bf0",
"#9755b3",
"#49AEE6",
"#E6E6E6",
"#198388",
"#EC0101",
"#47D4B9",
"#FF8A18",
"#277FFF",
"#962ac3",
"#05A1F7",
"#FFFFFF"
],
"use-badge-color": false,
"use-bold-color": false,
"use-cursor-color": false,
"use-highlight-color": false,
"use-theme-colors": true
}

View file

@ -0,0 +1,19 @@
[user]
email =
name =
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[credential]
helper = cache --timeout=3600
[pull]
rebase = true
[core]
attributesfile = ~/.gitattributes
[diff "image"]
command = compare $2 $1 png:- | montage -geometry +4+4 $2 - $1 png:- | display -title \"$1\" -

2057
dotfiles/.local/antigen.zsh Normal file

File diff suppressed because it is too large Load diff

13
dotfiles/.local/fzf.zsh Normal file
View file

@ -0,0 +1,13 @@
# Setup fzf
# ---------
if [[ ! "$PATH" == */usr/local/opt/fzf/bin* ]]; then
export PATH="${PATH:+${PATH}:}/usr/local/opt/fzf/bin"
fi
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/usr/local/opt/fzf/shell/completion.zsh" 2> /dev/null
# Key bindings
# ------------
source "/usr/local/opt/fzf/shell/key-bindings.zsh"

1645
dotfiles/.local/p10k.zsh Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
[ColorScheme]
active_colors=#ffffffff, #ff1c2029, #ff3c4150, #ff21242d, #ff050609, #ff15171e, #ffffffff, #ffffffff, #ffffffff, #ff272a34, #ff23252e, #ffe7e4e0, #ff2777ff, #fff9f9f9, #ff2777ff, #ff2777ff, #ff21242d, #ffffffff, #ff23252e, #ffffffff, #80ffffff
disabled_colors=#ff808080, #ff1c2029, #ff3c4150, #ff21242d, #ff050609, #ff15171e, #ff808080, #ffffffff, #ff808080, #ff272a34, #ff23252e, #ffe7e4e0, #ff2777ff, #ff808080, #ff2777ff, #ff2777ff, #ff21242d, #ffffffff, #ff23252e, #ffffffff, #80ffffff
inactive_colors=#ffffffff, #ff1c2029, #ff3c4150, #ff21242d, #ff050609, #ff15171e, #ffffffff, #ffffffff, #ffffffff, #ff272a34, #ff23252e, #ffe7e4e0, #ff2777ff, #fff9f9f9, #ff2777ff, #ff2777ff, #ff21242d, #ffffffff, #ff23252e, #ffffffff, #80ffffff

View file

@ -0,0 +1,4 @@
[ColorScheme]
active_colors=#ff000000, #ffffffff, #ffffffff, #ffffffff, #ffffffff, #ffffffff, #ff000000, #ff0a0a0a, #ff0a0a0a, #fffafafa, #ffffffff, #ffe7e4e0, #ff2777ff, #ffffffff, #ff2777ff, #ff2777ff, #fffafafa, #ffffffff, #ffffffff, #ff050505, #80000000
disabled_colors=#ff808080, #ffffffff, #ffffffff, #ffffffff, #ffffffff, #ffffffff, #ff808080, #ff0a0a0a, #ff808080, #fffafafa, #ffffffff, #ffe7e4e0, #ff2777ff, #ff808080, #ff2777ff, #ff2777ff, #fffafafa, #ffffffff, #ffffffff, #ff050505, #80000000
inactive_colors=#ff000000, #ffffffff, #ffffffff, #ffffffff, #ffffffff, #ffffffff, #ff000000, #ff0a0a0a, #ff0a0a0a, #fffafafa, #ffffffff, #ffe7e4e0, #ff2777ff, #ffffffff, #ff2777ff, #ff2777ff, #fffafafa, #ffffffff, #ffffffff, #ff050505, #80000000

View file

@ -0,0 +1,29 @@
QScrollBar { background: transparent; }
QScrollBar:vertical { max-width: 8px; }
QScrollBar:horizontal { max-height: 8px; }
QScrollBar::handle {
padding: 0;
margin: 2px;
border-radius: 2px;
border: 0;
background: rgba(127, 127, 127, .5);
min-height: 20px;
min-width: 20px;
}
QScrollBar::handle:hover { background: rgba(127, 127, 127, 1); }
QScrollBar::handle:pressed { background: palette(highlight); }
QScrollBar::add-line , QScrollBar::sub-line {
height: 0;
border: 0;
}
QScrollBar::up-arrow, QScrollBar::down-arrow {
border: 0;
width: 0;
height: 0;
}
QScrollBar::add-page, QScrollBar::sub-page { background: none; }

View file

@ -1,7 +1,309 @@
# Add items to PATH # 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
cat "$file"|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;
fi;
else
file_name=$1;
curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;
fi;
}
# Install WebDriverAgent on iOS device
appiumwebdriver() {
read -p "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
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
}
# Open bash with local Docker file
dockerssh() {
if [ -z "$1" ]; then
echo "Supply a Docker container name in order for this command to work."
echo "Usage: dockerssh <container_name>"
else
docker exec -it $1 /bin/bash
fi
}
# Checks status of a website on downforeveryoneorjustme.com
down4me() {
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g';
}
# GAM - a command-line tool for Google Workspace. This alias will run gam or install gam if it is not already installed.
gam() {
if type gam &> /dev/null; then
gam "$@"
else
bash <(curl -s -S -L https://git.io/install-gam)
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
}
# Used to provision machines using Ansible
provision () {
if [ -z "$1" ]; then
# Display usage if no parameters are given
echo "Usage: provision <ansible_inventory_name>"
echo "If an inventory name of 'test' is provided then the inventory should exist in inventories/test.yml"
return 1
else
cd ~/Playbooks
ansible-galaxy install -r requirements.yml
if [ -z "$2" ]; then
ansible-playbook --ask-vault-pass -i inventories/"$1".yml main.yml
else
ansible-playbook --ask-vault-pass -i inventories/"$1".yml "$2".yml
fi
fi
}
# Generate a random string of X length
randomstring() {
if [ -z "$1" ]; then
head /dev/urandom | tr -dc A-Za-z0-9 | head -c $1 ; echo ''
else
echo "Pass the number of characters you would like the string to be. Example: randomstring 14"
fi
}
# Launch rclone admin GUI
rclone-gui() {
rclone rcd --rc-web-gui --rc-user=admin --rc-pass=pass --rc-serve
}
# 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
}
# Source: https://itnext.io/bash-aliases-are-awesome-8a76aecc96ab
# Type ".. 5" to cd .. 5 times
..() {
N=$(($1))
if [ $N -lt 1 ]; then
N=1
fi
while ((N)); do
cd ..
let N-=1
done;
}
### Aliases
# 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*'
# Removes all Ansible roles saved in ~/.ansible
alias clearroles='rm -rf ~/.ansible/roles/*'
alias connections='nm-connection-editor'
# Make copy command verbose
alias cp='cp -v'
# Copies with a progress bar
alias cpv='rsync -ah --info=progress2'
# Reload docker-compose.yml
alias docker-reboot='docker-compose stop && docker-compose up -d'
# 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'
# 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'"
# 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'
# 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'
# Alias for sudo vim
alias svim='sudo vim'
# 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"
### .local/bin
export PATH="$PATH:$HOME/.local/bin" export PATH="$PATH:$HOME/.local/bin"
### Cargo
. "$HOME/.cargo/env"
if type brew &> /dev/null; then
### Go
export GOPATH="${HOME}/.local/go"
export GOROOT="$(brew --prefix golang)/libexec"
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
### ASDF
. $(brew --prefix asdf)/libexec/asdf.sh
fi
### Android Studio
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"
### gitfuzzy
export PATH="/usr/local/src/gitfuzzy/bin:$PATH"
### Poetry
export PATH="$HOME/.poetry/bin:$PATH"
### Volta
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### SDKMan
export SDKMAN_DIR="$HOME/.local/sdkman"
[[ -s "$HOME/.local/sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.local/sdkman/bin/sdkman-init.sh"
# Running this will update GPG to point to the current YubiKey # Running this will update GPG to point to the current YubiKey
alias yubikey-gpg-stub='gpg-connect-agent "scd serialno" "learn --force" /bye' alias yubikey-gpg-stub='gpg-connect-agent "scd serialno" "learn --force" /bye'
### Vagrant
export VAGRANT_HOME="$HOME/.local/vagrant.d" export VAGRANT_HOME="$HOME/.local/vagrant.d"

View file

@ -0,0 +1,381 @@
### Powerline
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
### Fig
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && . "$HOME/.fig/shell/zshrc.pre.zsh"
### ~/.profile
[[ -f "$HOME/.profile" ]] && . "$HOME/.profile"
# Configure color-scheme
COLOR_SCHEME=dark # dark/light
### Aliases
alias cp='cp -v'
alias rm='rm -I'
alias mv='mv -iv'
alias ln='ln -sriv'
alias xclip='xclip -selection c'
command -v vim > /dev/null && alias vi='vim'
### Colorize
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
alias pacman='pacman --color=auto'
### LS & TREE
alias ll='ls -la'
alias la='ls -A'
alias l='ls -F'
command -v lsd > /dev/null && alias ls='lsd --group-dirs first' && \
alias tree='lsd --tree'
command -v colorls > /dev/null && alias ls='colorls --sd --gs' && \
alias tree='colorls --tree'
### CAT & LESS
command -v bat > /dev/null && \
alias bat='bat --theme=ansi' && \
alias cat='bat --pager=never' && \
alias less='bat'
# in debian the command is batcat
command -v batcat > /dev/null && \
alias batcat='batcat --theme=ansi' && \
alias cat='batcat --pager=never' && \
alias less='batcat'
### TOP
command -v htop > /dev/null && alias top='htop'
command -v gotop > /dev/null && alias top='gotop -p $([ "$COLOR_SCHEME" = "light" ] && echo "-c default-dark")'
command -v ytop > /dev/null && alias top='ytop -p $([ "$COLOR_SCHEME" = "light" ] && echo "-c default-dark")'
command -v btm > /dev/null && alias top='btm $([ "$COLOR_SCHEME" = "light" ] && echo "--color default-light")'
# themes for light/dark color-schemes inside ~/.config/bashtop; Press ESC to open the menu and change the theme
command -v bashtop > /dev/null && alias top='bashtop'
command -v bpytop > /dev/null && alias top='bpytop'
# --------------------------------- SETTINGS ----------------------------------
setopt AUTO_CD
setopt BEEP
#setopt CORRECT
setopt HIST_BEEP
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_SAVE_NO_DUPS
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt INTERACTIVE_COMMENTS
setopt MAGIC_EQUAL_SUBST
setopt NO_NO_MATCH
setopt NOTIFY
setopt NUMERIC_GLOB_SORT
setopt PROMPT_SUBST
setopt SHARE_HISTORY
HISTFILE=~/.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'
# ZSH completion system
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' rehash true
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Key bindings
bindkey -e
bindkey '^U' backward-kill-line
bindkey '^[[2~' overwrite-mode
bindkey '^[[3~' delete-char
bindkey '^[[H' beginning-of-line
bindkey '^[[1~' beginning-of-line
bindkey '^[[F' end-of-line
bindkey '^[[4~' end-of-line
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
bindkey '^[[3;5~' kill-word
bindkey '^[[5~' beginning-of-buffer-or-history
bindkey '^[[6~' end-of-buffer-or-history
bindkey '^[[Z' undo
bindkey ' ' magic-space
# Prompt
PROMPT=$'%F{%(#.blue.green)}┌──(%B%F{%(#.red.blue)}%n@%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
RPROMPT=$'%(?.. %? %F{red}%Bx%b%F{reset})%(1j. %j %F{yellow}%Bbg %b%F{reset}.)'
# ----------------------------------- MISC -----------------------------------
export VISUAL=vim
export EDITOR=$VISUAL
# enable terminal linewrap
setterm -linewrap on 2> /dev/null
# 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=-
# colorize ls
[ -x /usr/bin/dircolors ] && eval "$(dircolors -b)"
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
precmd() { print -Pnr -- $'\e]0;%n@%m: %~\a' }
;;
esac
# ------------------------------- ZSH PLUGINS ---------------------------------
# Plugin source helper
_source_plugin() {
local plugin_name="$1"
for basedir in /usr/share/zsh/plugins /usr/share
do
plugin="$basedir/$plugin_name/$plugin_name.zsh"
[ -f "$plugin" ] && source "$plugin" && return 0
done
echo "\033[33m[ ! ]\033[0m ZSH ${plugin_name#zsh-} not installed"
return 1
}
# ZSH Autosuggestions
_source_plugin zsh-autosuggestions && ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
# ZSH Syntax Highlighting
if _source_plugin zsh-syntax-highlighting
then
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
fi
unset -f _source_plugin
# POWERLEVEL
if ! [[ $(tty) = /dev/tty* ]]
then
if source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme 2> /dev/null
then
s=' ' # fix too wide icons
POWERLEVEL9K_MODE=nerdfont-complete
POWERLEVEL9K_SHORTEN_STRATEGY=truncate_beginning
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='${P9K_CONTENT} $(whoami | grep -v "^root\$")'
POWERLEVEL9K_OS_ICON_BACKGROUND=red
POWERLEVEL9K_OS_ICON_FOREGROUND=white
POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND=black
POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND=red
POWERLEVEL9K_SSH_BACKGROUND=white
POWERLEVEL9K_SSH_FOREGROUND=blue
POWERLEVEL9K_FOLDER_ICON=
POWERLEVEL9K_DIR_BACKGROUND=blue
POWERLEVEL9K_DIR_FOREGROUND=black
POWERLEVEL9K_DIR_WRITABLE_BACKGROUND=black
POWERLEVEL9K_DIR_WRITABLE_FOREGROUND=red
POWERLEVEL9K_VCS_CLEAN_FOREGROUND=black
POWERLEVEL9K_VCS_CLEAN_BACKGROUND=green
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=black
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=yellow
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=white
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=black
POWERLEVEL9K_VCS_UNTRACKED_ICON=
POWERLEVEL9K_VCS_UNSTAGED_ICON=±
POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=
POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=
POWERLEVEL9K_VCS_COMMIT_ICON=$s
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=true
POWERLEVEL9K_EXECUTION_TIME_ICON=$s
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=black
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=blue
POWERLEVEL9K_COMMAND_BACKGROUND_JOBS_BACKGROUND=black
POWERLEVEL9K_COMMAND_BACKGROUND_JOBS_FOREGROUND=cyan
POWERLEVEL9K_TIME_ICON=
POWERLEVEL9K_TIME_FORMAT='%D{%I:%M}'
POWERLEVEL9K_TIME_BACKGROUND=black
POWERLEVEL9K_TIME_FOREGROUND=white
POWERLEVEL9K_RAM_ICON=
POWERLEVEL9K_RAM_FOREGROUND=black
POWERLEVEL9K_RAM_BACKGROUND=yellow
POWERLEVEL9K_VI_MODE_FOREGROUND=black
POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=green
POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL
POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=blue
POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE
POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=red
POWERLEVEL9K_VI_INSERT_MODE_STRING=
POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2'
POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0'
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='%F{blue}╭─'
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX='%F{blue}╰%f '
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon root_indicator ssh dir dir_writable vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(vi_mode status command_execution_time background_jobs time ram)
unset s
else
echo '\033[33m[ ! ]\033[0m ZSH powerlevel10k not installed'
fi
else
clear
echo
echo
fi
switch_powerlevel_multiline_prompt(){
[ $POWERLEVEL9K_PROMPT_ON_NEWLINE = true ] \
&& POWERLEVEL9K_PROMPT_ON_NEWLINE=false \
|| POWERLEVEL9K_PROMPT_ON_NEWLINE=true
zle && zle accept-line
}
zle -N switch_powerlevel_multiline_prompt
bindkey ^P switch_powerlevel_multiline_prompt
# -------------------------------- FUNCTIONS ---------------------------------
glog() {
setterm -linewrap off 2> /dev/null
git --no-pager log --all --color=always --graph --abbrev-commit --decorate --date-order \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' "$@" \
| sed -E \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+ /├\1─╮\2/' \
-e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m /\1├─╯\x1b\[m/' \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+/├\1╮\2/' \
-e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m/\1├╯\x1b\[m/' \
-e 's/╮(\x1b\[[0-9;]*m)+\\/╮\1╰╮/' \
-e 's/╯(\x1b\[[0-9;]*m)+\//╯\1╭╯/' \
-e 's/(\||\\)\x1b\[m (\x1b\[[0-9;]*m)/╰╮\2/' \
-e 's/(\x1b\[[0-9;]*m)\\/\1╮/g' \
-e 's/(\x1b\[[0-9;]*m)\//\1╯/g' \
-e 's/^\*|(\x1b\[m )\*/\1⎬/g' \
-e 's/(\x1b\[[0-9;]*m)\|/\1│/g' \
| command less -r $([ $# -eq 0 ] && echo "+/[^/]HEAD")
setterm -linewrap on 2> /dev/null
}
find() {
if [ $# = 1 ]
then
command find . -iname "*$@*"
else
command find "$@"
fi
}
### Antigen
[[ ! -f ~/.local/antigen.zsh ]] || source ~/.local/antigen.zsh
if type antigen &> /dev/null; then
antigen use oh-my-zsh
antigen bundle git
antigen bundle bundler
antigen bundle dotenv
antigen bundle macos
antigen bundle rake
antigen bundle rbenv
antigen bundle ruby
antigen bundle k
antigen bundle marlonrichert/zsh-autocomplete
antigen apply
fi
## TODO
# source /Users/bzalewski/.config/broot/launcher/bash/br
### fzf
[ -f ~/.local/fzf.zsh ] && source ~/.local/fzf.zsh
### Google Cloud SDK
if type brew &> /dev/null; then
[[ ! -f "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" ]] || source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
[[ ! -f "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" ]] || source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
fi
## TODO: What is this line?
fpath+=~/.zfunc
### zoxide
# TODO: Ensure zoxide.vim is installed
type zoxide &> /dev/null && eval "$(zoxide init zsh)"
### Fig
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && . "$HOME/.fig/shell/zshrc.post.zsh"
### Powerline
[[ ! -f ~/.config/p10k.zsh ]] || source ~/.p10k.zsh