This commit is contained in:
Paul Trowbridge 2024-10-29 20:11:58 -04:00
commit e1056d8d54
11 changed files with 474 additions and 0 deletions

165
dotfiles/.bashrc Normal file
View File

@ -0,0 +1,165 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
vc() {
git add .
git commit -m "commit: $(date "+%Y-%m-%d %H:%M:%S")"
git push
}
# some more ls aliases
alias ll='ls -alFh'
alias la='ls -A'
alias l='ls -CF'
#alias lb='lsblk -o+FSAVAIL,FSUSED,FSUSE%,MODEL,PARTTYPENAME,STATE'
alias lb='lsblk -o+FSTYPE,FSAVAIL,FSUSED,FSUSE%,MODEL'
alias opg="lsof 2>/dev/null +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g'"
alias osw="lsof 2>/dev/null +D . | awk '\$NF ~ /swp$/ {print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g'"
alias xpg="lsof 2>/dev/null +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f"
alias xsw="lsof 2>/dev/null +D . | grep '.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f"
alias ons='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)"'
alias xns='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f %'
alias xnsp='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | sed "s/\\.swo$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $PG -f % | pspg'
#alias xnsp='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd)" | fzf | xargs -I % $PG -f % | pspg'
alias mns='fzf | xargs -I {} sqlcmd -U Pricing -S mid-sql02 -C -i {} | pspg'
alias xmsp='lsof +D ~/.local/state/nvim/swap/ | grep -o "/swap/.*" | cut -c 7- | tr "%" "/" | sed "s/\\.swp$//" | grep "$(pwd | sed "s|^//|/|")" | fzf | xargs -I % $MS -i % | pspg'
alias nv='~/nvim-linux64/bin/nvim'
alias gs='git status -s'
alias ga='git status --untracked-files=all -s | fzf -m | awk "{print \$2}" | xargs git add '
alias gx='git status --untracked-files=all -s | fzf -m | awk "{print \$2}" | xargs git checkout '
alias td='rg "\- \[[^x]\]"'
# alias tdo='rg "\- \[[^x]\]" | fzf | xargs nvim'
alias tdo='rg "\- \[ \]" --line-number | fzf | awk -F: "{print \$1, \"+\"\$2}" | xargs -r nvim'
alias gr='git reset HEAD'
alias gc='git commit -v'
alias gd='git difftool'
alias gl='git log --graph --oneline --format="%C(yellow)%h %C(green)%an%Creset %C(blue)%ad%Creset %s"'
alias cj='cd ~/storage/shared/Documents/journal/'
alias jr='cd ~/storage/shared/Documents/journal/ && git pull && vc && cd -'
alias hc='cd ~/storage/shared/Documents/hc_notes/ && git pull && git push && cd -'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
#EDITOR=/usr/bin/vim.basic
export EDITOR=vim
export VISUAL=vim
PAGER="less"
LESS="-S"
export PSQL_PAGER="pspg"
if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_ONLY_IN_REPO=1
source $HOME/.bash-git-prompt/gitprompt.sh
fi
bind 'set bell-style none'
[ -f ~/dot_config/.bashrc_local ] && source ~/dot_config/.bashrc_local
export PATH=$PATH:~/lua-language-server/bin

9
dotfiles/.bashrc_local Normal file
View File

@ -0,0 +1,9 @@
#export IPTOKEN=
#export PG="psql -U ptrowbridge -d ubm -p 5432 -h usmidsap01"
#export MS="sqlcmd.exe -S mid-sql02 -i"
#export JAVA_HOME=/opt/jdk-19.0.1
#export PATH=$PATH:$JAVA_HOME/bin
#export PATH=$PATH:/opt/gradle/gradle-7.6/bin
#export RUNNER_PATH=/opt/runner/
#export DB2PW=
#export PGPW=

28
dotfiles/.gitconfig Normal file
View File

