This commit is contained in:
Sage Vaillancourt 2024-01-22 19:46:41 -05:00
commit c283b58a18
9 changed files with 131 additions and 47 deletions

49
copy.sh
View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
echo "Initializing dotfiles..."
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
FAKE_HOME="$SCRIPT_DIR/fake_home" FAKE_HOME="$SCRIPT_DIR/fake_home"
export f="$FAKE_HOME" export f="$FAKE_HOME"
@ -16,8 +18,11 @@ dotdirs="$(find $FAKE_HOME -mindepth 1 -type d)"
echo "$dotdirs" | while read -r dotdir; do echo "$dotdirs" | while read -r dotdir; do
new="$HOME${dotdir:${#FAKE_HOME}}" new="$HOME${dotdir:${#FAKE_HOME}}"
if test -d "$new"; then
continue
fi
echo "mkdir -p $new" echo "mkdir -p $new"
mkdir -p $new mkdir -p "$new"
done done
@ -25,12 +30,15 @@ dotfiles="$(find $FAKE_HOME -mindepth 1 -type f)"
echo "$dotfiles" | while read -r dotfile; do echo "$dotfiles" | while read -r dotfile; do
new="$HOME${dotfile:${#FAKE_HOME}}" new="$HOME${dotfile:${#FAKE_HOME}}"
if [[ "$(realpath $dotfile)" == "$(realpath $new)" ]]; then
continue
fi
echo "$dotfile => $new" echo "$dotfile => $new"
ln -sf "$dotfile" "$new" ln -sf "$dotfile" "$new"
done done
function add-export { function add-export {
if ! grep "$1" "$HOME/.zsh_local"; then if ! grep "$1" "$HOME/.zsh_local" &> /dev/null; then
echo "$1\"$2\"" >> "$HOME/.zsh_local" echo "$1\"$2\"" >> "$HOME/.zsh_local"
fi fi
} }
@ -42,25 +50,19 @@ if [[ "$1" == "--files-only" ]]; then
exit 0 exit 0
fi fi
echo
echo "Installing required packages..."
echo -n "Rust is "
if ! command -v cargo &> /dev/null; then if ! command -v cargo &> /dev/null; then
echo "not installed. Installing..." echo "Rust is not installed. Installing..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
else
echo "already installed."
fi fi
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
if command -v cargo &> /dev/null && ! command -v bat &> /dev/null; then if command -v cargo &> /dev/null && ! command -v bat &> /dev/null; then
echo "Bat is not installed. Installing..."
cargo install bat cargo install bat
fi fi
echo -n "nvm is "
if ! test -d "$HOME/.nvm"; then if ! test -d "$HOME/.nvm"; then
echo "not installed. Installing..." echo "nvm is not installed. Installing..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
@ -69,57 +71,40 @@ if ! test -d "$HOME/.nvm"; then
nvm install 18 nvm install 18
nvm install node nvm install node
nvm use node nvm use node
else
echo "already installed."
fi fi
echo -n "dotnet is "
if ! command -v dotnet &> /dev/null; then if ! command -v dotnet &> /dev/null; then
echo "not installed. Installing..." echo "dotnet is not installed. Installing..."
wget https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh wget https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh
chmod +x /tmp/dotnet-install.sh chmod +x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh --version latest /tmp/dotnet-install.sh --version latest
rm /tmp/dotnet-install.sh rm /tmp/dotnet-install.sh
else
echo "already installed."
fi fi
echo -n "starship is "
if ! command -v starship &> /dev/null; then if ! command -v starship &> /dev/null; then
echo "not installed. Installing..." echo "starship is not installed. Installing..."
curl -sS https://starship.rs/install.sh | sh curl -sS https://starship.rs/install.sh | sh
else
echo "already installed."
fi fi
echo -n "JetBrains toolbox is "
if ! test -d $HOME/.config/JetBrains/; then if ! test -d $HOME/.config/JetBrains/; then
echo "not installed. Installing..." echo "JetBrains toolbox is not installed. Installing..."
ARCHIVE_URL="$(curl -s 'https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release' | grep -Po '"linux":.*?[^\\]",' | awk -F ':' '{print $3,":"$4}'| sed 's/[", ]//g')" ARCHIVE_URL="$(curl -s 'https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release' | grep -Po '"linux":.*?[^\\]",' | awk -F ':' '{print $3,":"$4}'| sed 's/[", ]//g')"
wget -q --show-progress -cO "/tmp/jetbrains-toolbox-latest.tar.gz" "$ARCHIVE_URL" wget -q --show-progress -cO "/tmp/jetbrains-toolbox-latest.tar.gz" "$ARCHIVE_URL"
cd /tmp/ cd /tmp/
tar -xvf jetbrains-toolbox-latest.tar.gz --strip-components=1 tar -xvf jetbrains-toolbox-latest.tar.gz --strip-components=1
chmod +x jetbrains-toolbox chmod +x jetbrains-toolbox
./jetbrains-toolbox ./jetbrains-toolbox
else
echo "already installed."
fi fi
mkdir -p "$HOME/.local/share/fonts" mkdir -p "$HOME/.local/share/fonts"
echo -n "FiraCode is "
if ! test -f "$HOME/.local/share/fonts/FiraCodeNerdFontMono-Medium.ttf"; then if ! test -f "$HOME/.local/share/fonts/FiraCodeNerdFontMono-Medium.ttf"; then
echo "not installed. Installing..." echo "FiraCode is not installed. Installing..."
wget -O /tmp/firacode.zip "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip" wget -O /tmp/firacode.zip "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip"
unzip -d "$HOME/.local/share/fonts" /tmp/firacode.zip unzip -d "$HOME/.local/share/fonts" /tmp/firacode.zip
rm /tmp/firacode.zip rm /tmp/firacode.zip
fc-cache -f -v fc-cache -f -v
else
echo "already installed."
fi fi
if ! command -v fzf &> /dev/null; then if ! command -v fzf &> /dev/null; then
echo "You may wish to install fzf for sofi and other search" echo "You may wish to install fzf for sofi and other search"
else
echo "fzf is already installed"
fi fi

View File

@ -1,4 +1,3 @@
add_newline = true
format = """ format = """
$git_status\ $git_status\
${custom.username}\ ${custom.username}\

View File

@ -3,27 +3,27 @@
email = sage@sagev.space email = sage@sagev.space
[core] [core]
autocrlf = input autocrlf = input
excludesfile = ~/.gitignore excludesfile = ~/.gitignore
hooksPath = ~/.githooks hooksPath = ~/.githooks
[credential] [credential]
helper = store helper = store
[push] [push]
default = current default = current
followTags = true followTags = true
[help] [help]
autocorrect = 1 autocorrect = 1
[include] [include]
path = ~/.gitlocal path = ~/.gitlocal
[init] [init]
defaultBranch = main defaultBranch = main
[commit] [commit]
verbose = true verbose = true
[pull] [pull]
rebase = false rebase = false
[protocol "file"] [protocol "file"]

View File

@ -7,6 +7,7 @@ import sys
home = os.environ['HOME'] home = os.environ['HOME']
git_dirs = [ git_dirs = [
home + "/projects", home + "/projects",
home + "/git/team",
home + "/git", home + "/git",
home + "/git/worktrees", home + "/git/worktrees",
home + "/WebStormProjects", home + "/WebStormProjects",

View File

@ -8,6 +8,22 @@ else
alias pacman="sudo pacman" alias pacman="sudo pacman"
fi fi
function integrate {
local from="$(realpath $1)"
if [[ "$from" == "$f"* ]]; then
echo "File is already in $f"
return 1
fi
local to="${from/${HOME}/${f}}"
local sec=3
echo "mv '$from' '$to' in $sec seconds"
sleep $sec
mv -n "$from" "$to" || return 1
cd $DOT_DIR || return 1
./copy.sh
cd -
}
function ishelp { function ishelp {
[[ "$1" == "help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] [[ "$1" == "help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]
} }
@ -30,6 +46,16 @@ function hearch {
history 0 | sed 's/[0-9 ]*//' | grep "$@" history 0 | sed 's/[0-9 ]*//' | grep "$@"
} }
function kubelog {
local pods="$(kubectl get pods | grep "$1")"
local selection="1"
if [[ "$2" != "" ]]; then
selection="$2"
fi
local pod="$(echo "$pods" | awk '{print $1}' | head -n $selection | tail -n 1)"
kubectl logs -f "$pod"
}
alias j='journalctl -xefu' alias j='journalctl -xefu'
alias hsearch='hearch' alias hsearch='hearch'
alias d='docker' alias d='docker'

View File

@ -0,0 +1,33 @@
# This is a TOML document
title = "TOML Example"
[owner]
name = "Sage Vaillancourt"
dob = 1996-08-02T07:32:00-08:00
[database]
enabled = true
ports = [ 8000, 8001, 8002 ]
data = [ ["delta", "phi"], [3.14, 1.312] ]
temp_targets = { cpu = 79.5, case = 72.0 }
[servers] # Not strictly necessary. servers.<x> implicitly creates the 'servers' table
[servers.alpha]
ip = "10.0.0.1"
role = "frontend"
[servers.beta]
ip = "10.0.0.2"
role = "backend"
# Array of tables
[[users]]
name = "Sage"
color = "pink"
[[users]]
name = "Willow"
color = "teal"

View File

@ -0,0 +1,34 @@
---
apiVersion: v3
kind: Pod
metadata:
name: Some example YAML
spec:
simpleList:
- "Hello"
- "World!"
listOfMaps:
- name: front-end
image: nginx
ports:
- containerPort: 80
- name: web-reader
image: web-reader-engine
ports:
- containerPort: 88
---
aSecondDocument: In the same file!
preserveNewlines: |
Each of these
newlines will be
broken up.
autoWrap: >
This text is wrapped
and will be formed into
a single paragraph with
a trailing newline.

View File

@ -173,6 +173,8 @@ if has ("autocmd")
autocmd BufNewFile *.jsx 0r ~/.vim/templates/skeleton.jsx autocmd BufNewFile *.jsx 0r ~/.vim/templates/skeleton.jsx
autocmd BufNewFile *.tsx 0r ~/.vim/templates/skeleton.tsx autocmd BufNewFile *.tsx 0r ~/.vim/templates/skeleton.tsx
autocmd BufNewFile *.json 0r ~/.vim/templates/skeleton.json autocmd BufNewFile *.json 0r ~/.vim/templates/skeleton.json
autocmd BufNewFile *.toml 0r ~/.vim/templates/skeleton.toml
autocmd BufNewFile *.yaml 0r ~/.vim/templates/skeleton.yaml
autocmd BufNewFile *.go 0r ~/.vim/templates/skeleton.go autocmd BufNewFile *.go 0r ~/.vim/templates/skeleton.go
autocmd BufNewFile Makefile 0r ~/.vim/templates/Makefile autocmd BufNewFile Makefile 0r ~/.vim/templates/Makefile
autocmd BufNewFile Dockerfile 0r ~/.vim/templates/Dockerfile autocmd BufNewFile Dockerfile 0r ~/.vim/templates/Dockerfile

View File

@ -3,7 +3,7 @@ if test -f /usr/share/doc/fzf/examples/completion.zsh &> /dev/null; then
fi fi
HISTFILE=~/.histfile HISTFILE=~/.histfile
HISTSIZE=SAVEHIST=100000 HISTSIZE=SAVEHIST=100000000
setopt appendhistory autocd notify setopt appendhistory autocd notify
setopt menu_complete setopt menu_complete
unsetopt beep unsetopt beep
@ -38,7 +38,7 @@ fi
export PATH=~/.bin:$HOME/.dotnet:~/.local/bin:/usr/local/go/bin:$PATH export PATH=~/.bin:$HOME/.dotnet:~/.local/bin:/usr/local/go/bin:$PATH
fignore=(o) fignore=(o class swp)
function SetTtyColors() { function SetTtyColors() {
echo -en "\e]P0""2c2d27" # black 1 echo -en "\e]P0""2c2d27" # black 1
@ -87,8 +87,11 @@ if which starship &> /dev/null; then
eval "$(starship init zsh)" eval "$(starship init zsh)"
fi fi
if test -f ~/.cargo/env; then last_get_file="/tmp/.$(whoami)-dotfiles-last-get"
source ~/.cargo/env current_date="$(date '+%Y-%m-%d')"
if test -d "$DOT_DIR" && [[ "$current_date" != "$(cat "$last_get_file")" ]] &> /dev/null; then
echo "$current_date" > "$last_get_file"
getdot
fi fi
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
@ -97,3 +100,4 @@ export NVM_DIR="$HOME/.nvm"
test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh && source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh && source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
test -f "$HOME/.asdf/asdf.sh" && . "$HOME/.asdf/asdf.sh" test -f "$HOME/.asdf/asdf.sh" && . "$HOME/.asdf/asdf.sh"
test -f ~/.cargo/env && source ~/.cargo/env