Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZSH config #1

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7f37afd
Customize for github.com
gremsam Oct 28, 2019
f6da5bf
bitbucket mapping
gremsam Oct 28, 2019
d70bf7b
Add zshrc
gremsam Nov 1, 2019
9bf3469
Cleanup
gremsam Nov 1, 2019
0c1c71b
Some of our projects are not conducive to dynamic loading
gremsam Nov 1, 2019
ec5a290
Split out zshrc
gremsam Nov 1, 2019
959e505
I forget how ls colors work
gremsam Nov 11, 2019
b996f9b
Disable this until I can figure out what broke
gremsam Nov 11, 2019
f8243da
Fish/zsh compat
gremsam Nov 11, 2019
cf59f9a
Update README.md
gremsam Nov 11, 2019
3587bf7
Update README.md
gremsam Nov 11, 2019
e14c63d
Fix home reference
gremsam Nov 11, 2019
77381c0
New Aliases
gremsam Mar 25, 2020
a39604d
envI
gremsam Mar 25, 2020
b16ed2c
Setup gcloud sdk
gremsam Mar 25, 2020
13b39c5
Vim Replace!
gremsam Mar 25, 2020
c761b3b
Useful Pods
gremsam Mar 25, 2020
60174e7
Update README.md
gremsam Mar 25, 2020
3732dc5
Fix location
gremsam Mar 25, 2020
f1059ca
iso_date
gremsam Apr 13, 2020
156ee46
Add escape pod
gremsam May 6, 2020
84b9254
Simple echo service for demonstrating k8s ingress
gremsam May 14, 2020
6ebf1cc
New aliases
gremsam Aug 20, 2020
af343fc
setup history
gremsam Aug 20, 2020
807dbba
Setup Minikube host address for dns
gremsam Nov 23, 2020
3ad84fc
Minor updates
gremsam Apr 20, 2021
a17aa40
Add debug mode
gremsam Apr 26, 2021
7ae186e
Only update minikube if running
gremsam Apr 26, 2021
807e94e
migrate to new docker-compose
gremsam Apr 26, 2021
97d91d2
checkpoint
gremsam Feb 18, 2022
d5ecff7
Change default branch name
gremsam Jul 19, 2022
ec5496b
Update Vim Colors
gremsam Sep 20, 2022
b825e9d
Remove pre-java9 arg
gremsam Feb 17, 2023
16ea553
Set Tmux Window to Hashed DIR
gremsam Feb 22, 2023
52fe6dd
Update useful pods
gremsam May 10, 2023
d64ca02
More useful pods
gremsam Aug 28, 2023
0b9e4e8
Add Find-All-Electron-Versions script
gremsam Oct 2, 2023
6088f46
UPdate bare echo server
gremsam Oct 2, 2023
ad0bf58
Add shellcheck
gremsam Oct 10, 2023
0926a25
[JQ] Add DynamoDB Function
gremsam Dec 14, 2023
84e3324
Attribution
gremsam Dec 14, 2023
45cdd87
Update tmux window logic
gremsam Jun 17, 2024
b0cbce9
[Scripts] Add Countdown.sh
gremsam Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .aliases
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,34 @@ alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v exten
alias certdate='f(){ openssl s_client -connect "$@" -showcerts </dev/null 2>/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'


# 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]);'"

# 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'

# Replace docker-compose with docker cli
alias docker-compose="docker compose"

# Count Down script
alias countdown=countdown.sh
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build --google_credentials=/Users/samrossoff/.config/gcloud/application_default_credentials.json
build --google_credentials=/Users/sam/.config/gcloud/application_default_credentials.json
8 changes: 4 additions & 4 deletions .config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[user]
name = Sam
email = sam@
email = sam[email protected]
[push]
default = current
[merge]
Expand Down Expand Up @@ -91,10 +91,16 @@
[rerere]
enabled = 1

[url "[email protected]:"]
insteadOf = https://github.sc-corp.net/
[url "[email protected]:"]
insteadOf = https://github.com/
[url "[email protected]:"]
insteadOf = https://[email protected]/
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[pull]
ff = only
[init]
defaultBranch = main
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Only track files that start in .
# Opt-In for tracking
*
.snapaccess.yml
3 changes: 1 addition & 2 deletions .gradle/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
org.gradle.jvmargs=-Xmx9000M
org.gradle.caching=true
org.gradle.configureondemand=true
#org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.parallel=true
1 change: 1 addition & 0 deletions .ideavimrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
source ~/.vimrc
set ideajoin
17 changes: 17 additions & 0 deletions .jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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)
// (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
;
2 changes: 1 addition & 1 deletion .profile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

export PATH="$HOME/.cargo/bin:$PATH"
. "$HOME/.cargo/env"
7 changes: 7 additions & 0 deletions .tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ 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 '#{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")'
54 changes: 54 additions & 0 deletions .vim/colors/oldzeller.vim
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
" 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
10 changes: 9 additions & 1 deletion .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -49,6 +50,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'

Expand Down Expand Up @@ -103,6 +107,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
Expand All @@ -111,7 +117,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,
Expand Down Expand Up @@ -421,3 +427,5 @@ autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()

syntax match nonascii "[^\x00-\x7F]"
24 changes: 24 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Fix when setenv isn't available, should probably just move to export at some
# point.
setenv() {
export $1=$2
}

if [[ -z $ZSH_VERSION ]]
then
ZSH_VERSION=`$SHELL --version | /usr/bin/cut -d ' ' -f 2`
fi

# Source all files in .zshrc.d
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]]

fi

export PATH=~/bin:$PATH
17 changes: 17 additions & 0 deletions .zshrc.d/00_oh_my_zsh.zsh
Original file line number Diff line number Diff line change
@@ -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

19 changes: 19 additions & 0 deletions .zshrc.d/02_environment.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# You may need to manually set your language environment
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`
4 changes: 4 additions & 0 deletions .zshrc.d/05_aliases.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Load aliases from a shell independent file
[ -e ~/.aliases ] && . ~/.aliases

# Include zsh specific aliases below
22 changes: 22 additions & 0 deletions .zshrc.d/07_path.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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
$HOME/.cargo/bin
/usr/local/symlinks
/usr/local/scripts
/usr/local/buildtools/java/jdk/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/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
21 changes: 21 additions & 0 deletions .zshrc.d/08_minikube_config.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# 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

CURRENT_CONTEXT=$(kubectl config current-context)

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

[ "${CURRENT_CONTEXT}" = "minikube" ] || kubectl config use-context "${CURRENT_CONTEXT}"
fi
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.sc-corp.net:sam/homebase.git
% git clone git@github.com:gremsam/homebase.git
% mv ~/homebase/* ~
% mv ~/homebase/.git ~
```

Example
========

![Example of it in action](https://github.sc-corp.net/sam/homebase/blob/master/example.png?raw=true)
8 changes: 8 additions & 0 deletions bin/and
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/zsh

if [ ! $? -eq 0 ]; then
exit $?
fi

exec ${@:1}
exit $?
Loading