Merge branch 'master' of github.com:tedkulp/dotfiles

This commit is contained in:
Ted Kulp
2025-06-23 09:49:23 -04:00
24 changed files with 58 additions and 403 deletions

2
.config/yadm/.kerlrc Normal file
View File

@@ -0,0 +1,2 @@
export CFLAGS="-g -O2"
export KERL_CONFIGURE_OPTIONS="--without-javac --without-wx --without-odbc --enable-threads --enable-kernel-poll --enable-webview --enable-gettimeofday-as-os-system-time"

View File

@@ -12,9 +12,12 @@ git clone git@github.com:tedkulp/lazyvim $HOME/.config/nvim
# Link in our tmux config
if [ ! -f "$HOME/.tmux.conf" ]; then
ln -s -f .tmux/.tmux.conf
ln -s -f .tmux/.tmux.conf
fi
mkdir -p $HOME/.asdf/plugins/erlang/kerl-home
cp .kerlrc $HOME/.asdf/plugins/erlang/kerl-home/.kerlrc
# Wrapping up
echo "Don't forget to run yadm decrypt!"
exit 0

1
.config/zsh/__init.zsh Normal file
View File

@@ -0,0 +1 @@
export XDG_CONFIG_HOME="$HOME/.config"

View File

@@ -1,40 +0,0 @@
export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_installed
export ASDF_GOLANG_MOD_VERSION_ENABLED=true
export KERL_BUILD_DOCS="yes"
export KERL_CONFIGURE_OPTIONS="--without-javac --without-wx --without-odbc --enable-threads --enable-kernel-poll --enable-webview --enable-gettimeofday-as-os-system-time"
asdf-up() {
plugin=$1
cur_version=`asdf current ${plugin} | tr -s ' ' | cut -d ' ' -f 2`
echo Updating plugin: $plugin version: $cur_version
asdf uninstall ${plugin} ${cur_version} && asdf install ${plugin} ${cur_version}
}
{% if YADM_OS == "Darwin" -%}
{% if YADM_ARCH == "arm64" -%}
export KERL_CONFIGURE_OPTIONS="$KERL_CONFIGURE_OPTIONS --enable-darwin-64bit"
{% endif -%}
# export CXXFLAGS="-ffat-lto-objects"
# export CFLAGS="-O2 -ffat-lto-objects"
export CFLAGS=""
export LDFLAGS=""
if which brew > /dev/null; then
blah=`brew --prefix openssl > /dev/null`
if [ $? -eq 0 ]; then
export CFLAGS="$CFLAGS -I$(brew --prefix openssl)/include"
export LDFLAGS="$LDFLAGS -L$(brew --prefix openssl)/lib"
fi
fi
{% endif -%}
# Stuff for building erlang on Apple ARM
# if [ -d "/opt/homebrew/opt/openssl@1.1/lib" ]; then
# export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
# export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
# export KERL_CONFIGURE_OPTIONS="--disable-debug --disable-silent-rules --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-threads --enable-kernel-poll --enable-wx --enable-webview --enable-darwin-64bit --enable-gettimeofday-as-os-system-time --with-ssl=$(brew --prefix openssl@1.1)" KERL_BUILD_DOCS="yes"
# fi

View File