@ -0,0 +1,28 @@
[user]
email = paul@hptrow.me
name = Paul Trowbridge
[core]
autocrlf = input
editor = vim
[push]
default = simple
[alias]
pushall = !git remote | xargs -L1 git push --all
[log]
date = format:%Y-%m-%d %H:%M:%S
[format]
pretty = format:'%C(yellow)%h %Cred%ad %Cblue%an %Cgreen%d %Creset%s'
[diff]
tool = vimdiff
[safe]
directory = /var/www/kimai2
directory = /var/www/html/resume/
directory = /var/www/html/resume
directory = /opt/forecast_api/
directory = /opt/forecast_api
directory = /etc/postgresql/15/main/
directory = /etc/postgresql/15/main
directory = /storage/emulated/0/Documents/journal
directory = /storage/emulated/0/Documents/hc_notes
[pull]
rebase = false

40
dotfiles/.pspgconf Normal file
View File

@ -0,0 +1,40 @@
ascii_menu = false
bold_labels = false
bold_cursor = false
ignore_case = false
ignore_lower_case = false
no_cursor = false
no_sound = false
no_mouse = false
less_status_bar = false
no_highlight_search = false
no_highlight_lines = false
force_uniborder = false
show_rownum = false
without_commandbar = false
without_topbar = false
vertical_cursor = true
on_sigint_exit = false
no_sigint_search_reset = false
double_header = false
quit_on_f3 = false
pgcli_fix = false
xterm_mouse_mode = true
show_scrollbar = true
menu_always = false
empty_string_is_null = true
last_row_search = true
progressive_load_mode = true
highlight_odd_rec = true
hide_header_line = false
on_exit_reset = false
on_exit_clean = false
on_exit_erase_line = false
on_exit_sgr0 = false
direct_color = false
theme = 18
border_type = 2
default_clipboard_format = 0
clipboard_app = 0
hist_size = 500
esc_delay = -1

9
dotfiles/.psqlrc Normal file
View File

@ -0,0 +1,9 @@
-- Switch pagers with :x and :xx commands
\set x '\\setenv PAGER ''less -S'''
\set xx '\\setenv PAGER \'pspg -bX --no-mouse\''
\timing on
\set QUIET 1
\pset linestyle unicode
-- \pset border 2
\pset null ∅
\unset QUIET

32
dotfiles/.tmux.conf Normal file
View File

@ -0,0 +1,32 @@
set -g default-terminal 'screen-256color'
#attempt to navigate panes like vim
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
set -g mouse on
bind -n C-PgDn next-window
bind -n C-PgUp previous-window
#plugin manager for install tmux-resurrect
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'jimeh/tmux-themepack'
set -g @themepack 'powerline/default/cyan'
#-----------------------nova---------------------------------------------
#set -g @plugin 'o0th/tmux-nova'
#set -g @nova-nerdfonts true
#set -g @nova-nerdfonts-left 
#set -g @nova-nerdfonts-right 
#set -g @nova-segment-mode "#{?client_prefix,Ω,ω}"
#set -g @nova-segment-mode-colors "#50fa7b #282a36"
#set -g @nova-segment-whoami "#(whoami)@#h"
#set -g @nova-segment-whoami-colors "#50fa7b #282a36"
#set -g @nova-pane "#I#{?pane_in_mode,  #{pane_mode},}  #W"
#set -g @nova-rows 0
#set -g @nova-segments-0-left "mode"
#set -g @nova-segments-0-right "whoami"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

75
dotfiles/.vimrc Normal file
View File

