diff --git a/.gitignore b/.gitignore index 77c60c54..a04f2bdd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ atom.symlink/themes atom.symlink/blob-store atom.symlink/recovery -bin/ip.sh bin/kubectl -bin/ssh.sh +bin/bandwidth.json +bin/bandwidth.log git/gitconfig.local.symlink diff --git a/Brewfile b/Brewfile index 643566af..df5bbaf3 100644 --- a/Brewfile +++ b/Brewfile @@ -1,29 +1,24 @@ cask_args appdir: '/Applications' tap 'homebrew/bundle' -tap 'puma/puma' brew 'ack' +brew 'azure-cli' brew 'coreutils' brew 'go' brew 'grc' -brew 'imagemagick' brew 'jp2a' brew 'jq' brew 'libgit2' brew 'openssl' brew 'node' -brew 'readline' brew 'postgresql' -brew 'puma/puma/puma-dev' brew 'python' brew 'ruby-build' brew 'rbenv' -brew 'roundup' brew 'shpotify' brew 'spaceman-diff' brew 'speedtest-cli' -brew 'spark' brew 'tmux' brew 'unrar' brew 'wget' @@ -31,13 +26,13 @@ brew 'yarn' brew 'youtube-dl' cask '1password' -cask 'adium' cask 'atom' cask 'firefox' cask 'google-chrome' cask 'handbrake' +cask 'iterm2' cask 'slack' cask 'spotify' -cask 'transmission' -cask 'tunnelbear' +cask 'transmission' +cask 'visual-studio-code' cask 'vlc' diff --git a/README.md b/README.md index 08c2a818..36493c35 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ Run the following to configure macOS from scratch... bash -c "$(curl -fsSL https://raw.githubusercontent.com/jldeen/dotfiles/mac/configure.sh)" ``` +It should go without saying, you should never run a script on your system without reading it to understand what changes it will make to your system. My scripts and code samples are no exception to the rule. + +If you choose to use my dotfiles, my configure script will backup your current dotfiles, but will also make changes to your crontab - it's in your best interest to understand these changes prior to opting in. + ### Notes Your dotfiles are how you personalize your system. These are mine. @@ -83,7 +87,7 @@ said, I do use this as *my* dotfiles, so there's a good chance I may break something if I forget to make a check for a dependency. If you're brand-new to the project and run into any blockers, please -[open an issue](https://github.com/holman/dotfiles/issues) on this repository +[open an issue](https://github.com/jldeen/dotfiles/issues) on this repository and I'd love to get it fixed for you! ## thanks diff --git a/bash/bashrc.symlink b/bash/bashrc.symlink index a8ef8194..c2588ca2 100644 --- a/bash/bashrc.symlink +++ b/bash/bashrc.symlink @@ -124,6 +124,5 @@ GIT_PS1_SHOWSTASHSTATE=1 GIT_PS1_SHOWUNTRACKEDFILES=1 GIT_PS1_SHOWUPSTREAM="auto" -export PATH=$PATH:/home/jldeen/bin - -source '/home/jldeen/lib/azure-cli/az.completion' +# az cli +autoload bashcompinit && bashcompinit \ No newline at end of file diff --git a/bin/internet_info.sh b/bin/internet_info.sh index 909c8a20..4749876a 100755 --- a/bin/internet_info.sh +++ b/bin/internet_info.sh @@ -14,18 +14,18 @@ if [[ $? -eq 0 ]] fi # Speedtest -DL=$(speedtest-cli --simple | awk 'NR==2{print $2}') -UP=$(speedtest-cli --simple | awk 'NR==3{print $2}') +DL=$(cat ~/bin/bandwidth.log | awk 'NR==2{print $2}') +UP=$(cat ~/bin/bandwidth.log | awk 'NR==3{print $2}') # # Public IP -PUB_IP=$(speedtest-cli --json | jq -r .client.ip) +PUB_IP=$(cat ~/bin/bandwidth.json | jq -r .client.ip) if [[ "$PUB_IP" = ";; connection timed out; no servers could be reached" ]]; then PUB_IP="Not Available" elif [[ "$PUB_IP" = "" ]]; then PUB_IP="No external access" else - PUB_IP=$(speedtest-cli --json | jq -r .client.ip) + PUB_IP=$(cat ~/bin/bandwidth.json | jq -r .client.ip) fi INTERNET='' diff --git a/code/settings.json b/code/settings.json index bb76393a..82ec1582 100644 --- a/code/settings.json +++ b/code/settings.json @@ -10,8 +10,8 @@ "remote.onstartup": true, // Controls the font family. -"editor.fontFamily": "'SauceCodePro Nerd Font'", -"terminal.integrated.fontFamily": "'SauceCodePro Nerd Font'", +"editor.fontFamily": "'SourceCodePro Nerd Font'", +"terminal.integrated.fontFamily": "'SourceCodePro Nerd Font'", "terminal.integrated.fontSize": 11, "workbench.startupEditor": "newUntitledFile", "typescript.check.npmIsInstalled": false, @@ -21,7 +21,7 @@ // "window.zoomLevel": 0, // "workbench.startupEditor": "newUntitledFile", //PowerShell -// "terminal.integrated.shell.osx": "/usr/local/bin/powershell", +"terminal.integrated.shell.osx": "/usr/local/bin/zsh", // Color Override for terminal "workbench.colorCustomizations": { "terminal.foreground": "#839496", diff --git a/configure.sh b/configure.sh index 8b2cae51..12d11e91 100755 --- a/configure.sh +++ b/configure.sh @@ -1,15 +1,34 @@ #!/bin/bash # Install brew -/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +if test ! $(which brew) +then + echo " Installing Homebrew for you." + + # Install the correct homebrew for each OS type + if test "$(uname)" = "Darwin" + then + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + elif test "$(expr substr $(uname -s) 1 5)" = "Linux" + then + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" + fi + +fi echo "Updating package lists..." brew update + # zsh install +if test $(which zsh) +then echo '' -echo "Now installing zsh..." +echo "zsh already installed..." +else +echo "zsh not found, now installing zsh..." echo '' brew install zsh zsh-completions +fi # Installing git completion echo '' @@ -27,10 +46,25 @@ if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then fi # oh-my-zsh install -echo '' -echo "Now installing oh-my-zsh..." +if [ -d ~/.oh-my-zsh/ ] ; then +echo '' +echo "oh-my-zsh is already installed..." +read -p "Would you like to update oh-my-zsh now?" -n 1 -r +echo '' + if [[ $REPLY =~ ^[Yy]$ ]] ; then + cd ~/.oh-my-zsh && git pull + if [[ $? -eq 0 ]] + then + echo "Update complete..." && cd + else + echo "Update not complete..." >&2 cd + fi + fi +else +echo "oh-my-zsh not found, now installing oh-my-zsh..." echo '' sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +fi # oh-my-zsh plugin install echo '' @@ -94,9 +128,7 @@ then echo '' echo "Now configuring symlinks..." && $HOME/.dotfiles/script/bootstrap echo '' - echo "Now setting up dependencies..." - sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport - + if [[ $? -eq 0 ]] then echo "Successfully configured your environment with jldeen's macOS dotfiles..." @@ -115,43 +147,4 @@ else echo '' echo "source $HOME/.git-completion.bash" >> ${ZDOTDIR:-$HOME}/.bashrc && echo "added git-completion to .bashrc..." -fi - -# Set default shell to zsh -echo '' -read -p "Do you want to change your default shell? y/n" -n 1 -r -echo '' -if [[ $REPLY =~ ^[Yy]$ ]] -then - echo "Now setting default shell..." - chsh -s $(which zsh) - if [[ $? -eq 0 ]] - then - echo "Successfully set your default shell to zsh..." - else - echo "Default shell not set successfully..." >&2 -fi -else - echo "You chose not to set your default shell to zsh. Exiting now..." -fi - -# Setup and configure az cli -echo '' -read -p "Do you want to install Azure CLI? y/n (This will take some time...)" -n 1 -r -echo '' -if [[ $REPLY =~ ^[Yy]$ ]] -then - echo "Now installing az cli..." - brew install azure-cli - if [[ $? -eq 0 ]] - then - echo "Successfully installed Azure CLI 2.0." - else - echo "Azure CLI not installed successfully." >&2 -fi -else - echo "You chose not to install Azure CLI. Exiting now." -fi - -echo '' -echo ' Badass macOS terminal installed!' \ No newline at end of file +fi \ No newline at end of file diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 1a68754e..c5f8ec77 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -30,7 +30,4 @@ # for more information on different options of the below setting. # # Setting to git 2.0 default to suppress warning message - default = simple -[user] - name = jldeen - email = jessde@microsoft.com + default = simple \ No newline at end of file diff --git a/iterm/itermcfg.symlink/com.googlecode.iterm2.plist b/iterm/itermcfg.symlink/com.googlecode.iterm2.plist index d6d61142..541f640a 100644 --- a/iterm/itermcfg.symlink/com.googlecode.iterm2.plist +++ b/iterm/itermcfg.symlink/com.googlecode.iterm2.plist @@ -12,6 +12,8 @@ 0 AppleSmoothFixedFontsSizeThreshold 1 + AppleWindowTabbingMode + manual AutoHideTmuxClientSession Custom Color Presets @@ -36037,12 +36039,14 @@ B8A14F96-3D88-4036-8529-B7A7A23FA30F EnableRendezvous + HotkeyMigratedFromSingleToMulti + LoadPrefsFromCustomFolder NSNavLastRootDirectory - ~/Desktop/mbadolato-iTerm2-Color-Schemes-89b3f62/schemes + ~ NSNavPanelExpandedSizeForOpenMode - {849, 448} + {712, 448} NSQuotedKeystrokeBinding NSRepeatCountBinding @@ -36058,7 +36062,7 @@ gAKACoAN0xAJChEVGVdOUy5rZXlzoxITFIADgASABaMWFxiABoAHgAiACVpJZGVudGlm aWVyVVdpZHRoVkhpZGRlblEwI0BowAAAAAAACNIhIiMkWiRjbGFzc25hbWVYJGNsYXNz ZXNcTlNEaWN0aW9uYXJ5oiMlWE5TT2JqZWN00xAJCicrGaMSExSAA4AEgAWjLC0YgAuA - DIAIgAlRMSNAczGdsi0OVtIhIjM0Xk5TTXV0YWJsZUFycmF5ozM1JVdOU0FycmF5XxAP + DIAIgAlRMSNAc7Gdsi0OVtIhIjM0Xk5TTXV0YWJsZUFycmF5ozM1JVdOU0FycmF5XxAP TlNLZXllZEFyY2hpdmVy0Tg5VUFycmF5gAEACAARABoAIwAtADIANwBGAEwAUQBcAGMA ZgBoAGoAbABzAHsAfwCBAIMAhQCJAIsAjQCPAJEAnACiAKkAqwC0ALUAugDFAM4A2wDe AOcA7gDyAPQA9gD4APwA/gEAAQIBBAEGAQ8BFAEjAScBLwFBAUQBSgAAAAAAAAIBAAAA @@ -36074,23 +36078,14 @@ NSTableView Supports v2 KeyBingingTable - NSToolbar Configuration com.apple.NSColorPanel - - TB Is Shown - 1 - NSWindow Frame NSFontPanel - 379 104 660 77 0 0 1680 1028 + 769 110 445 103 0 0 1360 745 NSWindow Frame ProfilesPanel - 126 350 735 382 0 0 1280 778 - NSWindow Frame SessionsPreferences - 269 139 606 456 0 0 1440 878 + 159 291 735 382 0 0 1360 745 NSWindow Frame SharedPreferences - 435 464 796 473 0 0 1680 1028 + 237 289 918 401 0 0 1360 745 NSWindow Frame iTerm Window 0 - 113 106 1089 427 0 0 1680 1028 - NSWindow Frame iTerm Window 1 - 176 41 885 427 0 0 1440 900 + 41 147 1279 478 0 0 1280 777 New Bookmarks @@ -37433,7 +37428,7 @@ Non-ASCII Anti Aliased Normal Font - SauceCodeProNerdFontC-Regular 18 + SourceCodeProNerdFontC-Regular 32 Only The Default BG Color Uses Transparency Option Key Sends @@ -37503,26 +37498,13 @@ NoSyncHaveWarnedAboutPasteConfirmationChange NoSyncInstallationId - 92150115-FFFB-433E-B237-D4D3D2F7B4A2 - NoSyncLastTipTime - 515442352.29137498 + 39B11FBA-1B8D-4F87-816C-9C4BE605D3AF NoSyncNeverRemindPrefsChangesLostForFile NoSyncNeverRemindPrefsChangesLostForFile_selection 0 - NoSyncPermissionToShowTip - NoSyncTimeOfFirstLaunchOfVersionWithTip - 513918337.30616999 - NoSyncTipsDisabled - - NoSyncTipsToNotShow - - 000 - 0000 - 0001 - 0002 - + 546818164.89214206 PointerActions Button,1,1,, @@ -37557,21 +37539,23 @@ PrefsCustomFolder - /Users/jessicadeen/.itermcfg + ~/.itermcfg SUEnableAutomaticChecks - + SUFeedAlternateAppNameKey iTerm SUFeedURL - https://iterm2.com/appcasts/final.xml?shard=43 + https://iterm2.com/appcasts/final.xml?shard=56 SUHasLaunchedBefore + SULastCheckTime + 2018-05-06T16:22:22Z SUSendProfileInfo WordCharacters /-+\~_. iTerm Version - 3.0.15 + 3.1.6 kCPKSelectionViewPreferredModeKey 0 kCPKSelectionViewShowHSBTextFieldsKey diff --git a/script/bootstrap b/script/bootstrap index b4563991..38d7675b 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -137,6 +137,19 @@ install_dotfiles () { done } +add_cron () { + local frequency="*/15 * * * *" + local command=$1 + local job="$frequency $command" + cat <(fgrep -i -v "$command" <(crontab -l)) <(echo "$job") | crontab - +} + +add_line () { + local command=$1 + local job="$command" + cat <(fgrep -i -v "$command" <(crontab -l)) <(echo "$job") | crontab - +} + setup_gitconfig install_dotfiles @@ -149,55 +162,108 @@ then success "dependencies installed" echo '' echo "Now updating dependencies..." - pip2 install --upgrade pip setuptools + pip3 install --upgrade setuptools else fail "error installing dependencies" fi fi -## JD edit +echo '' +info "starting jldeen mods" #backup old bin, if exists -if [ -e $HOME/bin ] +if [ -d $HOME/bin ] then - echo '' echo "current $HOME/bin folder found!!! Creating backup..." sudo mv $HOME/bin bin_old + success "backup created" else - echo '' echo "No current $HOME/bin folder found. Proceeding to link bin folder for tumx scripts..." fi # symlink .dotfiles bin to ~ -ln -s $HOME/.dotfiles/bin $HOME/bin +ln -s $HOME/.dotfiles/bin $HOME/bin && success "symlink for $HOME/bin folder created" # symlink .dotfiles tmux to ~ -ln -s $HOME/.dotfiles/tmux $HOME/.tmux +ln -s $HOME/.dotfiles/tmux $HOME/.tmux && success "symlink for $HOME/.tmux folder created" # symlink VSCode User Settings -ln -s $HOME/.dotfiles/code/settings.json $HOME/Library/Application\ Support/Code/User/settings.json +if [ -d $HOME/Library/Application\ Support/Code/User ] ; then + ln -s $HOME/.dotfiles/code/settings.json $HOME/Library/Application\ Support/Code/User/settings.json + success "symlink for vs code settings created" +else + info "symlink for vs code settings not created" + echo "VS Code does not appear to be installed or has not been launched yet. Cannot create symlink for VS Code User settings..." +fi # install Source Code Pro nerd font cp $HOME/.dotfiles/Source\ Code\ Pro\ Nerd\ Font\ Complete.ttf /Library/Fonts +success "Source Code Pro font copied successfully!" + +# .config permissions fix +sudo chown $(whoami) $HOME/.config +success '.config permissions fixed' + +# airport symlink +if ! [ -f /usr/local/bin/airport ] + then + sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport + success "symlink for airport created" + else + info "symlink for airport already exists" + fi + +# crontab additions +add_line "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + if [[ $? -eq 0 ]] + then + success "$PATH added to crontab" + else + info "ERROR $PATH could not be added to crontab" + fi -# # iterm2 config -# echo '' -# read -p "Do you currently use iTerm2 and would you like to set jldeen's custom colors? y/n" -n 1 -r -# echo '' -# if [[ $REPLY =~ ^[Yy]$ ]] -# then -# # Specify the preferences directory -# defaults write com.googlecode.iterm2.plist PrefsCustomFolder -string "$HOME/.itermcfg/" -# # Tell iTerm2 to use the custom preferences in the directory -# defaults write com.googlecode.iterm2.plist LoadPrefsFromCustomFolder -bool true -# if [[ $? -eq 0 ]] -# then -# echo "Successfully configured iTerm2 to use jldeen's custom colors..." -# else -# echo "Failed to apply jldeen's custom colors..." >&2 -# fi -# else -# echo "You chose not to use iTerm2 or jldeen's custom colors." -# fi +add_cron "speedtest-cli --simple > ~/bin/bandwidth.log" + if [[ $? -eq 0 ]] + then + success "crontab created for speedtest cli --simple" + else + info "ERROR crontab could not be created for speedtest cli --simple" + fi + +add_cron "speedtest-cli --json > ~/bin/bandwidth.json" + if [[ $? -eq 0 ]] + then + success "crontab created for speedtest cli --json" + else + info "ERROR crontab could not be created for speedtest cli --json" + fi + +# first run of speedtest-cli +echo "Running speedtest-cli for tmux status bar data now..." +speedtest-cli --simple > ~/bin/bandwidth.log +success "speedtest-cli bandwidth.log created" + +speedtest-cli --json > ~/bin/bandwidth.json +success "speedtest-cli bandwidth.json created" + +# iterm2 config +echo '' +read -p "Do you currently use iTerm2 and would you like to set jldeen's custom colors? y/n" -n 1 -r +echo '' +if [[ $REPLY =~ ^[Yy]$ ]] +then + # Specify the preferences directory + defaults write com.googlecode.iterm2 PrefsCustomFolder -string "$HOME/.itermcfg/" + # Tell iTerm2 to use the custom preferences in the directory + defaults write com.googlecode.iterm2 LoadPrefsFromCustomFolder -bool true + if [[ $? -eq 0 ]] + then + success "successfully configured iTerm2 to use jldeen's custom colors..." + else + fail "failed to apply jldeen's custom colors..." >&2 +fi +else + echo "You chose not to use iTerm2 or jldeen's custom colors." +fi echo '' -echo ' All installed!' +echo ' Badass macOS terminal installed!' \ No newline at end of file diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink index 6a6db522..d26de5ac 100644 --- a/tmux/tmux.conf.symlink +++ b/tmux/tmux.conf.symlink @@ -24,31 +24,13 @@ setw -g xterm-keys on # Mouse support ---------------------------------------------------------- set -g mouse on +bind-key -T copy-mode-vi WheelUpPane send -X scroll-up +bind-key -T copy-mode-vi WheelDownPane send -X scroll-down # # Vi copypaste setw -g mode-keys vi - -## Clipboard integration - -# Selection with mouse should copy to clipboard right away, in addition to the default action. -# Unbind the default action first. - -#### Doesn't work yet -#unbind -n -Tcopy-mode-vi MouseDragEnd1Pane -#bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null" -#### - -# Copy mode copy should also copy it to the clipboard as well. - -#### Doesn't work yet -#unbind -Tcopy-mode-vi Enter -#bind -Tcopy-mode-vi Enter send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null" -#### - -# Right click to paste from the clipboard -# If you like middle click better, change MouseDown3Pane to MouseDown2Pane for middle click. -unbind-key MouseDown3Pane -bind-key -n MouseDown3Pane run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" +bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" \; display-message "highlighted selection copied to system clipboard" # Easy-to-remember split pane commands bind \ split-window -h -c '#{pane_current_path}' # vertical pane diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 1aae0216..f441bc5f 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -42,6 +42,9 @@ set laststatus=2 " Set line number set number +" allow backspacing over everything in insert mode +set backspace=indent,eol,start + " Nerdtree Settings set mouse=a autocmd VimEnter * NERDTree | wincmd p diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 15548a12..1300a06a 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -28,23 +28,11 @@ POWERLEVEL9K_PROMPT_ON_NEWLINE=true POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='' POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=($'%F{red} \uf1d0 %f %F{yellow}❯ ') -POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) -POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history) - -# # Refresh Function - https://babushk.in/posts/renew-environment-tmux.html -# if [ -n "$TMUX" ]; then -# function refresh { -# export $(tmux show-environment | grep "^SSH_AUTH_SOCK") -# export $(tmux show-environment | grep "^DISPLAY") -# } -# else -# function refresh { } -# fi +POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_writable vcs) +POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history kubecontext) -# # Then, I define a preexec hook that calls refresh before each new command that gets executed: -# function preexec { -# refresh -# } +POWERLEVEL9K_KUBECONTEXT_BACKGROUND='004' +POWERLEVEL9K_KUBECONTEXT_FOREGROUND='000' # POWERLEVEL9K_TIME_FORMAT="%D{%T | %m.%d.%y}" ## @@ -98,6 +86,7 @@ plugins=(sudo git history taskwarrior tmux tmuxinator zsh-autosuggestions) source $ZSH/oh-my-zsh.sh source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +source $HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh # User configuration @@ -136,5 +125,4 @@ alias k="kubectl" # export GOROOT=/usr/local/opt/go/libexec # az cli -autoload bashcompinit && bashcompinit -source /usr/local/etc/bash_completion.d/az +autoload bashcompinit && bashcompinit \ No newline at end of file