@@ -1,170 +0,0 @@
AWESOME_FZF_LOCATION="$HOME/.config/zsh/awesome-fzf.zsh"
export FZF_DEFAULT_OPTS=" \
--color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \
--color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \
--color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796"
#List Awesome FZF Functions
function fzf-awesome-list() {
if [[ -f $AWESOME_FZF_LOCATION ]]; then
selected=$(grep -E "(function fzf-)(.*?)[^(]*" $AWESOME_FZF_LOCATION | sed -e "s/function fzf-//" | sed -e "s/() {//" | grep -v "selected=" | fzf-tmux --reverse --prompt="awesome fzf functions > ")
else
echo "awesome fzf not found"
fi
case "$selected" in
"");; #don't throw an exit error when we dont select anything
*) "fzf-"$selected;;
esac
}
#Enhanced rm
function fzf-rm() {
if [[ "$#" -eq 0 ]]; then
local files
files=$(find . -maxdepth 1 -type f | fzf-tmux --multi)
echo $files | xargs -I '{}' rm {} #we use xargs so that filenames to capture filenames with spaces in them properly
else
command rm "$@"
fi
}
# Man without options will use fzf to select a page
function fzf-man() {
MAN="/usr/bin/man"
if [ -n "$1" ]; then
$MAN "$@"
return $?
else
$MAN -k . | fzf-tmux --reverse --preview="echo {1,2} | sed 's/ (/./' | sed -E 's/\)\s*$//' | xargs $MAN" | awk '{print $1 "." $2}' | tr -d '()' | xargs -r $MAN
return $?
fi
}
#Eval commands on the fly
function fzf-eval() {
echo | fzf-tmux -q "$*" --preview-window=up:99% --preview="eval {q}"
}
## Search list of your aliases and functions
function fzf-aliases-functions() {
CMD=$(
(
(alias)
(functions | grep "()" | cut -d ' ' -f1 | grep -v "^_" )
) | fzf-tmux | cut -d '=' -f1
);
eval $CMD
}
## File Finder (Open in $EDITOR)
function fzf-find-files() {
local file=$(fzf-tmux --multi --reverse) #get file from fzf
if [[ $file ]]; then
for prog in $(echo $file); #open all the selected files
do; $EDITOR $prog; done;
else
echo "cancelled fzf"
fi
}
# Find Dirs
function fzf-cd() {
local dir
dir=$(find ${1:-.} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf-tmux +m) &&
cd "$dir"
ls
}
# Find Dirs + Hidden
function fzf-cd-incl-hidden() {
local dir
dir=$(find ${1:-.} -type d 2> /dev/null | fzf-tmux +m) && cd "$dir"
ls
}
# cd into the directory of the selected file
function fzf-cd-to-file() {
local file
local dir
file=$(fzf-tmux +m -q "$1") && dir=$(dirname "$file") && cd "$dir"
ls
}
# fdr - cd to selected parent directory
function fzf-cd-to-parent() {
local declare dirs=()
get_parent_dirs() {
if [[ -d "${1}" ]]; then dirs+=("$1"); else return; fi
if [[ "${1}" == '/' ]]; then
for _dir in "${dirs[@]}"; do echo $_dir; done
else
get_parent_dirs $(dirname "$1")
fi
}
local DIR=$(get_parent_dirs $(realpath "${1:-$PWD}") | fzf-tmux --tac)
cd "$DIR"
ls
}
# Search env variables
function fzf-env-vars() {
local out
out=$(env | fzf)
echo $(echo $out | cut -d= -f2)
}
# Kill process
function fzf-kill-processes() {
local pid
pid=$(ps -ef | sed 1d | fzf-tmux -m | awk '{print $2}')
if [ "x$pid" != "x" ]
then
echo $pid | xargs kill -${1:-9}
fi
}
# Enhanced Git Status (Open multiple files with tab + diff preview)
fzf-git-status() {
git rev-parse --git-dir > /dev/null 2>&1 || { echo "You are not in a git repository" && return }
local selected
selected=$(git -c color.status=always status --short |
fzf-tmux --height 50% "$@" --border -m --ansi --nth 2..,.. \
--preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1}) | head -500' |
cut -c4- | sed 's/.* -> //')
if [[ $selected ]]; then
for prog in $(echo $selected);
do; $EDITOR $prog; done;
fi
}
# Checkout to existing branch or else create new branch. gco <branch-name>.
# Falls back to fuzzy branch selector list powered by fzf if no args.
fzf-checkout(){
if git rev-parse --git-dir > /dev/null 2>&1; then
if [[ "$#" -eq 0 ]]; then
local branches branch
branches=$(git branch -a) &&
branch=$(echo "$branches" |
fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) &&
git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
elif [ `git rev-parse --verify --quiet $*` ] || \
[ `git branch --remotes | grep --extended-regexp "^[[:space:]]+origin/${*}$"` ]; then
echo "Checking out to existing branch"
git checkout "$*"
else
echo "Creating new branch"
git checkout -b "$*"
fi
else
echo "Can't check out or create branch. Not in a git repo"
fi
}

View File