@ -0,0 +1,75 @@
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdtree'
"Plugin 'edkolev/tmuxline.vim'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'leafgarland/typescript-vim'
Plugin 'peitalin/vim-jsx-typescript'
"Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
let NERDTreeShowHidden=1
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
set mouse=a
set nowrap
colorscheme desert
syntax on
set splitright
set splitbelow
set number
"---------explorer------
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 25
"----airline tabs for buffers-------
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme = 'violet'
let g:airline_solarized_bg='dark'
let g:tmuxline_powerline_separators = 1
let g:airline_powerline_fonts = 1
"----markdown folding------------
"let g:vim_markdown_folding_disabled = 1
set nofoldenable " disable folding
"---general--------------------
let mapleader = ";"
set showcmd
map <Leader>a :bn<cr>
map <Leader>f :bp<cr>
map <Leader>d :bp<cr>:bd #<cr>
"---move the whole page without moving the cursor---
nnoremap J <C-E>
nnoremap K <C-Y>
"-----nerdtree--------------------
nmap <Leader>e :NERDTreeToggle<CR>
" Search as you type, highlight results
set incsearch
set showmatch
set hlsearch
set mouse=a
"----disable the bell; t_vb is required to be set to nothing
set visualbell
set t_vb=
nnoremap \\ :noh<cr> " Clear higlighting
set nowrap
"nnoremap <esc> :noh<return><esc>
" Resize windows
nnoremap <silent> <Up> 5<C-W>+
nnoremap <silent> <Down> 5<C-W>-
nnoremap <silent> <Right> 10<C-W>>
nnoremap <silent> <Left> 10<C-W><

12
install_postgres.sh Executable file
View File

@ -0,0 +1,12 @@
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql

24
install_python3.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# Update the package list
sudo apt-get update
# Install the software-properties-common package
sudo apt-get install software-properties-common
# Add the deadsnakes PPA to the sources list
sudo add-apt-repository ppa:deadsnakes/ppa
# Update the package list again
sudo apt-get update
# Check the latest version of Python 3 available
latest_version=$(apt-cache madison python3 | awk '{print $3}' | grep "^3\." | sort -V | tail -1)
# Install the latest version of Python 3
sudo apt-get install -y python3=$latest_version
# Verify the installation
python3 --version
which python3

79
setup_env.sh Executable file
View File

@ -0,0 +1,79 @@
#!/bin/bash
# Function to install packages
install_packages() {
echo "Updating package list..."
sudo apt update
echo "Installing basic packages..."
sudo apt install -y tmux vim git pspg bat fzf ripgrep
}
# Install Tmux Plugin Manager (TPM) if not already installed
install_tpm() {
if [[ ! -d ~/.tmux/plugins/tpm ]]; then
echo "Installing Tmux Plugin Manager..."
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
else
echo "Tmux Plugin Manager already installed, skipping..."
fi
}
# Install Vundle (Vim plugin manager) if not already installed
install_vundle() {
if [[ ! -d ~/.vim/bundle/Vundle.vim ]]; then
echo "Installing Vundle for Vim..."
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
else
echo "Vundle already installed, skipping..."
fi
}
# Install git-bash-prompt if not already installed
install_git_bash_prompt() {
if [[ ! -d ~/.bash-git-prompt ]]; then
echo "Installing git-bash-prompt..."
git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1
else
echo "git-bash-prompt already installed, skipping..."
fi
}
# Back up and create symlink
create_symlink() {
local target=$1
local link_name=$2
if [[ -L $link_name || -f $link_name ]]; then
echo "Backing up existing $link_name to ${link_name}.backup"
mv "$link_name" "${link_name}.backup"
fi
echo "Creating symlink: $link_name -> $target"
ln -s "$target" "$link_name"
}
# Deploy configuration files as symlinks
deploy_configs() {
echo "Deploying configuration files as symlinks..."
CONFIG_DIR="$(pwd)/dotfiles" # Use the local 'dotfiles' directory in the repo
for config in .bashrc .bashrc_local .vimrc .gitconfig .pspgconf .psqlrc .tmux.conf ; do
create_symlink "$CONFIG_DIR/$config" ~/$config
done
echo "Sourcing .bashrc..."
source ~/.bashrc
}
# Main script
main() {
install_packages
install_tpm
install_vundle
install_git_bash_prompt
deploy_configs
echo "Setup complete! Please restart your shell or run 'source ~/.bashrc' for changes to take effect."
}
main

1
sync.sh Executable file
View File

@ -0,0 +1 @@
rsync -azv -e ssh -r /storage/emulated/0/DCIM/Camera pt@hptrow.me:/home/pt/pics