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3EJG6TALMPOONXZYPFKAS5UTAC
5BU7HOAEIRC3FQHV2QP4KXSO7B3EPJ3FTR57RVMJ2HZN4ERGKHKAC
4DKZCHE3SKQ5Y5R3Q2LU6UAB55UPUZ5RFKHP26SZXZ4EKGOYITWAC
if test `uname` = "Darwin"; then
alias copy=pbcopy
alias paste=pbpaste
# open finder in $PWD
alias finder="open -a Finder ."
# change directories into the directory of top most finder window
alias cdfinder="cd `osascript < $DOTFILES/applescripts/finder_cwd.applescript`"
function preview {
# open a file in the default macOS preview
qlmanage -p "$@" &> /dev/null
}
function trash {
# put a file in the macOS default trash folder
command mv "$@" ~/.Trash
}
function toggle_desktop_icons {
enable="false"
case `defaults read com.apple.finder CreateDesktop 2> /dev/null` in
0) enable="true";;
1) enable="false";;
*)
esac
defaults write \
com.apple.finder \
CreateDesktop -bool $enable \
&& killall Finder
}
function toggle_autocorrect_mode {
enable="false"
case `defaults read -g NSAutomaticSpellingCorrectionEnabled 2> /dev/null` in
0) enable="true";;
1) enable="false";;
esac
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool $enable
}
function toggle_system_ui_keyboard_behavior {
# 0 is default, 3 enables things like tab in system dialogs
# https://github.com/herrbischoff/awesome-macos-command-line#full-keyboard-access
value=0
case `defaults read NSGlobalDomain AppleKeyboardUIMode 2> /dev/null` in
0) value=3;;
3) value=0;;
*) value=0;;
esac
defaults write NSGlobalDomain AppleKeyboardUIMode -int $value
}
else
which xsel &> /dev/null && \
alias copy='xsel --clipboard --input' && \
alias paste='xsel --clipboard --output'
# prefer xclip if installed
which xclip &> /dev/null && \
alias copy='xclip -selection clipboard' && \
alias paste='xclip -selection clipboard -o'
fi
alias cp='cp -iv' # verbose and warning
alias mv='mv -iv' # verbose and warning
alias mkdir='mkdir -pv' # verbpose and make path
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
MY_ZSH_FUNCTIONS=$DOTFILES/zsh/functions
fpath=($MY_ZSH_FUNCTIONS $fpath)
for func in $(ls $MY_ZSH_FUNCTIONS); do autoload $func; done;
my_funcs=$DOTFILES/zsh/functions
fpath=($my_funcs $fpath)
for func in $(ls $my_funcs); do autoload $func; done;
#! /bin/bash
stderr_log=/tmp/install_important_packages_errors.log
stdout_log=/tmp/install_important_packages.log
function _trim {
# remove blank lines, leading and trailing whitespace
sed '/^$/d' | sed -e 's/^ *//' | sed -e 's/ *$//'
}
function _filter_known_ok {
# filter out log messages known to be ok
_trim < $1 | \
grep -v "brew upgrade " | \
grep -v "already installed" | \
egrep -iv "re-?install" | \
egrep -v "info: (latest)|(downloading)|(installing)|(default)"
}
function install_everything {
###################
# install homebrew
###################
which brew &> /dev/null || \
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# NOTE: don't try to be smart with OS, let brew decide what it can and can't install
###################
# install packages
###################
echo -n '
coreutils
curl
fd
fish
fzf
go
lastpass-cli
moreutils
mycli
neovim
node
ripgrep
sd
the_silver_searcher
tmux
wget
zsh
' | _trim | xargs brew install
###################
# install gui apps
###################
echo -n '
firefox
flux
flycut
spectacle
' | _trim | xargs brew cask install
#################################
# install apps from special taps
#################################
brew list | grep -q emacs-plus || \
(brew tap d12frosted/emacs-plus && brew install emacs-plus)
####################
# install oh-my-zsh
####################
test -d $HOME/.oh-my-zsh || \
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
####################
# install spacemacs
####################
emacs_d=$HOME/.emacs.d
test -d $emacs_d || \
git clone https://github.com/syl20bnr/spacemacs $emacs_d
######################################
# install vim-plug for vim and neovim
######################################
vim_plug_file=$HOME/.vim/autoload/plug.vim
test -f $vim_plug_file || \
curl -fLo $vim_plug_file --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
nvim_plug_file=$HOME/.local/share/nvim/site/autoload/plug.vim
test -f $nvim_plug_file || \
curl -fLo $nvim_plug_file --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
################
# install pyenv
################
test -d $HOME/.pyenv || \
curl https://pyenv.run | bash
#################
# install rustup
#################
which rustup &> /dev/null || \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
}
function on_success {
if test $(
_filter_known_ok $stderr_log | wc -l
) -eq 0; then
echo "Install completed without error."
rm $stderr_log
rm $stdout_log
return 0
else
echo "Install completed but errors were logged."
echo "See full stderr at $stderr_log"
echo "See full stdout at $stdout_log"
return 1
fi
}
function on_error {
echo "Install did not complete or partially completed with unhandled error."
echo "See full stderr at $stderr_log"
echo "See full stdout at $stdout_log"
return 2
}
# you can redirect stderr like this if you want to more easily debug:
# 2> >(tee -a $stderr_log >&2)
install_everything \
> $stdout_log \
2> $stderr_log \
&& on_success \
|| on_error
# swift repl fix - due to brew python being at the front of $PATH variable
alias swift="PATH=/usr/bin:$PATH swift"
# enable excercism cli bash completion
if [ -f ~/.config/exercism/exercism_completion.bash ]; then
source ~/.config/exercism/exercism_completion.bash
fi
# sets up the terminal to make working on a project easy
workon () {
project=$1
case $project in
"eventbrite"*)
cd $EBPATH
;;
"fastfile"*)
cd /Users/ccummings/eventbrite_github/triage_projects/jira_modal
;;
"data_nerds"*)
cd /Users/ccummings/mistahchris_github/data_nerds/
pyenv activate data_nerds
;;
"tableau_help"*)
cd /Users/ccummings/tableau_help
source ./private/config_vars.sh
source ./.profile.d/000-react-app-exports.sh
;;
esac
}
}
# pullall iterates through each immediate child directory, if it's a git repo
# switches to master branch, runs: git pull
# switches back to whatever branch it was originally
pullall () {
dir=`pwd`
echo "Begin pulling new master branch code for every child repo..."
echo "..."
for REPO in `ls -l | grep ^d | grep -oE '[^ ]+$'`;
do
echo "----------------------------"
echo ""
command -p cd "$REPO";
if [ -d ".git" ]; then
cbranch=`parseBranch`
if [ $cbranch != "master" ]; then
command git checkout "master"
fi
echo "pulling master branch of: $REPO ..."
command git pull
if [ $cbranch != "master" ]; then
command -p cd "$cbranch"
fi
fi
command -p cd $dir
done;
fi
}
update_brew_shit() {
brew outdated | fzf -m -n 1 --tac --header='Select formulae to upgrade with tab' | xargs brew upgrade
}
rgvim () {
FZF_SELECTION=$( rg -Fi "$*" | fzf -0 -1 --ansi)
if [ ! -z "$FZF_SELECTION" ]
then
vim "+/$*" $( echo "$FZF_SELECTION" | awk 'BEGIN { FS=":" } { printf "%s\n", $1 }' )
lastpass() {
CLIPBOARD_CONTENTS=`pbpaste`
`lpass show -cp $@ -G` # set the lpass cli result to clipboard
$(_sleep_then_restore_clipboard $CLIPBOARD_CONTENTS) &
}
######################
# Eventbrite FUNCTIONS
######################
alias ebpresto="presto --server http://presto.prod.dataf.eb:8080 --user ccummings"
ebpresto_csv () {
`presto --server http://presto.prod.dataf.eb:8080 --user ccummings --file $1 --output-format CSV_HEADER > query_result.csv`
}
waiting-room-qa() {
eid=$1
if [ "$eid" -eq "$eid" ] 2>/dev/null; then
while true ; do curl http://evbqa.com/queue_rpc/get/$eid; done
else
echo "Try again with a valid Eventbrite Event ID"
fi
}
tell application "Finder"
try
set curr_dir to (folder of the front window as alias)
on error
set curr_dir to (path to desktop folder as alias)
end try
POSIX path of curr_dir
end tell
bind -n M-down select-pane -D
# nova color scheme
set -g pane-border-style 'bg=black,fg=#1E272C'
set -g pane-active-border-style 'bg=black,fg=#1E272C'
set -g status-style 'bg=#1E272C,fg=#6A7D89'
set-window-option -g window-status-current-bg '#1E272C'
set-window-option -g window-status-current-fg cyan
set -wg mode-style 'bg=cyan,fg=black'
set -g message-style 'bg=black,fg=cyan'
set -g clock-mode-colour cyan
bind -n M-down select-pane -D