This commit is contained in:
Tyrel Souza 2019-02-25 14:42:07 -05:00
parent 8402cd961f
commit 3c25b92909
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
16 changed files with 185 additions and 40 deletions

View File

@ -1,30 +1,17 @@
#!/usr/local/bin/zsh #!/usr/local/bin/zsh
# Aliases # Aliases
alias adg="workon addgene-core"
alias adocs='cd $ADDGENE_CORE_REPO_DIR/docs && make html && open $ADDGENE_CORE_REPO_DIR/docs/build/html/index.html'
alias aenv='env | sort | grep ADDGENE'
alias ag='\ag --pager="less"' alias ag='\ag --pager="less"'
alias cat='bat'
alias cg='cd "$(git rev-parse --show-toplevel)"' alias cg='cd "$(git rev-parse --show-toplevel)"'
alias ctags="`brew --prefix`/bin/ctags" alias ctags="`brew --prefix`/bin/ctags"
alias dots="cd $(dirname `readlink ~/.vim`)" alias dots="cd $(dirname `readlink ~/.vim`)"
alias g='git' alias g='git'
alias gp='git push' alias gp='git push'
alias pdb="python -m pdb"
alias ppjson="python -m json.tool" alias ppjson="python -m json.tool"
alias shrug="echo -n '¯\_(ツ)_/¯' | pbcopy" alias shrug="echo -n '¯\_(ツ)_/¯' | pbcopy"
alias sl="source local.env" alias httpie="http"
alias stabbats='sudo killall VDCAssistant && open https://appear.in/stab-bats'
# Functions # Functions
function adtest () {
no_slashes="$(echo "$1" | sed -e 's/\//\./g')";
a_test="$(echo "$no_slashes" | sed -e 's/.py//g')";
a_project=$(echo -n "$a_test" | python -c "import sys; print sys.stdin.read().split('.', 1)[0]");
run_test=$(echo "bin/manage_$a_project.py test $a_test");
echo "Evaling $run_test";
eval $run_test;
}
function cpbr () { function cpbr () {
if branch=$(git symbolic-ref --short -q HEAD) if branch=$(git symbolic-ref --short -q HEAD)
then then
@ -43,9 +30,30 @@ function h () {
history | egrep "$@" history | egrep "$@"
fi fi
} }
settitle() {
printf "\033k$1\033\\"
}
tide() {
for var in "$@"
do
tmux new-window -c "/code/tidelift/$var" -n "$var"
printf "\033k$var\033\\"
done
}
# options # options
export LESS=-RFX export LESS=-RFX
export PAGER="less" export PAGER="less"
alias love="/Applications/love.app/Contents/MacOS/love" alias love="/Applications/love.app/Contents/MacOS/love"
pullall (){
for d in ./*/ ; do (cd "$d" && pwd && git pull); done
}
new_dock_space (){
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
}

2
bin/SC
View File

@ -2,7 +2,7 @@
set -e set -e
FILENAME="/Users/tyrel/tmp/screenshot.png" FILENAME="/Users/tyrel/tmp/screenshot.png"
screencapture -i $FILENAME screencapture -io $FILENAME
sleep 1 sleep 1

56
bin/old.py Normal file
View File

@ -0,0 +1,56 @@
import os
def get_ssh_keys():
key_out = os.popen('ssh-add -l').read()
keylist = key_out.split("\n")[:-1]
keys = []
for key in keylist:
key = key.split(" ")[2]
keys.append(key)
return keys
def _map_list_to_numbers(option):
"""Get a dictionary of strings mapping to indexes of the list."""
enumerated_options = []
index = 1
indexMapping = {}
for i, appname in enumerate(option):
enumerated_options.append('{0:3d} - {1}'.format(index, appname))
indexMapping[str(index)] = i
index += 1
return indexMapping, "\n".join(enumerated_options)
def _keys():
keys = get_ssh_keys()
if len(keys) == 1:
return keys, None, None
mapping, key_strings = _map_list_to_numbers(keys)
return keys, mapping, key_strings
def _prompt_key():
""" Prompt for which heroku app, retries if fails"""
options, mapping, option_strings = _keys()
if not options:
return None
if len(options) == 1:
print "Using SSH Private Key {0}".format(options[0])
return options[0]
print option_strings
while True:
try:
index = raw_input(
"Work with which Private Key? (Type a number) (Ctrl+C to cancel): ").rstrip("\n")
option = options[mapping[index]]
except KeyError:
print "Invalid Option, try again (Ctrl+C to cancel)"
continue
break
return option

1
bin/pre-commit Symbolic link
View File

@ -0,0 +1 @@
/Users/tyrel/.pre-commit-venv/bin/pre-commit

2
bin/startemacs.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
emacsclient --create-frame --alternate-editor=""

View File

@ -3,7 +3,7 @@ set -e
MD5=($(md5 -q "$@")) MD5=($(md5 -q "$@"))
fname=$MD5."${1##*.}" fname=$MD5."${1##*.}"
scp -rp "$1" vpsimgs:/var/www/html/screenshots/$fname; scp -rp "$1" vps:/www/tyrelsouza.com/screenshots/$fname;
osascript -e "display notification \"Uploaded $1 to https://tyrelsouza.com/screenshots/$fname\" with title \"Tyrel Upload\"" osascript -e "display notification \"Uploaded $1 to https://tyrelsouza.com/screenshots/$fname\" with title \"Tyrel Upload\""
echo https://tyrelsouza.com/screenshots/$fname | pbcopy echo https://tyrelsouza.com/screenshots/$fname | pbcopy
rm "$1" rm "$1"

View File

@ -1,13 +1,12 @@
[core] [core]
excludesfile = ~/.gitignore_global excludesfile = /Users/tyrel/.gitignore_global
[user] [user]
email = tyrelsouza@gmail.com email = tyrelsouza@gmail.com
name = Tyrel Souza name = Tyrel Souza
signingkey = C30AEAC0 signingkey = C30AEAC0
[includeIf "gitdir:/code/addgene/"]
path = ~/.gitconfig-addgene
[commit] [commit]
gpgsign = true gpgsign = true
template = /Users/tyrel/.stCommitMsg
[color] [color]
ui = auto # covers diff = true, status = auto, branch = auto ui = auto # covers diff = true, status = auto, branch = auto
interactive = auto interactive = auto
@ -18,42 +17,59 @@
[format] [format]
pretty = format:%C(auto)%h %C(green)%G? %C(red)%<(15,trunc)%aN %C(cyan)%<(15,trunc)%ar %C(white)%<(60,trunc)%s %C(auto)%d pretty = format:%C(auto)%h %C(green)%G? %C(red)%<(15,trunc)%aN %C(cyan)%<(15,trunc)%ar %C(white)%<(60,trunc)%s %C(auto)%d
[alias] [alias]
comit = commit
ab = "diff --name-only origin/master" ab = "diff --name-only origin/master"
alias = "!git config -l | grep alias | cut -c 7-" # show all these aliases alias = "!git config -l | grep alias | cut -c 7-" # show all these aliases
bc = !git branch --merged master | grep -v master | xargs git branch -d # delete all merged branches bc = !git branch --merged master | grep -v master | xargs git branch -d # delete all merged branches
bcc = !git branch -vv | grep ': gone' | cut -d' ' -f1-3 | grep -v master | xargs git branch -D bcc = !git branch -vv | grep ': gone' | cut -d' ' -f1-3 | grep -v master | xargs git branch -D
d = diff --color-words # prettier diffs d = diff --color-words # prettier diffs
dsf = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd "$GIT_PREFIX"; git diff --color $@ | diff-so-fancy | less --tabs=4 -RFX; }; f" # Diff so fancy!
files = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat # Show files modified per commit files = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat # Show files modified per commit
lf = "!git diff --name-only origin/master | grep -v .tsv | grep -v .sql" lf = "!git diff --name-only origin/master" # Show all file differing from origin/master
ll = log --stat --abbrev-commit # Way more information on git log ll = log --stat --abbrev-commit # Way more information on git log
lb = log --stat --no-merges origin/master.. lb = log --stat --no-merges origin/master..
logtree= "log --graph --oneline --decorate --all" # show a tree with branches merging logtree= "log --graph --oneline --decorate --all" # show a tree with branches merging
ob = "!$EDITOR $(git diff --name-only origin/master | grep -v .tsv | grep -v .sql | grep -v static)" ob = "!$EDITOR $(git diff --name-only origin/master)" # Open all files in editor that differ between origin/master and staged/unstaged
od = "!$EDITOR $(git diff --name-only HEAD | grep -v .tsv | grep -v .sql | grep -v static)" oscar = "!git commit --amend --author='Oscar Spencer <oscar@tidelift.com>'"
od = "!$EDITOR $(git diff --name-only HEAD)" # Open all changed files differ from current HEAD
p = push p = push
pr = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr"
recent = "!git for-each-ref --format=\"%(committerdate:relative) | %(refname)\" --sort=-committerdate refs/heads | sed '/master/d' | head -n 15" # get the most 10 recent branches worked on recent = "!git for-each-ref --format=\"%(committerdate:relative) | %(refname)\" --sort=-committerdate refs/heads | sed '/master/d' | head -n 15" # get the most 10 recent branches worked on
rd = !git diff $(git describe --tags --abbrev=0 --match v*) scrum = log --since='1 day ago' --author='Tyrel Souza' --oneline
rl = !git log $(git describe --tags --abbrev=0 --match v*)..
scrum = log --since='1 day ago' --author='Tyrel Souza' --oneline
st = status # alias like `hg st`, because I like st, shorter is nice! st = status # alias like `hg st`, because I like st, shorter is nice!
tabs = "!git diff --color | sed 's/\t/⌑/g'" # show tabs with ⌑ replacing tabs tabs = "!git diff --color | sed 's/\t/⌑/g'" # show tabs with ⌑ replacing tabs
v=describe --tags --match 'v*' # show the current version tag v=describe --tags --match 'v*' # show the current version tag
# rd = !git diff $(git describe --tags --abbrev=0 --match v*)
# rl = !git log $(git describe --tags --abbrev=0 --match v*)..
# pr = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr"
# dsf = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd "$GIT_PREFIX"; git diff --color $@ | diff-so-fancy | less --tabs=4 -RFX; }; f" # Diff so fancy!
[filter "lfs"] [filter "lfs"]
clean = git-lfs clean %f clean = git-lfs clean %f
smudge = git-lfs smudge %f smudge = git-lfs smudge %f
required = true required = true
[color "diff-highlight"] [color "diff-highlight"]
oldNormal = red bold oldNormal = red bold
oldHighlight = red bold 52 oldHighlight = red bold 52
newNormal = green bold newNormal = green bold
newHighlight = green bold 22 newHighlight = green bold 22
[init] [init]
templatedir = ~/.git_template templatedir = ~/.git_template
[difftool "sourcetree"] [difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\" cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path = path =
[mergetool "sourcetree"] [mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true trustExitCode = true
[diff]
tool = meld
[difftool]
prompt = false
[difftool "meld"]
trustExitCode = true
cmd = open -W -a Meld --args \"$LOCAL\" \"$REMOTE\"
[merge]
tool = meld
[mergetool]
prompt = false
[mergetool "meld"]
trustExitCode = true
cmd = open -W -a Meld --args --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output=\"$MERGED\"

View File

@ -1,3 +1,4 @@
.idea
*.DS_Store *.DS_Store
.tags .tags
.tags_sorted* .tags_sorted*
@ -15,3 +16,4 @@ release_package.sh
local.fish local.fish
local.env local.env
vim/sessions vim/sessions
.vs/

View File

@ -4,6 +4,7 @@ set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'jimeh/tmux-themepack' set -g @plugin 'jimeh/tmux-themepack'
set -g @plugin 'tmux-plugins/tmux-battery' set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-ressurect' set -g @plugin 'tmux-plugins/tmux-ressurect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Configs # Configs
@ -19,3 +20,15 @@ set -g @batt_attached_icon "😐"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm' run '~/.tmux/plugins/tpm/tpm'
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"# Split panes horizontal
bind - split-window -v -c "#{pane_current_path}"# Split panes vertically
set -g @continuum-restore 'on'
set-option -g default-command "reattach-to-user-namespace -l zsh"
set-option -g set-titles on

@ -0,0 +1 @@
Subproject commit 90f4a00c41de094864dd4e29231253bcd80d4409

@ -1 +1 @@
Subproject commit 526110eb9b60825d3276afba97ffa4cedb4b0ab9 Subproject commit e91b178ff832b7bcbbf4d99d9f467f63fd1b76b5

@ -1 +1 @@
Subproject commit c8ac32a085d382c43190bda4fb5972e531f501fd Subproject commit 95f78336c3972f3e6648b7b3db754f2224320a5e

View File

@ -8,6 +8,7 @@ zstyle ':prezto:load' pmodule \
'utility' \ 'utility' \
'completion' \ 'completion' \
'git' \ 'git' \
'ruby' \
'prompt' \ 'prompt' \
'tmux' 'tmux'

0
zprofile.local Normal file
View File

39
zshrc
View File

@ -4,3 +4,42 @@ fi
source ~/.zshrc.local source ~/.zshrc.local
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export EDITOR="vim"
eval "$(direnv hook zsh)"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
eval "$(pyenv init -)"
export PATH="$HOME/.rvm/bin:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/tyrel/Downloads/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/tyrel/Downloads/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/tyrel/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/tyrel/Downloads/google-cloud-sdk/completion.zsh.inc'; fi

View File

@ -21,7 +21,7 @@ export PYTHONSTARTUP=$HOME/.pythonstartup.py
# Node stuff # Node stuff
export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH" export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
export NPM_PACKAGES="${HOME}/.npm-packages" export NPM_PACKAGES="${HOME}/.npm-packages"
export PATH="$NPM_PACKAGES/bin:$GOPATH/bin:$HOME/bin:$PATH" export PATH="$HOME/bin:$PATH"
export PATH="/usr/local/opt/python/libexec/bin:$PATH" export PATH="/usr/local/opt/python/libexec/bin:$PATH"
# Go Stuff # Go Stuff
@ -45,3 +45,9 @@ fi
source ~/.bash_aliases source ~/.bash_aliases
unsetopt share_history unsetopt share_history
export PATH=/usr/local/bin:$PATH export PATH=/usr/local/bin:$PATH
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/tyrel/Downloads/google-cloud-sdk/path.zsh.inc' ]; then source '/Users/tyrel/Downloads/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/tyrel/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/tyrel/Downloads/google-cloud-sdk/completion.zsh.inc'; fi