mirror of
https://github.com/HerrCraziDev/dotfiles.git
synced 2026-04-20 14:34:21 +02:00
Merge branch 'master' of github.com:HerrCraziDev/dotfiles
This commit is contained in:
21
.aliases
21
.aliases
@@ -9,6 +9,7 @@ alias sai='sudo apt install'
|
|||||||
alias sau='sudo apt update'
|
alias sau='sudo apt update'
|
||||||
alias safu='sudo apt full-upgrade'
|
alias safu='sudo apt full-upgrade'
|
||||||
alias safy='sudo apt full-upgrade -y'
|
alias safy='sudo apt full-upgrade -y'
|
||||||
|
alias spu='sudo pacman -Sy archlinux-keyring && sudo pacman -Syu'
|
||||||
alias fullup='safy'
|
alias fullup='safy'
|
||||||
alias fug='safy'
|
alias fug='safy'
|
||||||
alias gtop='watch -tn 0.5 nvidia-smi'
|
alias gtop='watch -tn 0.5 nvidia-smi'
|
||||||
@@ -26,7 +27,7 @@ alias tmr='tmux attach'
|
|||||||
alias ll='ls -lah --color=auto'
|
alias ll='ls -lah --color=auto'
|
||||||
alias reload='source ~/.termrc'
|
alias reload='source ~/.termrc'
|
||||||
|
|
||||||
alias ssj="ssh -J pi@bst1.chenco.dev"
|
alias ssj="ssh -J herrcrazi@lan1.chenco.dev"
|
||||||
|
|
||||||
#alias mc-install-plugin='echo "Installing $2"; echo "Done !"'
|
#alias mc-install-plugin='echo "Installing $2"; echo "Done !"'
|
||||||
alias cls='lxc ls -c ns4D'
|
alias cls='lxc ls -c ns4D'
|
||||||
@@ -38,6 +39,22 @@ alias zfs='sudo zfs'
|
|||||||
alias zls='sudo zfs list'
|
alias zls='sudo zfs list'
|
||||||
|
|
||||||
sm() {
|
sm() {
|
||||||
tmux new-window -n serial:$(basename ${@:-1}) sudo picocom --baud 921600 --parity n --databits 8 --stopbits 1 --flow n --escape z $@
|
tmux new-window -n serial:$(basename ${@:-1}) sudo picocom --logfile $SERIAL_LOGS/serial-$(basename ${@:-1})-$(ls $SERIAL_LOGS/serial-*.log 2> /dev/null | wc -l).log --baud 921600 --parity n --databits 8 --stopbits 1 --flow n --escape z $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
smi() {
|
||||||
|
tmux rename-window "serial:$(basename ${@:-1})"
|
||||||
|
sudo picocom --logfile $SERIAL_LOGS/serial-$(basename ${@:-1})-$(ls $SERIAL_LOGS/serial-*.log 2> /dev/null | wc -l).log --baud 921600 --parity n --databits 8 --stopbits 1 --flow n --escape z $@
|
||||||
|
}
|
||||||
|
|
||||||
|
mgnt() {
|
||||||
|
echo $1
|
||||||
|
sshpass -p administrator ssh administrator@$1
|
||||||
|
}
|
||||||
|
|
||||||
|
sumgnt() {
|
||||||
|
#echo root@$1
|
||||||
|
sshpass -p ekitool ssh root@$1 "${@:2}"
|
||||||
|
}
|
||||||
|
|
||||||
|
alias shmgnt="sshpass -p ekitool ssh"
|
||||||
|
|||||||
120
.termrc
120
.termrc
@@ -1,4 +1,7 @@
|
|||||||
|
|
||||||
|
# Pre-define 'reload' in case .aliases dont provide it
|
||||||
|
alias reload='source ~/.termrc'
|
||||||
|
|
||||||
# Load personal aliases
|
# Load personal aliases
|
||||||
source "$HOME/.aliases"
|
source "$HOME/.aliases"
|
||||||
|
|
||||||
@@ -7,6 +10,13 @@ if [ -e $HOME/.tmux/.tmux-aliases ] ; then
|
|||||||
source $HOME/.tmux/.tmux-aliases
|
source $HOME/.tmux/.tmux-aliases
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set base tmux session name
|
||||||
|
if [ -n "$WSLENV" ] ; then
|
||||||
|
HRNX_TMUX_SESSIONNAME="wsl"
|
||||||
|
else
|
||||||
|
HRNX_TMUX_SESSIONNAME="main"
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix linker errors with gtk3 -- removed since I nuked gtk-nocsd
|
# Fix linker errors with gtk3 -- removed since I nuked gtk-nocsd
|
||||||
#export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0
|
#export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0
|
||||||
|
|
||||||
@@ -23,14 +33,45 @@ chkinst rust && export PATH=$PATH:$HOME/.cargo/bin
|
|||||||
# Add snap bins to PATH (fuck snap)
|
# Add snap bins to PATH (fuck snap)
|
||||||
chkinst snap && export PATH=$PATH:/snap/bin
|
chkinst snap && export PATH=$PATH:/snap/bin
|
||||||
|
|
||||||
|
# Add node global modules to PATH
|
||||||
|
if nodepath=$(npm root -g); then
|
||||||
|
export PATH=$PATH:$nodepath
|
||||||
|
fi
|
||||||
|
|
||||||
# Usual env vars
|
# Usual env vars
|
||||||
export EDITOR=/usr/bin/vim
|
export EDITOR=/usr/bin/vim
|
||||||
export LANG="en_US.UTF-8"
|
export LANG="en_US.UTF-8"
|
||||||
export LANGUAGE="en_US.UTF-8"
|
export LANGUAGE="en_US.UTF-8"
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
alias diff='diff --color=auto'
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias ip='ip -color=auto'
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
# Decompress raw zlib files (.dat)
|
# Decompress raw zlib files (.dat)
|
||||||
zlibd() (printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - "$@" | gzip -dc)
|
zlibd() (printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - "$@" | gzip -dc)
|
||||||
|
|
||||||
|
# Kilroy was here ! #2
|
||||||
|
export _KILROY_WAS_HERE=2
|
||||||
|
|
||||||
|
# Make scripts executable in a dir
|
||||||
|
fixsh () {
|
||||||
|
if [ -d $1 ] ; then
|
||||||
|
find $1 -type f -name "*.sh" -exec chmod a+x {} \;
|
||||||
|
find $1 -type f -name "*.bash" -exec chmod a+x {} \;
|
||||||
|
find $1 -type f -name "*.zsh" -exec chmod a+x {} \;
|
||||||
|
find $1 -type f -name "*.lua" -exec chmod a+x {} \;
|
||||||
|
find $1 -type f -name "*.py" -exec chmod a+x {} \;
|
||||||
|
find $1 -type f -name "*.pl" -exec chmod a+x {} \;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# User scripts & bins executable
|
||||||
|
fixsh $HOME/sh
|
||||||
|
fixsh $HOME/bin
|
||||||
|
|
||||||
|
|
||||||
# Run WSL-specific inits
|
# Run WSL-specific inits
|
||||||
if [ -n "$WSLENV" ] ; then
|
if [ -n "$WSLENV" ] ; then
|
||||||
printf '\e[34m [termrc] Running on WSL\e[0m\n'
|
printf '\e[34m [termrc] Running on WSL\e[0m\n'
|
||||||
@@ -42,18 +83,85 @@ if [ -n "$WSLENV" ] ; then
|
|||||||
# Enable entr workaround for incomplete inotify support on WSL
|
# Enable entr workaround for incomplete inotify support on WSL
|
||||||
export ENTR_INOTIFY_WORKAROUND=1
|
export ENTR_INOTIFY_WORKAROUND=1
|
||||||
|
|
||||||
|
# Add Ubuntu debuginfod server
|
||||||
|
export DEBUGINFOD_URLS="https://debuginfod.ubuntu.com"
|
||||||
|
|
||||||
|
# Re-init serial
|
||||||
|
reinit() (unset _SERIAL_INIT; reload)
|
||||||
|
|
||||||
# Connect serial console port if found
|
# Connect serial console port if found
|
||||||
if [ -z "$_SERIAL_INIT" ] ; then
|
if [ -z "$_SERIAL_INIT" ] ; then
|
||||||
source "$HOME/.usbipd"
|
source "$HOME/.usbipd"
|
||||||
echo "Connecting serial port... (device $USB_SERIAL_HWID)"
|
|
||||||
usbipd.exe wsl attach --hardware-id $USB_SERIAL_HWID
|
# Connect serial console ports
|
||||||
|
echo "Connecting serial port... (device ${USB_SERIAL_HWID:="0403:6001"})"
|
||||||
|
|
||||||
|
bus_ids=$( usbipd.exe list 2> /dev/null | grep "$USB_SERIAL_HWID" )
|
||||||
|
|
||||||
|
if [ -n "$bus_ids" ] ; then
|
||||||
|
echo $bus_ids
|
||||||
|
IFS=$' \t\n'
|
||||||
|
bus_ids=$( tr -s ' ' <<< $bus_ids | cut -d ' ' -f1 | tr '\n' ' ' )
|
||||||
|
|
||||||
|
for bus_id in $=bus_ids ; do
|
||||||
|
usbipd.exe attach --wsl --busid $bus_id 2> /dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "Serial port connected"
|
echo "Serial port $bus_id connected"
|
||||||
usbipd.exe wsl list
|
export _SERIAL_INIT=$(($_SERIAL_INIT+1))
|
||||||
export _SERIAL_INIT=1
|
|
||||||
else
|
else
|
||||||
echo "Unable to connect serial port (device $USB_SERIAL_HWID)"
|
echo "Unable to connect serial port (device $USB_SERIAL_HWID, bus $bus_id)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
usbipd.exe wsl list 2> /dev/null
|
||||||
|
else
|
||||||
|
echo "No serial port found matching device type $USB_SERIAL_HWID"
|
||||||
|
export _SERIAL_INIT=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure serial logs
|
||||||
|
if [ ! -d $SERIAL_LOGS ] ; then
|
||||||
|
if mkdir -p $SERIAL_LOGS; then echo "Serial logpath created at $SERIAL_LOGS"
|
||||||
|
else echo "Unable to create $SERIAL_LOGS"; fi
|
||||||
|
else
|
||||||
|
echo "Serial logs will be written to $SERIAL_LOGS"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Automatically creates and attach a 'main' tmux session. If already created,
|
||||||
|
# attach in a new window instead. If running from tmux, does nothing.
|
||||||
|
if [ -z "$TMUX" ] && which tmux ; then
|
||||||
|
# Check if this script has already created a base session, then create a new session with a new blank window for the new terminal.
|
||||||
|
# If a session had already been created and left detached, attach to that instead.
|
||||||
|
if tmux has -t $HRNX_TMUX_SESSIONNAME ; then
|
||||||
|
if [ "$VSCODE_EMBEDDED_TERM" = 1 ] ; then
|
||||||
|
# Running from vscode terminal
|
||||||
|
count=$(tmux list-sessions -F "#S" -f "#{session_attached}" | grep vscode | wc -l)
|
||||||
|
tmux new-session -A -t $HRNX_TMUX_SESSIONNAME -s vscode-$(($count+1)) -e VSCODE_EMBEDDED_TERM=1 \; new-window -n vscode-$(($count+1))
|
||||||
|
else
|
||||||
|
# Running from another tab or window
|
||||||
|
count=$(tmux list-sessions -F "#S" -f "#{session_attached}" | grep $HRNX_TMUX_SESSIONNAME | wc -l)
|
||||||
|
tmux new-session -A -t $HRNX_TMUX_SESSIONNAME -s $HRNX_TMUX_SESSIONNAME-$(($count+1)) \; new-window
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Create new base session
|
||||||
|
tmux new-session -A -s $HRNX_TMUX_SESSIONNAME -t $HRNX_TMUX_SESSIONNAME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Env for 'mgnt toolbox' (rbsh, rbcli, etc)
|
||||||
|
export RBIP="10.102.88.203"
|
||||||
|
export RBLOG="administrator"
|
||||||
|
export RBPASS="administrator"
|
||||||
|
export RBROOTPASS="ekitool"
|
||||||
|
|
||||||
|
export PMCTL_SSH_IP="10.102.88.203"
|
||||||
|
export PMCTL_SSH_USER="root"
|
||||||
|
export PMCTL_SSH_PORT=2222
|
||||||
|
|
||||||
|
export _KILROY_WAS_HERE=3
|
||||||
|
|
||||||
|
# Setup functions for DEY SDK envs (pm800)
|
||||||
|
source ~/sh/sdk-setenv.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
55
.vimrc
Normal file
55
.vimrc
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
set history=500
|
||||||
|
|
||||||
|
" Filetype plugins
|
||||||
|
filetype plugin on
|
||||||
|
filetype indent on
|
||||||
|
|
||||||
|
" Auto read externally modified files
|
||||||
|
set autoread
|
||||||
|
au FocusGained,BufEnter * silent! checktime
|
||||||
|
|
||||||
|
" :W sudo saves the file
|
||||||
|
" (useful for handling the permission-denied error)
|
||||||
|
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
|
||||||
|
|
||||||
|
" Regexes, search
|
||||||
|
set magic
|
||||||
|
set incsearch
|
||||||
|
set showmatch
|
||||||
|
set smartcase
|
||||||
|
set ignorecase
|
||||||
|
set hlsearch
|
||||||
|
|
||||||
|
" Line numbers
|
||||||
|
set number
|
||||||
|
|
||||||
|
" Ruler
|
||||||
|
set ruler
|
||||||
|
|
||||||
|
" Colors
|
||||||
|
syntax enable
|
||||||
|
set t_Co=256
|
||||||
|
|
||||||
|
" Default filetypes
|
||||||
|
set ffs=unix,dos,mac
|
||||||
|
|
||||||
|
|
||||||
|
" Tabs and indentation
|
||||||
|
""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Be smart when using tabs ;)
|
||||||
|
set smarttab
|
||||||
|
|
||||||
|
" 1 tab == 4 spaces
|
||||||
|
set shiftwidth=4
|
||||||
|
set tabstop=4
|
||||||
|
|
||||||
|
" Linebreak on 500 characters
|
||||||
|
set lbr
|
||||||
|
set tw=500
|
||||||
|
|
||||||
|
set ai "Auto indent
|
||||||
|
set si "Smart indent
|
||||||
|
set wrap "Wrap lines
|
||||||
|
|
||||||
|
|
||||||
9
.zshrc
9
.zshrc
@@ -31,7 +31,7 @@ source "$HOME/.termrc"
|
|||||||
|
|
||||||
# The following lines were added by compinstall
|
# The following lines were added by compinstall
|
||||||
|
|
||||||
zstyle ':completion:*' completer _list _expand _complete _ignored _approximate _prefix
|
zstyle ':completion:*' completer _expand _complete _ignored _approximate _prefix
|
||||||
zstyle ':completion:*' expand prefix
|
zstyle ':completion:*' expand prefix
|
||||||
zstyle ':completion:*' file-sort name
|
zstyle ':completion:*' file-sort name
|
||||||
zstyle ':completion:*' ignore-parents parent
|
zstyle ':completion:*' ignore-parents parent
|
||||||
@@ -65,3 +65,10 @@ SAVEHIST=100000
|
|||||||
setopt autocd beep notify
|
setopt autocd beep notify
|
||||||
bindkey -e
|
bindkey -e
|
||||||
# End of lines configured by zsh-newuser-install
|
# End of lines configured by zsh-newuser-install
|
||||||
|
|
||||||
|
# Disable zsh globbing error messages, leave it to the called program
|
||||||
|
setopt +o nomatch
|
||||||
|
|
||||||
|
# Set immediate completion
|
||||||
|
setopt menu_complete
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,18 @@ bind l select-pane -R \; display-panes
|
|||||||
bind h select-pane -L \; display-panes
|
bind h select-pane -L \; display-panes
|
||||||
bind C-l last-pane \; display-panes
|
bind C-l last-pane \; display-panes
|
||||||
bind L last-pane \; display-panes
|
bind L last-pane \; display-panes
|
||||||
|
bind s swap-pane
|
||||||
|
|
||||||
# Window navigation
|
# Window navigation
|
||||||
bind Tab last-window
|
bind Tab last-window
|
||||||
bind Enter copy-mode
|
bind Enter copy-mode
|
||||||
bind Escape copy-mode
|
bind Escape copy-mode
|
||||||
|
|
||||||
|
# Switch windows or sessions
|
||||||
|
bind a choose-tree -sG
|
||||||
|
|
||||||
# Copy mode
|
# Copy mode
|
||||||
|
set -g mode-keys vi # set vim keys
|
||||||
bind C-v paste-buffer
|
bind C-v paste-buffer
|
||||||
bind -T copy-mode-vi Enter send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
bind -T copy-mode-vi Enter send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
||||||
bind -T copy-mode-vi C-c send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
bind -T copy-mode-vi C-c send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
||||||
@@ -31,12 +36,12 @@ bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-no-clear
|
|||||||
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send -X select-word
|
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send -X select-word
|
||||||
bind -T copy-mode-vi TripleClick1Pane select-pane \; send -X select-line
|
bind -T copy-mode-vi TripleClick1Pane select-pane \; send -X select-line
|
||||||
bind -T copy-mode-vi Escape send -X cancel
|
bind -T copy-mode-vi Escape send -X cancel
|
||||||
|
bind -T copy-mode-vi f send -X search-backward
|
||||||
|
|
||||||
|
|
||||||
# Window actions
|
# Window actions
|
||||||
# bind y rename-window
|
# bind y rename-window
|
||||||
bind r source-file ~/.tmux.conf; display " [tmux] ♦ Configuration reloaded from .tmux.conf"
|
bind r source-file ~/.tmux.conf #; display " [tmux] ♦ Configuration reloaded from .tmux.conf"
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
set -g display-panes-active-colour colour71
|
set -g display-panes-active-colour colour71
|
||||||
@@ -55,7 +60,7 @@ set -g mouse on
|
|||||||
|
|
||||||
set -g status-bg colour235
|
set -g status-bg colour235
|
||||||
set -g status-fg colour255
|
set -g status-fg colour255
|
||||||
set -g status-left '#(sh ~/.tmux/health-indicator.sh #{client_prefix})#(~/.tmux/segment.sh end 29) ▣ #{session_windows} #{?session_many_attached,#(~/.tmux/subsegment.sh end) 🖥 #{session-attached},}#(~/.tmux/segment.sh end 29 71) #[fg=colour235]#H #(~/.tmux/segment.sh end 71 65) #[fg=colour235]#(whoami) #(~/.tmux/segment.sh end 65 235)'
|
set -g status-left '#(sh ~/.tmux/health-indicator.sh #{client_prefix})#(~/.tmux/segment.sh end 29) ▣ #{session_windows} #{?session_group_many_attached,#(~/.tmux/subsegment.sh end) 🖥 #{session_group_attached},}#(~/.tmux/segment.sh end 29 71) #[fg=colour235]#H #(~/.tmux/segment.sh end 71 65) #[fg=colour235]#(whoami) #(~/.tmux/segment.sh end 65 235)'
|
||||||
set -g status-left-length 80
|
set -g status-left-length 80
|
||||||
set -g status-right-length 120
|
set -g status-right-length 120
|
||||||
set -g status-justify centre
|
set -g status-justify centre
|
||||||
@@ -67,3 +72,8 @@ set -g window-status-current-format '#(~/.tmux/segment.sh start 235 71 round)#[f
|
|||||||
|
|
||||||
set -g status-right '#{?#(~/.tmux/mediaplaying.sh test),#(~/.tmux/segment.sh start 235 65)#[fg=colour235] ♫ #(~/.tmux/mediaplaying.sh) #(~/.tmux/segment.sh start 65 71),#(~/.tmux/segment.sh start 235 71)}#[fg=colour235] %H:%M:%S #(~/.tmux/subsegment.sh start) %d %b '
|
set -g status-right '#{?#(~/.tmux/mediaplaying.sh test),#(~/.tmux/segment.sh start 235 65)#[fg=colour235] ♫ #(~/.tmux/mediaplaying.sh) #(~/.tmux/segment.sh start 65 71),#(~/.tmux/segment.sh start 235 71)}#[fg=colour235] %H:%M:%S #(~/.tmux/subsegment.sh start) %d %b '
|
||||||
set -g pane-active-border-style fg=colour76
|
set -g pane-active-border-style fg=colour76
|
||||||
|
|
||||||
|
# Pane titles
|
||||||
|
set -g pane-border-status top
|
||||||
|
set -g pane-border-format "#(~/.tmux/segment.sh start)#[reverse] #{pane_index} - #{pane_title} #[default]#(~/.tmux/segment.sh end)"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user