234 lines
6.0 KiB
Plaintext
234 lines
6.0 KiB
Plaintext
# User profile for interactive sh(1) shells.
|
|
|
|
#
|
|
# Copyright (C) 2019, 2022 VHS <vhsdev@tutanota.com>
|
|
#
|
|
# This file is part of Archuro.
|
|
#
|
|
# Archuro is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Archuro is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
# =========================================================================== #
|
|
# General settings
|
|
# =================================================================== #
|
|
|
|
# Miminalist prompt with color, i.e. user@host:~/directory $
|
|
export PS1="\[$(tput bold)$(tput setb 4)$(tput setaf 7)\]\u@\h:\w $ \[$(tput sgr0)\]"
|
|
export CLICOLOR=1
|
|
export LSCOLORS=ExFxCxDxBxegedabagacad
|
|
|
|
# =========================================================================== #
|
|
# Aliases and utility functions
|
|
# =================================================================== #
|
|
|
|
#
|
|
# Navigation and Listing
|
|
#
|
|
|
|
alias l='ls -1'
|
|
alias ll='ls -1A'
|
|
alias la='ls -al'
|
|
alias lr='ls -R'
|
|
alias ..='cd ..'
|
|
alias ...='cd ..; cd ..'
|
|
alias vim=/Users/jos/.local/bin/lvim
|
|
|
|
ff() {
|
|
find . -iname "*${1:-}*"
|
|
}
|
|
|
|
#
|
|
# Network
|
|
#
|
|
|
|
alias net="ping vhs.codeberg.page | grep -E --only-match --color=never '[0-9\.]+ ms'"
|
|
alias myip="curl -4 icanhazip.com"
|
|
|
|
#
|
|
# Archuro
|
|
#
|
|
|
|
alias ao='archuro'
|
|
alias sp="source $HOME/.profile"
|
|
|
|
#
|
|
# Make
|
|
#
|
|
|
|
alias mi='make install'
|
|
|
|
# Homebrew
|
|
# @see https://thoughtbot.com/blog/starting-and-stopping-background-services-with-homebrew
|
|
#
|
|
|
|
alias b='brew'
|
|
alias bs='brew services'
|
|
alias bsc='brew services cleanup'
|
|
alias bsl='brew services list'
|
|
alias bsr='brew services restart'
|
|
alias bss='brew services start'
|
|
|
|
#
|
|
# VS Code (macOS-only)
|
|
#
|
|
|
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
alias c='code'
|
|
alias cx='code --list-extensions'
|
|
|
|
cxinstall() {
|
|
test -r ~/.vscode/ext-list && xargs <~/.vscode/ext-list -n1 code --install-extension
|
|
}
|
|
cxsave() {
|
|
test -r ~/.vscode/ext-list && cx >~/.vscode/ext-list
|
|
}
|
|
cxremoveall() {
|
|
# WARNING: Use with care. This removes all currently installed extensions.
|
|
code --list-extensions | xargs -n1 code --uninstall-extension
|
|
}
|
|
fi
|
|
|
|
#
|
|
# Git
|
|
#
|
|
|
|
alias g='git'
|
|
alias ga='git add'
|
|
alias gaa='git add --all'
|
|
alias gb='git branch'
|
|
alias gca='git commit --amend --no-edit'
|
|
alias gcb='git checkout -b'
|
|
alias gcl='git clone'
|
|
alias gcm='git checkout master'
|
|
alias gco='git checkout'
|
|
alias gd='git diff'
|
|
alias gds='git diff --staged'
|
|
alias gf='git fetch'
|
|
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --decorate --date=short"
|
|
alias gla='git log --all --graph --pretty=format:"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit --date=relative'
|
|
alias gls='git log --no-merges --pretty=format:"%ae" | sort | uniq -c | sort --reverse'
|
|
#alias gl='git log --all --graph --pretty=format:"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit --date=relative'
|
|
#alias gls='git log --no-merges --pretty=format:"%ae" | sort | uniq -c | sort --reverse'
|
|
alias gp='git push'
|
|
alias gr='git rebase'
|
|
alias gra='git rebase --abort'
|
|
alias grc='git rebase --continue'
|
|
alias gri='git rebase --interactive'
|
|
alias grs='git rebase --skip'
|
|
alias gs='git status --short'
|
|
alias gu='git pull'
|
|
alias gz='npx git-cz'
|
|
|
|
gcp() {
|
|
title="$@"
|
|
git commit -am "$title" && git push -u origin
|
|
}
|
|
gc() {
|
|
args="$@"
|
|
git commit -m "$args"
|
|
}
|
|
|
|
#
|
|
# pNPM
|
|
# Use @antfu/ni for cross-packager package
|
|
# management when using Zsh and consider consolidating.
|
|
#
|
|
|
|
alias pu="pnpm up"
|
|
alias pb="pnpm build"
|
|
alias pd="pnpm dev"
|
|
alias pt="pnpm test"
|
|
alias ni="npm install"
|
|
alias nr="npm run"
|
|
alias nrb="npm run build"
|
|
alias nrc="npm run clean"
|
|
alias nrd="npm run dev"
|
|
alias nrs="npm run start"
|
|
|
|
ns() {
|
|
cat <package.json | jq '.scripts'
|
|
}
|
|
|
|
#
|
|
# Hugo
|
|
#
|
|
|
|
alias hs='hugo serve --buildDrafts --navigateToChanged'
|
|
alias hd='hugo && hugo deploy'
|
|
|
|
#
|
|
# Docker
|
|
#
|
|
|
|
alias dc='docker-compose'
|
|
# Bring all services down
|
|
alias dcd='docker-compose down'
|
|
# Attach to all logs of all services
|
|
alias dcl='docker-compose logs -f'
|
|
# Run a comand inside a running container
|
|
alias dcr='docker-compose run --rm'
|
|
# "Restart" all services
|
|
alias dcre='docker-compose down && docker-compose up -d && docker-compose logs -f'
|
|
# Bring all services up in daemon mode
|
|
alias dcu='docker-compose up -d'
|
|
# Bring all containers up and attach to their logs
|
|
alias dcul='docker-compose up -d && docker-compose logs -f'
|
|
# Remove exited containers
|
|
alias dprune='docker ps -aq --no-trunc -f status=exited | xargs docker rm'
|
|
# Show all running containers, with horizontal paging
|
|
alias dps='docker ps -a | less -S'
|
|
|
|
#
|
|
# Node Version Manager
|
|
#
|
|
|
|
export NVM_DIR="$HOME/.nvm"
|
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
|
|
#
|
|
# Kubernetes
|
|
#
|
|
|
|
alias kc='kubectl'
|
|
# Tail logs to stdout
|
|
alias kclf='kubectl logs --tail=200 -f'
|
|
# Output detailed service info
|
|
alias kcgs='kubectl get service -o wide'
|
|
# Output detailed deployment info
|
|
alias kcgd='kubectl get deployment -o wide'
|
|
# Output detailed pod info
|
|
alias kcgp='kubectl get pod -o wide'
|
|
# Output detailed node info
|
|
alias kcgn='kubectl get node -o wide'
|
|
# Get pod info
|
|
alias kcdp='kubectl describe pod'
|
|
# Get service info
|
|
alias kcds='kubectl describe service'
|
|
# Get deployment info
|
|
alias kcdd='kubectl describe deployment'
|
|
# Delete something
|
|
alias kcdf='kubectl delete -f'
|
|
# Apply something
|
|
alias kcaf='kubectl apply -f'
|
|
# Apply Kustomize
|
|
alias kcak='kubectl apply -k'
|
|
# Get cluster info
|
|
alias kcci='kubectl cluster-info'
|
|
|
|
# Helm
|
|
alias hd='helm list --deployed | grep -v "NAME" | awk '\''{print $1}'\'' | sort | uniq -c | awk '\''{print $1,$2}'\'' | grep -v "^1 "'
|
|
function hl() { helm list $@; }
|
|
function hh() { helm history $(helm list -q $@); }
|
|
. "$HOME/.cargo/env"
|