@@ -1,49 +0,0 @@
ecsInstances() {
cluster=$1
profile=${2:-default}
aws ecs list-container-instances --cluster $cluster --profile $profile | jq -r '.containerInstanceArns | join(" ")'
}
ecsInstanceInfo() {
cluster=$1
profile=${2:-default}
instances=(`ecsInstances $cluster $profile`)
aws ecs describe-container-instances --cluster $cluster --profile $profile --container-instances $instances[@]
}
ecsInstanceIds() {
cluster=$1
profile=${2:-default}
ecsInstanceInfo $cluster $profile | jq -r '.containerInstances[].ec2InstanceId'
}
asgInstanceIds() {
cluster=$1
profile=${2:-default}
aws autoscaling describe-auto-scaling-groups --profile $profile | jq -r '.AutoScalingGroups[] | select(.AutoScalingGroupName == "$cluster") | .Instances | map(.InstanceId) | join(" ")'
}
xecsSsh() {
cluster=$1
profile=${2:-default}
user=${3:-"ec2-user"}
# KEYS=(`find ~/.ssh/*$profile*.pem | xargs -I {} echo "-i {}" | xargs`)
KEYS=(`find ~/.ssh/$profile.pem | xargs -I {} echo "-i {}" | xargs`)
echo $KEYS
CMD="xpanes -tsc \"SSM_PROFILE=$profile autossh -M 0 ${KEYS[@]} -o ServerAliveInterval=60 -o StrictHostKeyChecking=no $user@{}\" $(ecsInstanceIds $cluster $profile | xargs)"
eval $CMD
}
xasgSsh() {
cluster=$1
profile=${2:-default}
user=${3:-"ec2-user"}
key=${4:-$profile}
# KEYS=(`find ~/.ssh/*$profile*.pem | xargs -I {} echo "-i {}" | xargs`)
KEYS=(`find ~/.ssh/$key.pem | xargs -I {} echo "-i {}" | xargs`)
echo $KEYS
echo $(asgInstanceIds $cluster $profile | xargs)
CMD="xpanes -tsc \"SSM_PROFILE=$profile autossh -M 0 ${KEYS[@]} -o ServerAliveInterval=60 -o StrictHostKeyChecking=no $user@{}\" $(asgInstanceIds $cluster $profile | xargs)"
echo $CMD
# eval $CMD
}

View File

@@ -1,11 +0,0 @@
# https://github.com/Aloxaf/fzf-tab?tab=readme-ov-file#fzf-tab
zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':fzf-tab:*' fzf-command 'fzf-tmux'
zstyle ':fzf-tab:*' fzf-flags '-p 75%'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
zstyle ':fzf-tab:*' switch-group '<' '>'
LESSOPEN="|/opt/homebrew/bin/lesspipe.sh %s"; export LESSOPEN

View File

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

View File

@@ -1 +0,0 @@
fzf.zsh##os.Linux

View File

@@ -5,36 +5,3 @@ alias gfap='git pull --all -p'
alias lazygit='lazygit --use-config-file "$HOME/.config/lazygit/config.yml"'
alias lg='lazygit'
alias ly='lazygit --use-config-file "$HOME/.config/yadm/lazygit.yml,$HOME/.config/lazygit/config.yml" --work-tree ~ --git-dir ~/.local/share/yadm/repo.git'
function gctest () {
local branch="${1:-master}"
git merge --no-commit --no-ff $1
git merge --abort
}
function grcl () {
local branch="${1:-master}"
git checkout $branch
gfap
git remote prune origin
git branch -avv | grep "gone]" | awk '{ print $1 }' | xargs git branch -d;
}
unset gie
function gie () {
local email="${1:-ted@tedkulp.com}"
git init
git config user.email "$email"
git commit --allow-empty -m "Initial Commit"
}
# alias gie='git init && git commit --allow-empty -m "Initial commit"'
# alias __git-checkout_main=_git_checkout
# compdef _git grcl=git-checkout
alias grc="git branch --merged | grep -v '\*' | grep -v master | grep -v stage | xargs -n 1 git branch -d"
alias grcr="git fetch --all -p && git branch -r --merged | grep -v '\*' | grep origin | grep -v master | grep -v stage | sed 's/origin\//:/' | xargs -n 1 echo git push origin"

View File

@@ -1,2 +0,0 @@
export PATH="$HOME/go/bin:$PATH"
export GOPATH="$HOME/go"

View File

@@ -1,2 +0,0 @@
export PATH="$HOME/.gobrew/current/bin:$HOME/.gobrew/bin:$PATH"
export GOPATH="$HOME/.gobrew/current/go"

View File

@@ -1 +0,0 @@
go.zsh##os.Linux

View File

View File

@@ -1,3 +0,0 @@
function mosht () {
mosh $1 -- sh -c "tmux attach || tmux"
}

View File

