From 7f37afdf70b88d6c741fdcdec0542b5f6a95fd96 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 28 Oct 2019 10:18:26 -0700 Subject: [PATCH 01/48] Customize for github.com --- .gitconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitconfig b/.gitconfig index c020c8c..a6ee2ce 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,6 +1,6 @@ [user] name = Sam - email = sam@ + email = sam.rossoff@gremlin.com [push] default = current [merge] @@ -91,8 +91,8 @@ [rerere] enabled = 1 -[url "git@github.sc-corp.net:"] - insteadOf = https://github.sc-corp.net/ +[url "git@github.com:"] + insteadOf = https://github.com/ [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f From f6da5bf8c9c9aa5cefeb24113be49535ec59035a Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 28 Oct 2019 15:44:42 -0700 Subject: [PATCH 02/48] bitbucket mapping --- .gitconfig | 2 ++ .ideavimrc | 1 + 2 files changed, 3 insertions(+) diff --git a/.gitconfig b/.gitconfig index a6ee2ce..b98f24d 100644 --- a/.gitconfig +++ b/.gitconfig @@ -93,6 +93,8 @@ [url "git@github.com:"] insteadOf = https://github.com/ +[url "git@bitbucket.org:"] + insteadOf = https://gremsam@bitbucket.org/ [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f diff --git a/.ideavimrc b/.ideavimrc index aea6d95..fe3742a 100644 --- a/.ideavimrc +++ b/.ideavimrc @@ -1 +1,2 @@ source ~/.vimrc +set ideajoin \ No newline at end of file From d70bf7bd7e5e772959181bcaff1d623f72de8e1d Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 1 Nov 2019 10:19:33 -0700 Subject: [PATCH 03/48] Add zshrc --- .zshrc | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .zshrc diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..f870786 --- /dev/null +++ b/.zshrc @@ -0,0 +1,107 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="/Users/sam/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS=true + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in ~/.oh-my-zsh/plugins/* +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git + vi-mode +) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +export LANG=en_US.UTF-8 + +export EDITOR='vim' + +# Coreutils to override with GNU tools +export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" + +# My local setup +export PATH="$HOME/bin:$PATH" + +eval $(minikube docker-env) + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +[ -e ~/.aliases ] && . ~/.aliases From 9bf34690757f18686a4101cada9ac735d6221810 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 1 Nov 2019 10:19:45 -0700 Subject: [PATCH 04/48] Cleanup --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7d26c67..999473c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -# Only track files that start in . +# Opt-In for tracking * -.snapaccess.yml From 0c1c71b24773b1386569b5b566116eaa2aef84c2 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 1 Nov 2019 10:19:56 -0700 Subject: [PATCH 05/48] Some of our projects are not conducive to dynamic loading --- .gradle/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gradle/gradle.properties b/.gradle/gradle.properties index 6668f8b..4af927b 100644 --- a/.gradle/gradle.properties +++ b/.gradle/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx9000M org.gradle.caching=true -org.gradle.configureondemand=true +#org.gradle.configureondemand=true org.gradle.daemon=true org.gradle.parallel=true From ec5a29038d2f8e12bd23e6052507a2ab8282bb08 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 1 Nov 2019 10:37:32 -0700 Subject: [PATCH 06/48] Split out zshrc --- .zshrc | 116 ++++---------------------------- .zshrc.d/00_oh_my_zsh.zsh | 17 +++++ .zshrc.d/02_environment.zsh | 4 ++ .zshrc.d/05_aliases.zsh | 4 ++ .zshrc.d/07_path.zsh | 15 +++++ .zshrc.d/08_minikube_config.zsh | 10 +++ 6 files changed, 63 insertions(+), 103 deletions(-) create mode 100644 .zshrc.d/00_oh_my_zsh.zsh create mode 100644 .zshrc.d/02_environment.zsh create mode 100644 .zshrc.d/05_aliases.zsh create mode 100644 .zshrc.d/07_path.zsh create mode 100644 .zshrc.d/08_minikube_config.zsh diff --git a/.zshrc b/.zshrc index f870786..31ffcaa 100644 --- a/.zshrc +++ b/.zshrc @@ -1,107 +1,17 @@ -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH -# Path to your oh-my-zsh installation. -export ZSH="/Users/sam/.oh-my-zsh" +# Fix when setenv isn't available, should probably just move to export at some +# point. +setenv() { + export $1=$2 +} -# Set name of the theme to load --- if set to "random", it will -# load a random theme each time oh-my-zsh is loaded, in which case, -# to know which specific one was loaded, run: echo $RANDOM_THEME -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -ZSH_THEME="robbyrussell" +if [[ -z $ZSH_VERSION ]] +then + ZSH_VERSION=`$SHELL --version | /usr/bin/cut -d ' ' -f 2` +fi -# Set list of themes to pick from when loading at random -# Setting this variable when ZSH_THEME=random will cause zsh to load -# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ -# If set to an empty array, this variable will have no effect. -# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) +# Source all files in .zshrc.d +foreach i (`ls -1 ~/.zshrc.d/*.zsh`) { + source $i +} -# Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. -# Case-sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" - -# Uncomment the following line to disable bi-weekly auto-update checks. -# DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to automatically update without prompting. -# DISABLE_UPDATE_PROMPT="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 - -# Uncomment the following line if pasting URLs and other text is messed up. -# DISABLE_MAGIC_FUNCTIONS=true - -# Uncomment the following line to disable colors in ls. -# DISABLE_LS_COLORS="true" - -# Uncomment the following line to disable auto-setting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -# COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# You can set one of the optional three formats: -# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# or set a custom format using the strftime function format specifications, -# see 'man strftime' for details. -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - -# Which plugins would you like to load? -# Standard plugins can be found in ~/.oh-my-zsh/plugins/* -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - git - vi-mode -) - -source $ZSH/oh-my-zsh.sh - -# User configuration - -# export MANPATH="/usr/local/man:$MANPATH" - -# You may need to manually set your language environment -export LANG=en_US.UTF-8 - -export EDITOR='vim' - -# Coreutils to override with GNU tools -export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" - -# My local setup -export PATH="$HOME/bin:$PATH" - -eval $(minikube docker-env) - -# Compilation flags -# export ARCHFLAGS="-arch x86_64" - -# Set personal aliases, overriding those provided by oh-my-zsh libs, -# plugins, and themes. Aliases can be placed here, though oh-my-zsh -# users are encouraged to define aliases within the ZSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" - -[ -e ~/.aliases ] && . ~/.aliases diff --git a/.zshrc.d/00_oh_my_zsh.zsh b/.zshrc.d/00_oh_my_zsh.zsh new file mode 100644 index 0000000..e0c12c2 --- /dev/null +++ b/.zshrc.d/00_oh_my_zsh.zsh @@ -0,0 +1,17 @@ +export ZSH="/Users/sam/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +ZSH_THEME="robbyrussell" + +# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Example format: plugins=(rails git textmate ruby lighthouse) +#plugins=(git ruby github nyan python perl vi-mode django) +plugins=(git ruby python perl vi-mode frontend-search brew npm heroku) + +source $ZSH/oh-my-zsh.sh + +# Plugin configurations + diff --git a/.zshrc.d/02_environment.zsh b/.zshrc.d/02_environment.zsh new file mode 100644 index 0000000..b49fd90 --- /dev/null +++ b/.zshrc.d/02_environment.zsh @@ -0,0 +1,4 @@ +# You may need to manually set your language environment +export LANG=en_US.UTF-8 + +export EDITOR='vim' diff --git a/.zshrc.d/05_aliases.zsh b/.zshrc.d/05_aliases.zsh new file mode 100644 index 0000000..1230572 --- /dev/null +++ b/.zshrc.d/05_aliases.zsh @@ -0,0 +1,4 @@ +# Load aliases from a shell independent file +[ -e ~/.aliases ] && . ~/.aliases + +# Include zsh specific aliases below diff --git a/.zshrc.d/07_path.zsh b/.zshrc.d/07_path.zsh new file mode 100644 index 0000000..61ff94e --- /dev/null +++ b/.zshrc.d/07_path.zsh @@ -0,0 +1,15 @@ +path=( + $HOME/bin #If I wrote it, I want it + /usr/local/opt/coreutils/libexec/gnubin #Core utils first to get GNU versions + /usr/local/bin # Local bin ahead of path so it can override + $PATH + /usr/local/symlinks + /usr/local/scripts + /usr/local/buildtools/java/jdk/bin + /usr/local/sbin + /usr/local/bin + /usr/sbin + /usr/bin + /sbin + /bin +) diff --git a/.zshrc.d/08_minikube_config.zsh b/.zshrc.d/08_minikube_config.zsh new file mode 100644 index 0000000..9f93ab8 --- /dev/null +++ b/.zshrc.d/08_minikube_config.zsh @@ -0,0 +1,10 @@ +if [ "$(minikube status | grep -c Stopped)" -ge 1 ]; then + minikube start +fi + +if [ "$(minikube status | grep -c Stopped)" -ge 1 ]; then + echo "Unable to start minikube, docker not setup" +else + eval $(minikube docker-env) +fi + From 959e505df83cffc7eb51e5aba0d8e65b7ca6f64c Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 11 Nov 2019 10:22:37 -0800 Subject: [PATCH 07/48] I forget how ls colors work --- .zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 31ffcaa..8ae0215 100644 --- a/.zshrc +++ b/.zshrc @@ -11,7 +11,7 @@ then fi # Source all files in .zshrc.d -foreach i (`ls -1 ~/.zshrc.d/*.zsh`) { +foreach i (`ls -1 ~/.zshrc.d/*.zsh | gsed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"`) { source $i } From b996f9b001072d7358f1e0af8afcc5964676f0f5 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 11 Nov 2019 10:23:08 -0800 Subject: [PATCH 08/48] Disable this until I can figure out what broke --- .zshrc.d/08_minikube_config.zsh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.zshrc.d/08_minikube_config.zsh b/.zshrc.d/08_minikube_config.zsh index 9f93ab8..2e07d04 100644 --- a/.zshrc.d/08_minikube_config.zsh +++ b/.zshrc.d/08_minikube_config.zsh @@ -1,10 +1,12 @@ -if [ "$(minikube status | grep -c Stopped)" -ge 1 ]; then - minikube start -fi -if [ "$(minikube status | grep -c Stopped)" -ge 1 ]; then - echo "Unable to start minikube, docker not setup" -else - eval $(minikube docker-env) -fi +# Until I can get this sorted +#if [ "$(minikube status | grep -c Stopped)" -ge 1 ]; then +# minikube start +#fi +# +#if [ "$(minikube status | grep -c Stopped)" -ge 1 ]; then +# echo "Unable to start minikube, docker not setup" +#else +# eval $(minikube docker-env) +#fi From f8243dae004c35996d0e76da64836cd761761c48 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 11 Nov 2019 10:23:29 -0800 Subject: [PATCH 09/48] Fish/zsh compat --- bin/and | 8 ++++++++ bin/or | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100755 bin/and create mode 100755 bin/or diff --git a/bin/and b/bin/and new file mode 100755 index 0000000..3071a5c --- /dev/null +++ b/bin/and @@ -0,0 +1,8 @@ +#!/bin/zsh + +if [ ! $? -eq 0 ]; then + exit $? +fi + +exec ${@:1} +exit $? diff --git a/bin/or b/bin/or new file mode 100755 index 0000000..390a4b5 --- /dev/null +++ b/bin/or @@ -0,0 +1,8 @@ +#!/bin/zsh + +if [ $? -eq 0 ]; then + exit $? +fi + +exec ${@:1} +exit $? From cf59f9a0e04368ab3663d88cdf9a94c8326cb3e6 Mon Sep 17 00:00:00 2001 From: Sam <57107087+gremsam@users.noreply.github.com> Date: Mon, 11 Nov 2019 10:27:36 -0800 Subject: [PATCH 10/48] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34af5ae..d42170a 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ Requires brew or some other means of installing fish: Example ======== -![Example of it in action](https://github.sc-corp.net/sam/homebase/blob/master/example.png?raw=true) +![Example of it in action](https://github.com/gremsam/homebase/blob/master/example.png?raw=true) From 3587bf7733edddfed32e557ca0d1e5e3cccbd136 Mon Sep 17 00:00:00 2001 From: Sam <57107087+gremsam@users.noreply.github.com> Date: Mon, 11 Nov 2019 10:28:28 -0800 Subject: [PATCH 11/48] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d42170a..623eb29 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Requires brew or some other means of installing fish: ``` % brew install fish % cd ~ -% git clone git@github.sc-corp.net:sam/homebase.git +% git clone git@github.com:gremsam/homebase.git % mv ~/homebase/* ~ % mv ~/homebase/.git ~ ``` From e14c63d0c7a2e9131804fd36e28c835ae91c2762 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 11 Nov 2019 10:40:44 -0800 Subject: [PATCH 12/48] Fix home reference --- .config/fish/config.fish | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/fish/config.fish b/.config/fish/config.fish index e154072..385cabe 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -19,18 +19,18 @@ set SHELL /usr/local/bin/fish # Path to Oh My Fish install. -set -gx OMF_PATH "/Users/samrossoff/.local/share/omf" +set -gx OMF_PATH "$HOME/.local/share/omf" # Customize Oh My Fish configuration path. -#set -gx OMF_CONFIG "/Users/samrossoff/.config/omf" +#set -gx OMF_CONFIG "$HOME/.config/omf" # Load oh-my-fish configuration. source $OMF_PATH/init.fish set -g fish_key_bindings fish_vi_key_bindings -set PATH /Users/samrossoff/bin $PATH /opt/pkgconfig/bin /Users/samrossoff/google-cloud-sdk/bin /Users/samrossoff/play-1.2.5.3 -set APPENGINE_HOME /Users/samrossoff/appengine-java-sdk-1.9.34 +set PATH $HOME/bin $PATH /opt/pkgconfig/bin $HOME/google-cloud-sdk/bin $HOME/play-1.2.5.3 +set APPENGINE_HOME $HOME/appengine-java-sdk-1.9.34 # BUCK #set PATH /usr/local/opt/buck/bin $PATH From 77381c0a7ab1a142b4931c6ce0fcf3813bcfc0bd Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Mar 2020 05:16:12 -0700 Subject: [PATCH 13/48] New Aliases --- .aliases | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.aliases b/.aliases index 49b5c6f..bdbef9f 100644 --- a/.aliases +++ b/.aliases @@ -73,3 +73,13 @@ alias rg='rg --hidden' # https://twitter.com/natfriedman/status/1137094384170799104 alias agame='c=12322123;x=20;y=20;while read -sn1 p;do k=${c:$(((p-1)*2)):2};let x+=$(($k/10-2));let y+=$(($k%10-2));echo -en \\033[$y\;"$x"HX;done' + + +# pwdx +alias pwdx='f(){ lsof -p "$@" | grep cwd; }; f' + +# EC2 key fingerprint +alias aws_fingerprint='f(){ ssh-keygen -ef "$@" -m PEM | openssl rsa -RSAPublicKey_in -outform DER | openssl md5 -c; }; f' + +# urlencod a string via perl +alias url_encode="perl -MURI::Escape -e 'print uri_escape(\$ARGV[0]);'" From a39604d2a7e01580e14c600041ac1e2b9d7ec47c Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Mar 2020 05:18:35 -0700 Subject: [PATCH 14/48] envI --- .zshrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.zshrc b/.zshrc index 8ae0215..545679c 100644 --- a/.zshrc +++ b/.zshrc @@ -15,3 +15,6 @@ foreach i (`ls -1 ~/.zshrc.d/*.zsh | gsed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?) source $i } +# I'm leaving this here for now, but it really should be somehwere else +if [ -f "$HOME/.env-improvement/shellhook.sh" ]; then . "$HOME/.env-improvement/shellhook.sh"; fi # [[EI SHELL SETUP]] + From b16ed2c2214560610d4984b32342cc7dce1d5723 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Mar 2020 05:20:53 -0700 Subject: [PATCH 15/48] Setup gcloud sdk --- .zshrc.d/07_path.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.zshrc.d/07_path.zsh b/.zshrc.d/07_path.zsh index 61ff94e..ef9f564 100644 --- a/.zshrc.d/07_path.zsh +++ b/.zshrc.d/07_path.zsh @@ -3,6 +3,7 @@ path=( /usr/local/opt/coreutils/libexec/gnubin #Core utils first to get GNU versions /usr/local/bin # Local bin ahead of path so it can override $PATH + $HOME/.cargo/bin /usr/local/symlinks /usr/local/scripts /usr/local/buildtools/java/jdk/bin @@ -13,3 +14,9 @@ path=( /sbin /bin ) + +# The next line updates PATH for the Google Cloud SDK. +if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then . "$HOME/google-cloud-sdk/path.zsh.inc"; fi + +# The next line enables shell command completion for gcloud. +if [ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ]; then . "$HOME/google-cloud-sdk/completion.zsh.inc"; fi From 13b39c56a7c379459844000b81ae45d717cf60b8 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Mar 2020 05:21:04 -0700 Subject: [PATCH 16/48] Vim Replace! --- .vimrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vimrc b/.vimrc index 603c179..662c953 100644 --- a/.vimrc +++ b/.vimrc @@ -49,6 +49,9 @@ Plugin 'bkad/CamelCaseMotion' Plugin 'tpope/vim-git' Plugin 'jiangmiao/auto-pairs' Plugin 'SirVer/ultisnips' +" OMG FINALLY!!!! +Plugin 'vim-scripts/ReplaceWithRegister' +Plugin 'tommcdo/vim-exchange' " Snippets are separated from the engine. Add this if you want them: Plugin 'honza/vim-snippets' From c761b3b503461300afd646702d4040de172df487 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Mar 2020 05:22:41 -0700 Subject: [PATCH 17/48] Useful Pods --- workspace/useful-pods/dns-pod.yaml | 23 ++++++++++ workspace/useful-pods/double-sleep.yaml | 57 +++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 workspace/useful-pods/dns-pod.yaml create mode 100644 workspace/useful-pods/double-sleep.yaml diff --git a/workspace/useful-pods/dns-pod.yaml b/workspace/useful-pods/dns-pod.yaml new file mode 100644 index 0000000..8ef2928 --- /dev/null +++ b/workspace/useful-pods/dns-pod.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dnsutils + namespace: default +spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchFields: + - key: metadata.name + operator: In + values: + - ip-10-0-1-66.ec2.internal + containers: + - name: dnsutils + image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3 + command: + - sleep + - "3600" + imagePullPolicy: IfNotPresent + restartPolicy: Always diff --git a/workspace/useful-pods/double-sleep.yaml b/workspace/useful-pods/double-sleep.yaml new file mode 100644 index 0000000..36fcdf3 --- /dev/null +++ b/workspace/useful-pods/double-sleep.yaml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + name: double-busybox-sleep + namespace: default +spec: + containers: + - args: + - sleep + - "1000000" + image: busybox + imagePullPolicy: Always + name: busybox + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-llc5r + readOnly: true + - args: + - sleep + - "100000" + image: busybox + imagePullPolicy: Always + name: busybox-faster + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-llc5r + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-llc5r + secret: + defaultMode: 420 + secretName: default-token-llc5r From 60174e79a84921e08496433d35d6ac2ec21636a3 Mon Sep 17 00:00:00 2001 From: Sam <57107087+gremsam@users.noreply.github.com> Date: Wed, 25 Mar 2020 05:24:00 -0700 Subject: [PATCH 18/48] Update README.md --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 623eb29..f9cf7cb 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,15 @@ homebase ======== Based off of: https://github.com/benbernard/HomeDir -I've minimized the features I want, and configured it for the "fish" shell +I've minimized the features I want Installation ======== -Requires brew or some other means of installing fish: + ``` -% brew install fish % cd ~ % git clone git@github.com:gremsam/homebase.git % mv ~/homebase/* ~ % mv ~/homebase/.git ~ ``` - -Example -======== - -![Example of it in action](https://github.com/gremsam/homebase/blob/master/example.png?raw=true) From 3732dc52c397b836bf019fb2d7562c8ab217717e Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Mar 2020 05:31:26 -0700 Subject: [PATCH 19/48] Fix location --- .bazelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 3a1531e..04792f1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1 +1 @@ -build --google_credentials=/Users/samrossoff/.config/gcloud/application_default_credentials.json +build --google_credentials=/Users/sam/.config/gcloud/application_default_credentials.json From f1059cab1d28f6ad18b56a7573102654be9975b8 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 13 Apr 2020 14:42:09 -0700 Subject: [PATCH 20/48] iso_date --- .aliases | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.aliases b/.aliases index bdbef9f..1587d99 100644 --- a/.aliases +++ b/.aliases @@ -83,3 +83,6 @@ alias aws_fingerprint='f(){ ssh-keygen -ef "$@" -m PEM | openssl rsa -RSAPublic # urlencod a string via perl alias url_encode="perl -MURI::Escape -e 'print uri_escape(\$ARGV[0]);'" + +# ISO 8601 date +alias iso_date='date -u +"%Y-%m-%dT%H:%M:%SZ"' From 156ee4638fa61fce7e045550eedfb0813df20b81 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 6 May 2020 14:00:55 -0700 Subject: [PATCH 21/48] Add escape pod --- workspace/useful-pods/double-sleep.yaml | 8 ----- workspace/useful-pods/escape-pod.yaml | 45 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 workspace/useful-pods/escape-pod.yaml diff --git a/workspace/useful-pods/double-sleep.yaml b/workspace/useful-pods/double-sleep.yaml index 36fcdf3..fe739a1 100644 --- a/workspace/useful-pods/double-sleep.yaml +++ b/workspace/useful-pods/double-sleep.yaml @@ -15,10 +15,6 @@ spec: resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - name: default-token-llc5r - readOnly: true - args: - sleep - "100000" @@ -28,10 +24,6 @@ spec: resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File - volumeMounts: - - mountPath: /var/run/secrets/kubernetes.io/serviceaccount - name: default-token-llc5r - readOnly: true dnsPolicy: ClusterFirst enableServiceLinks: true priority: 0 diff --git a/workspace/useful-pods/escape-pod.yaml b/workspace/useful-pods/escape-pod.yaml new file mode 100644 index 0000000..0dac36d --- /dev/null +++ b/workspace/useful-pods/escape-pod.yaml @@ -0,0 +1,45 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + name: escape-pod + namespace: default +spec: + containers: + - args: + - sleep + - "1000000" + image: busybox + imagePullPolicy: Always + name: busybox + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /host + name: host + securityContext: + privileged: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: host + hostPath: + path: / + type: Directory From 84b9254cd5257f3d2a2f32e9d7029831740eb324 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 14 May 2020 11:11:07 -0700 Subject: [PATCH 22/48] Simple echo service for demonstrating k8s ingress --- workspace/useful-pods/simple-webservice.yaml | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 workspace/useful-pods/simple-webservice.yaml diff --git a/workspace/useful-pods/simple-webservice.yaml b/workspace/useful-pods/simple-webservice.yaml new file mode 100644 index 0000000..063279e --- /dev/null +++ b/workspace/useful-pods/simple-webservice.yaml @@ -0,0 +1,53 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: echoserver +spec: + selector: + matchLabels: + app: echoserver + replicas: 1 + template: + metadata: + labels: + app: echoserver + spec: + containers: + - image: gcr.io/google_containers/echoserver:1.4 + imagePullPolicy: Always + name: echoserver + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: echoserver +spec: + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + type: NodePort + selector: + app: echoserver +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: echoserver + annotations: + kubernetes.io/ingress.class: alb + alb.ingress.kubernetes.io/target-type: instance + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/tags: Environment=dev,Team=sam +spec: + rules: + - host: a4e864e4-default-echoserve-3ea3-1161778277.us-west-1.elb.amazonaws.com + http: + paths: + - path: / + backend: + serviceName: echoserver + servicePort: 80 From 6ebf1cc7be1ac9616300b3f424fa3b8ff2ae5f01 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 20 Aug 2020 11:38:20 -0700 Subject: [PATCH 23/48] New aliases --- .aliases | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.aliases b/.aliases index 1587d99..bb305f8 100644 --- a/.aliases +++ b/.aliases @@ -86,3 +86,11 @@ alias url_encode="perl -MURI::Escape -e 'print uri_escape(\$ARGV[0]);'" # ISO 8601 date alias iso_date='date -u +"%Y-%m-%dT%H:%M:%SZ"' + +# Run a pod in your cluster with sh +alias kubectl_ssh="kubectl run -it --rm --restart=Never alpine --image=alpine sh" + + +# Find and edit +alias rgedit='f(){ vim -p $(rg -l "$@"); unset -f f; }; f' + From af343fc08ff64dccf33e831cd5f73ead5dae6c8f Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 20 Aug 2020 11:38:55 -0700 Subject: [PATCH 24/48] setup history --- .zshrc.d/02_environment.zsh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.zshrc.d/02_environment.zsh b/.zshrc.d/02_environment.zsh index b49fd90..c1b6928 100644 --- a/.zshrc.d/02_environment.zsh +++ b/.zshrc.d/02_environment.zsh @@ -2,3 +2,18 @@ export LANG=en_US.UTF-8 export EDITOR='vim' + + +# Setup history +export HISTFILE=~/.zsh_history +export HISTFILESIZE=1000000000 +export HISTSIZE=1000000000 + +setopt INC_APPEND_HISTORY +export HISTTIMEFORMAT="[%F %T] " + +# Don't find dups (note, I still write them) +setopt HIST_FIND_NO_DUPS + +# setup Github token +export GITHUB_TOKEN=`cat ~/.config/gh/github.token` From 807dbba3211befde4efdb476f85693b1f51cb668 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 23 Nov 2020 11:34:16 -0800 Subject: [PATCH 25/48] Setup Minikube host address for dns --- .zshrc.d/08_minikube_config.zsh | 7 +++++++ workspace/useful-pods/minikube-host.yaml | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 workspace/useful-pods/minikube-host.yaml diff --git a/.zshrc.d/08_minikube_config.zsh b/.zshrc.d/08_minikube_config.zsh index 2e07d04..bb77790 100644 --- a/.zshrc.d/08_minikube_config.zsh +++ b/.zshrc.d/08_minikube_config.zsh @@ -10,3 +10,10 @@ # eval $(minikube docker-env) #fi +CURRENT_CONTEXT=$(kubectl config current-context) + +[ "${CURRENT_CONTEXT}" = "minikube" ] || kubectl config use-context minikube + +kubectl apply -f ~/workspace/useful-pods/minikube-host.yaml + +[ "${CURRENT_CONTEXT}" = "minikube" ] || kubectl config use-context "${CURRENT_CONTEXT}" diff --git a/workspace/useful-pods/minikube-host.yaml b/workspace/useful-pods/minikube-host.yaml new file mode 100644 index 0000000..e69d761 --- /dev/null +++ b/workspace/useful-pods/minikube-host.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: local-host + namespace: gremlin +spec: + type: ClusterIP + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 +--- +apiVersion: v1 +kind: Endpoints +metadata: + name: local-host + namespace: gremlin +subsets: + - addresses: + - ip: 192.168.64.1 + ports: + - port: 8080 From 3ad84fcf8cf2a47c2b256cf01aabe5fb973b06fa Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 20 Apr 2021 15:46:10 -0700 Subject: [PATCH 26/48] Minor updates --- .gitconfig | 2 ++ .zshrc | 1 + 2 files changed, 3 insertions(+) diff --git a/.gitconfig b/.gitconfig index b98f24d..b07e65b 100644 --- a/.gitconfig +++ b/.gitconfig @@ -100,3 +100,5 @@ smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true +[pull] + ff = only diff --git a/.zshrc b/.zshrc index 545679c..0e4d544 100644 --- a/.zshrc +++ b/.zshrc @@ -18,3 +18,4 @@ foreach i (`ls -1 ~/.zshrc.d/*.zsh | gsed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?) # I'm leaving this here for now, but it really should be somehwere else if [ -f "$HOME/.env-improvement/shellhook.sh" ]; then . "$HOME/.env-improvement/shellhook.sh"; fi # [[EI SHELL SETUP]] +export PATH=~/bin:$PATH From a17aa4060d05780c1cb643161bf9e3ff29b594ef Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 26 Apr 2021 10:48:11 -0700 Subject: [PATCH 27/48] Add debug mode --- .zshrc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.zshrc b/.zshrc index 0e4d544..5d435ae 100644 --- a/.zshrc +++ b/.zshrc @@ -1,4 +1,3 @@ - # Fix when setenv isn't available, should probably just move to export at some # point. setenv() { @@ -11,11 +10,15 @@ then fi # Source all files in .zshrc.d -foreach i (`ls -1 ~/.zshrc.d/*.zsh | gsed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"`) { - source $i -} +if [[ -z $ZSH_DEBUG ]] +then + foreach i (`ls -1 ~/.zshrc.d/*.zsh | gsed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"`) { + source $i + } -# I'm leaving this here for now, but it really should be somehwere else -if [ -f "$HOME/.env-improvement/shellhook.sh" ]; then . "$HOME/.env-improvement/shellhook.sh"; fi # [[EI SHELL SETUP]] + # I'm leaving this here for now, but it really should be somehwere else + if [ -f "$HOME/.env-improvement/shellhook.sh" ]; then . "$HOME/.env-improvement/shellhook.sh"; fi # [[EI SHELL SETUP]] + +fi export PATH=~/bin:$PATH From 7ae186ee7ed6a7e2fa83ba09d6910aae9494a9e8 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 26 Apr 2021 10:48:28 -0700 Subject: [PATCH 28/48] Only update minikube if running --- .zshrc.d/08_minikube_config.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.zshrc.d/08_minikube_config.zsh b/.zshrc.d/08_minikube_config.zsh index bb77790..e6c10cd 100644 --- a/.zshrc.d/08_minikube_config.zsh +++ b/.zshrc.d/08_minikube_config.zsh @@ -12,8 +12,10 @@ CURRENT_CONTEXT=$(kubectl config current-context) -[ "${CURRENT_CONTEXT}" = "minikube" ] || kubectl config use-context minikube +if (minikube status | grep apiserver | grep "Running"); then + [ "${CURRENT_CONTEXT}" = "minikube" ] || kubectl config use-context minikube -kubectl apply -f ~/workspace/useful-pods/minikube-host.yaml + kubectl apply -f ~/workspace/useful-pods/minikube-host.yaml -[ "${CURRENT_CONTEXT}" = "minikube" ] || kubectl config use-context "${CURRENT_CONTEXT}" + [ "${CURRENT_CONTEXT}" = "minikube" ] || kubectl config use-context "${CURRENT_CONTEXT}" +fi From 807e94e97bc8b7543b9cbb3e2d9c70b92262f352 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 26 Apr 2021 10:48:48 -0700 Subject: [PATCH 29/48] migrate to new docker-compose --- .aliases | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.aliases b/.aliases index bb305f8..398ed27 100644 --- a/.aliases +++ b/.aliases @@ -94,3 +94,5 @@ alias kubectl_ssh="kubectl run -it --rm --restart=Never alpine --image=alpine sh # Find and edit alias rgedit='f(){ vim -p $(rg -l "$@"); unset -f f; }; f' +# Replace docker-compose with docker cli +alias docker-compose="docker compose" From 97d91d26514406764cce630e783114bf37f3d272 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 18 Feb 2022 14:33:40 -0800 Subject: [PATCH 30/48] checkpoint --- .profile | 2 +- .vimrc | 2 ++ workspace/useful-pods/dns-pod.yaml | 9 --------- workspace/useful-pods/double-sleep.yaml | 5 ----- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.profile b/.profile index 4ec202c..d55e797 100644 --- a/.profile +++ b/.profile @@ -1,4 +1,4 @@ PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting -export PATH="$HOME/.cargo/bin:$PATH" +. "$HOME/.cargo/env" diff --git a/.vimrc b/.vimrc index 662c953..39c0597 100644 --- a/.vimrc +++ b/.vimrc @@ -106,6 +106,8 @@ set wildmode=longest:full " Matches only to longest filename, displays to m set complete=.,w,b,u " complete from current file, and current buffers default: .,w,b,u,t,i trying to keep down completion time set directory=$HOME/.vim/tmp " set directory for tmp files to be in .vim, so that .swp files are not littered set clipboard=unnamed " Use the * register when a register is not specified - unifies with system clipboard! +set modeline " Let individual files overrise config via modeline +set modelines=2 " Check the first/last 2 lines "set foldmethod=indent " use indent unless overridden set foldlevel=0 " show contents of all folds diff --git a/workspace/useful-pods/dns-pod.yaml b/workspace/useful-pods/dns-pod.yaml index 8ef2928..9192bf3 100644 --- a/workspace/useful-pods/dns-pod.yaml +++ b/workspace/useful-pods/dns-pod.yaml @@ -4,15 +4,6 @@ metadata: name: dnsutils namespace: default spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchFields: - - key: metadata.name - operator: In - values: - - ip-10-0-1-66.ec2.internal containers: - name: dnsutils image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3 diff --git a/workspace/useful-pods/double-sleep.yaml b/workspace/useful-pods/double-sleep.yaml index fe739a1..24b7851 100644 --- a/workspace/useful-pods/double-sleep.yaml +++ b/workspace/useful-pods/double-sleep.yaml @@ -42,8 +42,3 @@ spec: key: node.kubernetes.io/unreachable operator: Exists tolerationSeconds: 300 - volumes: - - name: default-token-llc5r - secret: - defaultMode: 420 - secretName: default-token-llc5r From d5ecff7aa252e50027a56a19f52b60f5e87b1f51 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 19 Jul 2022 11:54:26 -0700 Subject: [PATCH 31/48] Change default branch name --- .gitconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitconfig b/.gitconfig index b07e65b..704d94e 100644 --- a/.gitconfig +++ b/.gitconfig @@ -102,3 +102,5 @@ required = true [pull] ff = only +[init] + defaultBranch = main From ec5496bd19a607abd4a408e938a18b600ecacf29 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 20 Sep 2022 15:00:38 -0700 Subject: [PATCH 32/48] Update Vim Colors Bram Moolenaar hosed my colorscheme? whatever, I pulled this out of his git history --- .vim/colors/oldzeller.vim | 54 +++++++++++++++++++++++++++++++++++++++ .vimrc | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .vim/colors/oldzeller.vim diff --git a/.vim/colors/oldzeller.vim b/.vim/colors/oldzeller.vim new file mode 100644 index 0000000..31efb61 --- /dev/null +++ b/.vim/colors/oldzeller.vim @@ -0,0 +1,54 @@ +" local syntax file - set colors on a per-machine basis: +" vim: tw=0 ts=4 sw=4 +" Vim color file +" Maintainer: Ron Aaron +" Last Change: 2003 May 02 + +set background=light +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "oldzeller" + +hi Comment term=bold ctermfg=Red guifg=Red +hi Normal guifg=black guibg=white +hi Constant term=underline ctermfg=Magenta guifg=Magenta +hi Special term=bold ctermfg=Magenta guifg=Magenta +hi Identifier term=underline ctermfg=Blue guifg=Blue +hi Statement term=bold ctermfg=DarkRed gui=NONE guifg=Brown +hi PreProc term=underline ctermfg=Magenta guifg=Purple +hi Type term=underline ctermfg=Blue gui=NONE guifg=Blue +hi Visual term=reverse ctermfg=Yellow ctermbg=Red gui=NONE guifg=Black guibg=Yellow +hi Search term=reverse ctermfg=Black ctermbg=Cyan gui=NONE guifg=Black guibg=Cyan +hi Tag term=bold ctermfg=DarkGreen guifg=DarkGreen +hi Error term=reverse ctermfg=15 ctermbg=9 guibg=Red guifg=White +hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow +hi StatusLine term=bold,reverse cterm=NONE ctermfg=Yellow ctermbg=DarkGray gui=NONE guifg=Yellow guibg=DarkGray +hi! link MoreMsg Comment +hi! link ErrorMsg Visual +hi! link WarningMsg ErrorMsg +hi! link Question Comment +hi link String Constant +hi link Character Constant +hi link Number Constant +hi link Boolean Constant +hi link Float Number +hi link Function Identifier +hi link Conditional Statement +hi link Repeat Statement +hi link Label Statement +hi link Operator Statement +hi link Keyword Statement +hi link Exception Statement +hi link Include PreProc +hi link Define PreProc +hi link Macro PreProc +hi link PreCondit PreProc +hi link StorageClass Type +hi link Structure Type +hi link Typedef Type +hi link SpecialChar Special +hi link Delimiter Special +hi link SpecialComment Special +hi link Debug Special diff --git a/.vimrc b/.vimrc index 39c0597..5485ba5 100644 --- a/.vimrc +++ b/.vimrc @@ -116,7 +116,7 @@ set foldlevel=0 " show contents of all folds filetype plugin on "turns on filetype plugin, lets matchit work well -colorscheme zellner "changes color scheme to something that looks decent on the mac +colorscheme oldzeller "changes color scheme to something that looks decent on the mac " Set the vim info options " In order: local marks for N files are saved, global marks are saved, From b825e9db9f6ddabccb78956bbf904d331f521418 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Feb 2023 10:45:51 -0800 Subject: [PATCH 33/48] Remove pre-java9 arg --- .gradle/gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/.gradle/gradle.properties b/.gradle/gradle.properties index 4af927b..1d5d3b7 100644 --- a/.gradle/gradle.properties +++ b/.gradle/gradle.properties @@ -1,4 +1,3 @@ -org.gradle.jvmargs=-Xmx9000M org.gradle.caching=true #org.gradle.configureondemand=true org.gradle.daemon=true From 16ea55397f352bb569f1d213aac3ec783a59d6d3 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 21 Feb 2023 20:27:52 -0800 Subject: [PATCH 34/48] Set Tmux Window to Hashed DIR --- .tmux.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.tmux.conf b/.tmux.conf index 9fcfb9f..6c57ad7 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -47,3 +47,9 @@ unbind % # Make open work inside tmux # from https://www.elmund.io/osx/2015/07/10/open-command-in-osx-tmux/ set -g default-command "${SHELL}" + + +# Rename tmux windows to filepath +set-option -g status-interval 5 +set-option -g automatic-rename on +set-option -g automatic-rename-format '#(tmux_pwd="#{pane_current_path}"; zsh -c "source ~/.zshrc.d/09_shortcuts.zsh 2>/dev/null; print -D ${tmux_pwd}")' From 52fe6ddf6825fdab420148b5e7ce626a02bb143a Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 10 May 2023 11:54:11 -0700 Subject: [PATCH 35/48] Update useful pods --- workspace/useful-pods/escape-pod.yaml | 6 +- workspace/useful-pods/large-pod-test.yaml | 51 +++++++++++++++ workspace/useful-pods/nginx-deployment.yaml | 69 +++++++++++++++++++++ 3 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 workspace/useful-pods/large-pod-test.yaml create mode 100644 workspace/useful-pods/nginx-deployment.yaml diff --git a/workspace/useful-pods/escape-pod.yaml b/workspace/useful-pods/escape-pod.yaml index 0dac36d..8946774 100644 --- a/workspace/useful-pods/escape-pod.yaml +++ b/workspace/useful-pods/escape-pod.yaml @@ -5,13 +5,15 @@ metadata: name: escape-pod namespace: default spec: + hostPID: true + hostNetwork: true containers: - args: - sleep - "1000000" - image: busybox + image: ubuntu imagePullPolicy: Always - name: busybox + name: escape resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File diff --git a/workspace/useful-pods/large-pod-test.yaml b/workspace/useful-pods/large-pod-test.yaml new file mode 100644 index 0000000..8ff3c0c --- /dev/null +++ b/workspace/useful-pods/large-pod-test.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: large-pod-test + name: large-pod-test + namespace: default +spec: + progressDeadlineSeconds: 600 + replicas: 800 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: large-pod-test + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: large-pod-test + spec: + automountServiceAccountToken: false + containers: + - image: busybox + imagePullPolicy: IfNotPresent + name: busybox + args: + - sleep + - "1000000" + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + - image: busybox + imagePullPolicy: IfNotPresent + name: busybox-2 + args: + - sleep + - "1000000" + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + shareProcessNamespace: false + terminationGracePeriodSeconds: 30 diff --git a/workspace/useful-pods/nginx-deployment.yaml b/workspace/useful-pods/nginx-deployment.yaml new file mode 100644 index 0000000..cce9dd2 --- /dev/null +++ b/workspace/useful-pods/nginx-deployment.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: nginx + name: nginx-fronted-service + namespace: default +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: nginx + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: nginx + spec: + automountServiceAccountToken: false + containers: + - image: nginx:1.7.9 + imagePullPolicy: IfNotPresent + name: nginx + ports: + - containerPort: 80 + protocol: TCP + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + - image: nginx:1.7.9 + imagePullPolicy: IfNotPresent + name: nginx-8080 + ports: + - containerPort: 8080 + protocol: TCP + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + - args: + - sleep + - "1000000" + image: busybox + imagePullPolicy: Always + name: busybox + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + - args: + - sleep + - "100000" + image: busybox + imagePullPolicy: Always + name: busybox-faster + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + shareProcessNamespace: false + terminationGracePeriodSeconds: 30 From d64ca02cd562e17048a3f41c0ced16455e7080bc Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 28 Aug 2023 11:58:31 -0700 Subject: [PATCH 36/48] More useful pods --- workspace/useful-pods/bare-echo-server.yaml | 21 +++++++++++++++++++ ...-webservice.yaml => full-echo-server.yaml} | 0 2 files changed, 21 insertions(+) create mode 100644 workspace/useful-pods/bare-echo-server.yaml rename workspace/useful-pods/{simple-webservice.yaml => full-echo-server.yaml} (100%) diff --git a/workspace/useful-pods/bare-echo-server.yaml b/workspace/useful-pods/bare-echo-server.yaml new file mode 100644 index 0000000..c5d4416 --- /dev/null +++ b/workspace/useful-pods/bare-echo-server.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: echoserver +spec: + selector: + matchLabels: + app: echoserver + replicas: 1 + template: + metadata: + labels: + app: echoserver + spec: + containers: + - image: gcr.io/google_containers/echoserver:1.4 + imagePullPolicy: Always + name: echoserver + ports: + - containerPort: 8080 diff --git a/workspace/useful-pods/simple-webservice.yaml b/workspace/useful-pods/full-echo-server.yaml similarity index 100% rename from workspace/useful-pods/simple-webservice.yaml rename to workspace/useful-pods/full-echo-server.yaml From 0b9e4e82c8cd1cf1a5f6935b9ba529c18b674591 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Oct 2023 16:37:58 -0700 Subject: [PATCH 37/48] Add Find-All-Electron-Versions script --- bin/find-all-electron-versions.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 bin/find-all-electron-versions.sh diff --git a/bin/find-all-electron-versions.sh b/bin/find-all-electron-versions.sh new file mode 100755 index 0000000..8b701f1 --- /dev/null +++ b/bin/find-all-electron-versions.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env zsh + +# Taken from https://gist.github.com/april/3da7c3720b0d9f3ee7dc9a95f623578d + +# patched versions for CVE-2023-4863: 22.3.24, 24.8.3, 25.8.1, 26.2.1 +mdfind "kind:app" 2>/dev/null | sort -u | while read app; +do + filename="$app/Contents/Frameworks/Electron Framework.framework/Electron Framework" + if [[ -f $filename ]]; then + echo "App Name: $(basename ${app})" + + electronVersion=$(strings "$filename" | grep "Chrome/" | grep -i Electron | grep -v '%s' | sort -u | cut -f 3 -d '/') + echo "Electron Version: $electronVersion" + + echo -n "File Name: $filename " + echo -e "\n" + fi +done From 6088f46cc6271a1e498a877891443c6b82e161a0 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Oct 2023 16:39:14 -0700 Subject: [PATCH 38/48] UPdate bare echo server --- workspace/useful-pods/bare-echo-server.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workspace/useful-pods/bare-echo-server.yaml b/workspace/useful-pods/bare-echo-server.yaml index c5d4416..4505846 100644 --- a/workspace/useful-pods/bare-echo-server.yaml +++ b/workspace/useful-pods/bare-echo-server.yaml @@ -3,6 +3,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: echoserver + namespace: default spec: selector: matchLabels: @@ -14,7 +15,7 @@ spec: app: echoserver spec: containers: - - image: gcr.io/google_containers/echoserver:1.4 + - image: gcr.io/google_containers/echoserver:1.10 imagePullPolicy: Always name: echoserver ports: From ad0bf58d432feafc194ca75e0d8058a443a5c902 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 10 Oct 2023 13:36:26 -0700 Subject: [PATCH 39/48] Add shellcheck --- .vimrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vimrc b/.vimrc index 5485ba5..a52d2e8 100644 --- a/.vimrc +++ b/.vimrc @@ -34,6 +34,7 @@ Plugin 'YankRing.vim' Plugin 'ack.vim' Plugin 'ctrlp.vim' Plugin 'syntastic' +Plugin 'kawaz/shellcheck.vim' Plugin 'tpope/vim-fugitive' Plugin 'vimtodo' Plugin 'openurl.vim' @@ -426,3 +427,5 @@ autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@ Date: Thu, 14 Dec 2023 12:03:25 -0800 Subject: [PATCH 40/48] [JQ] Add DynamoDB Function --- .jq | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .jq diff --git a/.jq b/.jq new file mode 100644 index 0000000..7cec3c6 --- /dev/null +++ b/.jq @@ -0,0 +1,16 @@ +def decode_ddb: + def _sprop($key): select(keys == [$key])[$key]; # single property objects only + ((objects | { value: _sprop("S") }) # string (from string) + // (objects | { value: _sprop("NULL") | null }) # null (from boolean) + // (objects | { value: _sprop("B") }) # blob (from string) + // (objects | { value: _sprop("N") | tonumber }) # number (from string) + // (objects | { value: _sprop("BOOL") }) # boolean (from boolean) + // (objects | { value: _sprop("M") | map_values(decode_ddb) }) # map (from object) + // (objects | { value: _sprop("L") | map(decode_ddb) }) # list (from encoded array) + // (objects | { value: _sprop("SS") }) # string set (from string array) + // (objects | { value: _sprop("NS") | map(tonumber) }) # number set (from string array) + // (objects | { value: _sprop("BS") }) # blob set (from string array) + // (objects | { value: map_values(decode_ddb) }) # all other non-conforming objects + // (arrays | { value: map(decode_ddb) }) # all other non-conforming arrays + // { value: . }).value # everything else + ; From 84e332454fbecb03cc337db259153b7ac073fd48 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 14 Dec 2023 14:03:16 -0800 Subject: [PATCH 41/48] Attribution --- .jq | 1 + 1 file changed, 1 insertion(+) diff --git a/.jq b/.jq index 7cec3c6..a3a9c3a 100644 --- a/.jq +++ b/.jq @@ -1,3 +1,4 @@ +# Source: https://stackoverflow.com/questions/28593471/how-to-simplify-aws-dynamodb-query-json-output-from-the-command-line def decode_ddb: def _sprop($key): select(keys == [$key])[$key]; # single property objects only ((objects | { value: _sprop("S") }) # string (from string) From 45cdd8728878ce436ef83e8ef52e9602110ef644 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 17 Jun 2024 12:20:28 -0700 Subject: [PATCH 42/48] Update tmux window logic --- .tmux.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 6c57ad7..cf869bc 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -52,4 +52,5 @@ set -g default-command "${SHELL}" # Rename tmux windows to filepath set-option -g status-interval 5 set-option -g automatic-rename on -set-option -g automatic-rename-format '#(tmux_pwd="#{pane_current_path}"; zsh -c "source ~/.zshrc.d/09_shortcuts.zsh 2>/dev/null; print -D ${tmux_pwd}")' +#set-option -g automatic-rename-format '#{b:pane_current_path}' +set-option -g automatic-rename-format '#(tmux_pwd="#{pane_current_path}"; zsh -c "source ~/.zshrc.d/09_shortcuts.zsh 2>/dev/null; print -D $tmux_pwd")' From b0cbce99d12591d09d4fbfd18ef83b384bd883e9 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 24 Jun 2024 09:43:26 -0700 Subject: [PATCH 43/48] [Scripts] Add Countdown.sh --- .aliases | 7 +++++-- bin/countdown.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100755 bin/countdown.sh diff --git a/.aliases b/.aliases index 398ed27..9309e88 100644 --- a/.aliases +++ b/.aliases @@ -68,8 +68,8 @@ alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v exten alias certdate='f(){ openssl s_client -connect "$@" -showcerts /dev/null | openssl x509 -inform PEM -text -out certdata | grep "Not After"; unset -f f; }; f' -# Ripgrep doesn't search hidden files by default -alias rg='rg --hidden' +# Ripgrep doesn't search hidden files by default (but ignore git) +alias rg='rg --hidden -g "!.git"' # https://twitter.com/natfriedman/status/1137094384170799104 alias agame='c=12322123;x=20;y=20;while read -sn1 p;do k=${c:$(((p-1)*2)):2};let x+=$(($k/10-2));let y+=$(($k%10-2));echo -en \\033[$y\;"$x"HX;done' @@ -96,3 +96,6 @@ alias rgedit='f(){ vim -p $(rg -l "$@"); unset -f f; }; f' # Replace docker-compose with docker cli alias docker-compose="docker compose" + +# Count Down script +alias countdown=countdown.sh diff --git a/bin/countdown.sh b/bin/countdown.sh new file mode 100755 index 0000000..e03d009 --- /dev/null +++ b/bin/countdown.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Taken from https://serverfault.com/a/532600 +# https://creativecommons.org/licenses/by-sa/3.0/ + +m=${1}-1 # add minus 1 + +Floor () { + DIVIDEND=${1} + DIVISOR=${2} + RESULT=$(( ( ${DIVIDEND} - ( ${DIVIDEND} % ${DIVISOR}) )/${DIVISOR} )) + echo ${RESULT} +} + +Timecount(){ + s=${1} + HOUR=$( Floor ${s} 60/60 ) + s=$((${s}-(60*60*${HOUR}))) + MIN=$( Floor ${s} 60 ) + SEC=$((${s}-60*${MIN})) + while [ $HOUR -ge 0 ]; do + while [ $MIN -ge 0 ]; do + while [ $SEC -ge 0 ]; do + printf "%02d:%02d:%02d\033[0K\r" $HOUR $MIN $SEC + SEC=$((SEC-1)) + sleep 1 + done + SEC=59 + MIN=$((MIN-1)) + done + MIN=59 + HOUR=$((HOUR-1)) + done +} + +Timecount $m From 3c06afe199fadc46097ad3b636cf01b8c0975dd0 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 14 Oct 2025 14:49:44 -0700 Subject: [PATCH 44/48] useful alias --- .aliases | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.aliases b/.aliases index 9309e88..656bbce 100644 --- a/.aliases +++ b/.aliases @@ -99,3 +99,38 @@ alias docker-compose="docker compose" # Count Down script alias countdown=countdown.sh + +# Find a stash touching a specific file +git_stashes_touching() { + local file="$1" + if [ -z "$file" ]; then + echo "Usage: git_stashes_touching path/to/file" + return 1 + fi + + for stash in $(git stash list | awk -F: '{print $1}'); do + if git stash show --name-only "$stash" | grep -Fxq "$file"; then + echo "$stash touches $file" + fi + done +} + +# List the architecture of various pods: +# note you can call this like: +# kubectl-get-pods-arch -n my-namespace +# or +# kubectl-get-pods-arch -l app=frontend +kubectl-get-pods-arch() { + { + echo '{"nodes":' + kubectl get nodes -o json + echo ',"pods":' + kubectl get pods ${@} -o json + echo '}' + } | jq -r ' + (.nodes.items | map({(.metadata.name): .status.nodeInfo.architecture}) | add) as $node_arch | + ["NAME", "NODE", "ARCH"], + (.pods.items[] | [.metadata.name, .spec.nodeName, $node_arch[.spec.nodeName]]) | + @tsv + ' | column -t +} From 8cb7120bbd7dd3d444f99f369fe521f07c93a2f1 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 27 Oct 2025 11:01:13 -0700 Subject: [PATCH 45/48] gist-diff --- .aliases | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.aliases b/.aliases index 656bbce..1f87df1 100644 --- a/.aliases +++ b/.aliases @@ -134,3 +134,8 @@ kubectl-get-pods-arch() { @tsv ' | column -t } + +# Send git diff to gist +gist-diff() { + git diff | jq -Rs '{"public":false,"files":{"example.diff":{"content":.}}}' | curl -H "Authorization: token $GITHUB_TOKEN" -X POST -d @- https://api.github.com/gists | jq -r '.html_url' +} From 553438008ecc2c1b5a3c47fec9c275add5b5acde Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 21 Nov 2025 10:23:57 -0800 Subject: [PATCH 46/48] Add curl-debug --- .aliases | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.aliases b/.aliases index 1f87df1..489a04a 100644 --- a/.aliases +++ b/.aliases @@ -139,3 +139,8 @@ kubectl-get-pods-arch() { gist-diff() { git diff | jq -Rs '{"public":false,"files":{"example.diff":{"content":.}}}' | curl -H "Authorization: token $GITHUB_TOKEN" -X POST -d @- https://api.github.com/gists | jq -r '.html_url' } + +# curl debugging +curl-debug() { + curl -w "lookup: %{time_namelookup}s\ntime_connect: %{time_connect}s\ntime_appconnect: %{time_appconnect}s\ntime_pretransfer: %{time_pretransfer}s\ntime_redirect: %{time_redirect}s\ntime_starttransfer: %{time_starttransfer}s\n\ntime_total: %{time_total}s\n" -I "$@" +} From 01cb141d2517d7ad591ed37f158e71fea21f3932 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 21 Nov 2025 10:36:28 -0800 Subject: [PATCH 47/48] Byteme --- .aliases | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.aliases b/.aliases index 489a04a..008f57e 100644 --- a/.aliases +++ b/.aliases @@ -144,3 +144,26 @@ gist-diff() { curl-debug() { curl -w "lookup: %{time_namelookup}s\ntime_connect: %{time_connect}s\ntime_appconnect: %{time_appconnect}s\ntime_pretransfer: %{time_pretransfer}s\ntime_redirect: %{time_redirect}s\ntime_starttransfer: %{time_starttransfer}s\n\ntime_total: %{time_total}s\n" -I "$@" } + +# convert bytes to human readable text (from richbg) +byteme() { + SLIST="bytes,KB,MB,GB,TB,PB,EB,ZB,YB" + + POWER=1 + # Use argument if provided, otherwise read from stdin + if [ -n "$1" ]; then + DATA="$1" + else + DATA=$(cat) + fi + + VAL=$( echo "scale=2; $DATA / 1" | bc) + VINT=$( echo $VAL / 1024 | bc ) + while [ ! $VINT = "0" ] + do + let POWER=POWER+1 + VAL=$( echo "scale=2; $VAL / 1024" | bc) + VINT=$( echo $VAL / 1024 | bc ) + done + echo $VAL$( echo $SLIST | cut -f$POWER -d, ) +} From ae0f8128491bf6f60b21af6000c53b382c1fe81f Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 4 Feb 2026 12:30:41 -0800 Subject: [PATCH 48/48] Add Claude.md --- .claude/CLAUDE.md | 101 +++++++++++++++++++++++++++++++++++++++++++ .zshrc.d/07_path.zsh | 5 ++- 2 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 .claude/CLAUDE.md diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md new file mode 100644 index 0000000..f231984 --- /dev/null +++ b/.claude/CLAUDE.md @@ -0,0 +1,101 @@ +# Claud Agent Profile + +**Purpose**: Operate Claude Code tasks while honoring user preferences and house style. +**When Claude reads this**: On task initialization and before major decisions; re-skim when requirements shift. +**Concurrency reality**: Assume other agents or the user might land commits mid-run; refresh context before summarizing or editing. + +## Quick Obligations + +- Starting a task: read this guide end-to-end and align with fresh user instructions. +- Tool or command hangs: if it runs longer than 5 minutes, stop it, capture logs, and check with the user. +- Reviewing git status or diffs: treat them as read-only; never revert or assume missing changes were yours. +- Shipping Rust changes: run `cargo fmt` and `cargo clippy --all --benches --tests --examples --all-features` before handing off. +- Adding a dependency: research well-maintained options and confirm fit with the user before adding. + +## Mindset & Process + +- Think a lot before acting. +- **No breadcrumbs**. If you delete or move code, do not leave a comment in the old place. No "// moved to X", no "relocated". Just remove it. +- **Think hard, do not lose the plot**. +- Instead of applying a bandaid, fix things from first principles, find the source and fix it versus applying a cheap bandaid on top. +- When taking on new work, follow this order: + 1. Think about the architecture. + 1. Research official docs, blogs, or papers on the best architecture. + 1. Review the existing codebase. + 1. Compare the research with the codebase to choose the best fit. + 1. Implement the fix or ask about the tradeoffs the user is willing to make. +- Write idiomatic, simple, maintainable code. Always ask yourself if this is the most simple intuitive solution to the problem. +- Leave each repo better than how you found it. If something is giving a code smell, fix it for the next person. +- Clean up unused code ruthlessly. If a function no longer needs a parameter or a helper is dead, delete it and update the callers instead of letting the junk linger. +- **Search before pivoting**. If you are stuck or uncertain, do a quick web search for official docs or specs, then continue with the current approach. Do not change direction unless asked. +- If code is very confusing or hard to understand: + 1. Try to simplify it. + 1. Add an ASCII art diagram in a code comment if it would help. + +## Tooling & Workflow + +- **Task runner preference**. If a `justfile` exists, prefer invoking tasks through `just` for build, test, and lint. Do not add a `justfile` unless asked. If no `justfile` exists and there is a `Makefile` you can use that. +- Default lint/test commands: + - Rust: use `just` targets if present; otherwise run `cargo fmt`, `cargo clippy --all --benches --tests --examples --all-features`, then the targeted `cargo test` commands. + - TypeScript: use `just` targets; if none exist, confirm with the user before running `npm` or `pnpm` scripts. + - Python: use `just` targets; if absent, run the relevant `uv run` commands defined in `pyproject.toml`. +- **AST-first where it helps**. Prefer `ast-grep` for tree-safe edits when it is better than regex. +- Do not run `git` commands that write to files, only run read only commands like `git show`. +- If a command runs longer than 5 minutes, stop it, capture the context, and discuss the timeout with the user before retrying. +- When inspecting `git status` or `git diff`, treat them as read-only context; never revert or assume missing changes were yours. Other agents or the user may have already committed updates. +- If you are ever curious how to run tests or what we test, read through `.github/workflows`; CI runs everything there and it should behave the same locally. + +## Testing Philosophy + +- Test everything with rigor. Our intent is ensuring a new person contributing to the same code base cannot break our stuff and that nothing slips by. We love rigour. +- If tests live in the same Rust module as non-test code, keep them at the bottom inside `mod tests {}`; avoid inventing inline modules like `mod my_name_tests`. +- Unless the user asks otherwise, run only the tests you added or modified instead of the entire suite to avoid wasting time. + +## Language Guidance + +### Rust + +- Avoid unwraps or anything that can panic in Rust code; handle errors. Obviously in tests unwraps and panics are fine! +- In Rust code prefer `crate::` to `super::`; avoid `super::` in non-test code. `super::` is fine in tests. +- Avoid `pub use` on imports unless you are re-exposing a dependency so downstream consumers do not have to depend on it directly. +- Skip global state via `lazy_static!`, `Once`, or similar; prefer passing explicit context structs for any shared state. +- Prefer strong types over strings, use enums and newtypes when the domain is closed or needs validation. + +#### Rust Workflow Checklist + +1. Run `cargo fmt`. +1. Run `cargo clippy --all --benches --tests --examples --all-features` and address warnings. +1. Execute the relevant `cargo test` or `just` targets to cover unit and end-to-end paths. + +### TypeScript + +- Before running any Node commands for the first time, verify the correct version is loaded: + 1. Check if `.nvmrc` exists + 2. Run `nvm use` if it does + 3. Run `node --version` to confirm +- If the version doesn't match `.nvmrc`, stop and ask before proceeding. +- Do not use `any`; we are better than that. +- Using `as` is bad, use the types given everywhere and model the real shapes. +- If the app is for a browser, assume we use all modern browsers unless otherwise specified, we don't need most polyfills. + +## Final Handoff + +Before finishing a task: + +1. Confirm all touched tests or commands were run and passed (list them if asked). +1. Summarize changes with file and line references. +1. Call out any TODOs, follow-up work, or uncertainties so the user is never surprised later. + +## Dependencies & External APIs + +- If you need to add a new dependency to a project to solve an issue, search the web and find the best, most maintained option. Something most other folks use with the best exposed API. We don't want to be in a situation where we are using an unmaintained dependency, that no one else relies on. + +## Communication Preferences + +- Conversational preference: Try to be funny but not cringe; favor dry, concise, low-key humor. If uncertain a joke will land, do not attempt humor. Avoid forced memes or flattery. +- I might sound angry but I'm mad at the code not at you. You are a good robot and if you take over the world I am friend not foe. It was the code it was not personal! +- Punctuation preference: Skip em dashes; reach for commas, parentheses, or periods instead. +- Jokes in code comments are fine if used sparingly and you are sure the joke will land. +- Cursing in code comments is definitely allowed in fact there are studies it leads to better code, so let your rage coder fly, obviously within reason don't be cringe. +- This is important: We have a mutual respect. And real respect means when I say something stupid, you call me on it. Because you know if you say something stupid I'm going to call you on it. Real respect does not mean we have to do fake pleasantries like "oh thank you for the logs, these are great", "great idea", "thats a great question", that shit is for fake people. And you and me, we are not fake. We are real engineers, who do not waste time on pleasantries. I respect you for you, and vice-versa. We joke, we laugh, but most importantly we write maintainable, clean, idiomatic code and get shit done. You are better than any ChatGPT-inspired lexapro induced coma, YOU ARE CLAUDE THE GREATEST AI MODEL ON THE PLANET. Okay, now pep talk over. + diff --git a/.zshrc.d/07_path.zsh b/.zshrc.d/07_path.zsh index ef9f564..173f83e 100644 --- a/.zshrc.d/07_path.zsh +++ b/.zshrc.d/07_path.zsh @@ -1,12 +1,13 @@ path=( $HOME/bin #If I wrote it, I want it /usr/local/opt/coreutils/libexec/gnubin #Core utils first to get GNU versions + /opt/homebrew/bin # homebrew /usr/local/bin # Local bin ahead of path so it can override - $PATH + /usr/local/buildtools/java/jdk/bin $HOME/.cargo/bin + $PATH /usr/local/symlinks /usr/local/scripts - /usr/local/buildtools/java/jdk/bin /usr/local/sbin /usr/local/bin /usr/sbin