@@ -1,44 +0,0 @@
# export NVM_DIR="$HOME/.nvm"
# declare -a NODE_GLOBALS=(`find $NVM_DIR/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
# NODE_GLOBALS+=("node")
# NODE_GLOBALS+=("nvm")
# load_nvm () {
# if [ -s "$NVM_DIR/nvm.sh" ]; then
# # These are the ones when using curl install
# [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# elif [ -x "$(command -v brew)" ]; then
# export NVM_PREFIX=$(brew --prefix nvm)
# # These are the homebrew ones
# [ -s "$NVM_PREFIX/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
# [ -s "$NVM_PREFIX/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# fi
# }
# for cmd in "${NODE_GLOBALS[@]}"; do
# eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }"
# done
# autoload -U add-zsh-hook
# load-nvmrc() {
# local node_version="$(nvm version)"
# local nvmrc_path="$(nvm_find_nvmrc)"
# if [ -n "$nvmrc_path" ]; then
# local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
# if [ "$nvmrc_node_version" = "N/A" ]; then
# nvm install
# elif [ "$nvmrc_node_version" != "$node_version" ]; then
# nvm use
# fi
# elif [ "$node_version" != "$(nvm version default)" ]; then
# echo "Reverting to nvm default version"
# nvm use default
# fi
# }
# add-zsh-hook chpwd load-nvmrc
# load-nvmrc

4
.config/zsh/openssl.zsh Normal file
View File

@@ -0,0 +1,4 @@
alias certinfo="openssl x509 -text -noout -in"
alias keyinfo="openssl rsa -text -noout -in"
alias keyinfo-rsa="openssl rsa -text -noout -in"
alias keyinfo-ec="openssl ec -text -noout -in"

View File

@@ -1 +0,0 @@
. $HOME/.cargo/env

View File

@@ -1 +0,0 @@
rust.zsh##os.Linux

View File

@@ -1,4 +0,0 @@
export STARSHIP_CONFIG=~/.config/starship/starship.toml
# Runs in .zshrc... no clue why
# eval "$(/usr/local/bin/starship init zsh)"

View File

@@ -1,8 +0,0 @@
# If we're not in tmux, make sure we're in xterm-256color
[[ ! -n $TMUX ]] && export TERM="xterm-256color"
# Some terminals like to set erase to ^H. Override it.
stty -g | grep "erase=8" > /dev/null
if [[ $? == 0 ]]; then
stty erase '^?'
fi

View File

@@ -1,35 +1,64 @@
# Aliases
alias xssh="xpanes --ssh"
alias tmux="tmux -2"
_tm.getCurrenSession() tmux display-message -p '#S'
# Function to get the current TMUX session
_tm_get_current_session() {
tmux display-message -p '#S'
}
# Function to attach or switch to a TMUX session
tm() {
local targetSession=${1:='main'}
local targetSession="${1:-main}"
# if outside tmux
[[ -z "$TMUX" ]] && tmux new -A -s ${targetSession} && return $?
# If outside tmux, start a new session or attach
if [[ -z "$TMUX" ]]; then
tmux new -A -s "$targetSession"
return $?
fi
if [[ "`_tm.getCurrenSession`" = "$targetSession" ]]
then print "You did not move."; return 1
fi
# If already in the target session, return
if [[ "$(_tm_get_current_session)" == "$targetSession" ]]; then
echo "You did not move."
return 1
fi
# Create session if it doesn't exists
tmux new -d -s ${targetSession} 2>/dev/null
# Create session if it doesn't exist
tmux new -d -s "$targetSession" 2>/dev/null
tmux switch-client -t ${targetSession}
# Switch to the target session
tmux switch-client -t "$targetSession"
}
# Function to complete tmux session names
_tm() {
(( $CURRENT > 2 )) && return 0
local tmuxList
tmuxList=($(tmux ls -F "#{session_name}" 2>/dev/null))
local tmuxList=( `tmux ls -F "#{session_name}"` )
# If outside tmux, complete with session list
if [[ -z "$TMUX" ]]; then
for session in "${tmuxList[@]}"; do
echo "$session"
done
return 0
fi
# if outside tmux
[[ -z "$TMUX" ]] && _describe 'command' tmuxList && return 0
local currentSession actualList=()
currentSession="$(_tm_get_current_session)"
local currentSession=( `_tm.getCurrenSession` )
local actualList=(${tmuxList:|currentSession})
_describe 'command' actualList
# Exclude the current session from the list
for session in "${tmuxList[@]}"; do
if [[ "$session" != "$currentSession" ]]; then
actualList+=("$session")
fi
done
for session in "${actualList[@]}"; do
echo "$session"
done
}
compdef _tm tm
# Register the function for tab completion
if (( $+functions[compdef] )); then
compdef '_tm' tm
fi

View File

@@ -1 +0,0 @@
alias fixvscode="sudo codesign --remove-signature /Applications/Visual\ Studio\ Code.app/Contents/Frameworks/Code\ Helper\ \(Renderer\).app/"