Update dotfiles for new macbook

This commit is contained in:
Tyrel Souza 2017-08-16 09:50:12 -04:00
parent c8eb78e1f0
commit 4e0b364555
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
14 changed files with 113 additions and 132 deletions

View File

@ -1,7 +0,0 @@
#!/bin/bash
git checkout $1
git tag archive/$1 $1
git push origin --tags
git checkout -
git branch -D $1
git push origin :$1

70
bin/last_status.py Normal file
View File

@ -0,0 +1,70 @@
import argparse
import json
import os
import pylast
from slacker import Slacker
from sys import platform as _platform
import time
LASTFM_USER= os.environ['LASTFM_USER']
LASTFM_API_KEY = os.environ['LASTFM_API_KEY']
LASTFM_API_SECRET = os.environ['LASTFM_API_SECRET']
SLACK_OAUTH_TOKEN = os.environ['SLACK_OAUTH_TOKEN']
# You have to have your own unique two values for API_KEY and API_SECRET
# Obtain yours from http://www.last.fm/api/account/create for Last.fm
SESSION_KEY_FILE = os.path.join(os.path.expanduser("~"), ".lastfm_session_key")
def set_status(text, emoji=''):
for token in SLACK_OAUTH_TOKEN.split(" "):
slack = Slacker(token)
# print slack.users.profile.get()
status = json.dumps({'status_text':text, u'status_emoji':emoji})
# print status
slack.users.profile.set(profile=status)
def get_session_key():
if not os.path.exists(SESSION_KEY_FILE):
skg = pylast.SessionKeyGenerator(network)
url = skg.get_web_auth_url()
print(
"Please authorize the scrobbler "
"to scrobble to your account: %s\n" % url)
import webbrowser
webbrowser.open(url)
while True:
try:
session_key = skg.get_web_auth_session_key(url)
fp = open(SESSION_KEY_FILE, "w")
fp.write(session_key)
fp.close()
break
except pylast.WSError:
time.sleep(1)
else:
session_key = open(SESSION_KEY_FILE).read()
return session_key
if __name__ == '__main__':
network = pylast.LastFMNetwork(LASTFM_API_KEY, LASTFM_API_SECRET)
network.session_key = get_session_key()
user = network.get_user(LASTFM_USER)
playing_track = None
try:
new_track = user.get_now_playing()
title = new_track.get_title()
artist = new_track.get_artist().name
text = "{}: {}".format(artist, title)
print(text)
set_status(text, ':musical_note:')
except Exception as e:
print(e)
set_status('', '')

View File

@ -7,7 +7,7 @@ gnu-sed
graphviz graphviz
homebrew/versions/gnupg21 homebrew/versions/gnupg21
htop-osx htop-osx
mariadb mariadb@10.1
mtr mtr
nmap nmap
openssl openssl
@ -20,3 +20,4 @@ vim
watch watch
wget wget
zsh-completions zsh-completions
diff-so-fancy

View File

@ -1 +0,0 @@
display notification \"Your free upgrade to Windows 10 is ready. Please click here to start the download.\" with title \"Microsoft\"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
if [ -e bin/update_dependencies.sh ]; then #if [ -e bin/update_dependencies.sh ]; then
bin/update_dependencies.sh # bin/update_dependencies.sh
fi #fi

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
if [ -e bin/update_dependencies.sh ]; then #if [ -e bin/update_dependencies.sh ]; then
bin/update_dependencies.sh # bin/update_dependencies.sh
fi #fi

View File

@ -1,17 +1,17 @@
#!/bin/bash #!/bin/bash
protected_branch='master' #protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') #current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
#
if [ $protected_branch = $current_branch ] #if [[ $current_branch = *"$protected_branch"* ]]
then #then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty # read -p "You're about to push $current_branch, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo # echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null # if echo $REPLY | grep -E '^[Yy]$' > /dev/null
then # then
exit 0 # push will execute # exit 0 # push will execute
fi # fi
exit 1 # push will not execute # exit 1 # push will not execute
else #else
exit 0 # push will execute # exit 0 # push will execute
fi #fi

View File

@ -3,7 +3,9 @@
[user] [user]
email = tyrelsouza@gmail.com email = tyrelsouza@gmail.com
name = Tyrel Souza name = Tyrel Souza
signingkey = 8A2DDEE2 signingkey = C30AEAC0
[includeIf "gitdir:/code/addgene/"]
path = ~/.gitconfig-addgene
[commit] [commit]
gpgsign = true gpgsign = true
[color] [color]
@ -19,9 +21,11 @@
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
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! 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"
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
@ -30,6 +34,8 @@
p = push p = push
pr = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr" 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*)
rl = !git log $(git describe --tags --abbrev=0 --match v*)..
scrum = log --since='1 day ago' --author='Tyrel Souza' --oneline 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

View File

@ -3,18 +3,12 @@ set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible' 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'
# Configs # Configs
set -g @themepack 'powerline/double/cyan' set -g @themepack 'powerline/double/cyan'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
set -g status-right '#{battery_status_bg} Batt: #{battery_icon} #{battery_percentage} #{battery_remain} | %a %h-%d %H:%M ' set -g status-right '#{battery_status_bg} Batt: #{battery_icon} #{battery_percentage} #{battery_remain} | %a %h-%d %H:%M '
set -g @batt_charged_icon "😎" set -g @batt_charged_icon "😎"
@ -23,7 +17,5 @@ set -g @batt_discharging_icon "👎"
set -g @batt_attached_icon "😐" 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'

@ -1 +1 @@
Subproject commit 9a4e6ef8e467a1f78aa881018f5ed4efca88f6ef Subproject commit 8fa3b627b6acc8fb2560b843c47927514bc5fa1d

2
vimrc
View File

@ -162,3 +162,5 @@ let g:session_autoload = 'no'
let g:airline#extensions#tabline#fnamemod = ':.' let g:airline#extensions#tabline#fnamemod = ':.'
let g:ctrlp_working_path_mode = 0 let g:ctrlp_working_path_mode = 0
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git|.pyc' let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git|.pyc'
set timeoutlen=100 ttimeoutlen=10

View File

@ -7,9 +7,10 @@ zstyle ':prezto:load' pmodule \
'history-substring-search' \ 'history-substring-search' \
'utility' \ 'utility' \
'completion' \ 'completion' \
'tmux' \
'git' \ 'git' \
'prompt' 'python' \
'prompt' \
'tmux'
zstyle ':prezto:module:autosuggestions:color' found '' zstyle ':prezto:module:autosuggestions:color' found ''
zstyle ':prezto:module:editor' key-bindings 'emacs' zstyle ':prezto:module:editor' key-bindings 'emacs'

92
zshrc
View File

@ -1,92 +1,6 @@
export ZSH=$HOME/.oh-my-zsh if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
plugins=(git sudo github django python pip cp vagrant virtualenv nmap rvm) source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
ZSH_THEME="soliah"
else
ZSH_THEME="tyrel"
export VIRTUAL_ENV_DISABLE_PROMPT=1
fi fi
export EDITOR=vim source ~/.zshrc.local
export GOPATH=$HOME/go
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LESS=' -R '
export LESSOPEN="| /usr/local/bin/src-hilite-lesspipe.sh %s"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
export NPM_PACKAGES="${HOME}/.npm-packages"
export PHP_AUTOCONF="/usr/local/bin/autoconf"
# Virtualenv + Wrapper
export PROJECT_HOME=$HOME/AddGeneProjects
export WORKON_HOME=$HOME/.virtualenvs
if [ -e $HOME/.local/bin/virtualenvwrapper.sh ];then
source $HOME/.local/bin/virtualenvwrapper.sh
fi
if [ -e /usr/local/bin/virtualenvwrapper.sh ]; then
source /usr/local/bin/virtualenvwrapper.sh
fi
export PATH="$NPM_PACKAGES/bin:$GOPATH/bin:$HOME/bin:$PATH"
if [[ $OSTYPE == "*darwin*" ]];then
export PATH="/usr/local/opt/gnupg/libexec/gpgbin:$PATH"
fi
#
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa
fi
#
if [ -e ~/.ssh/id_addgene ];then
ssh-add ~/.ssh/id_addgene
fi
export MP_FULLNAME="Tyrel Souza"
function adg () {
workon addgene-core
}
function ipa(){
ifconfig | grep inet
}
function cpbr () {
if branch=$(git symbolic-ref --short -q HEAD)
then
printf "$branch" | pbcopy
osascript -e "display notification \"$branch copied to clipboard\" with title \"cpbr\""
else
echo "no branch, can't copy"
fi
}
function hidden() { ls -a "$@" | grep '^\.'; }
if [ -e ~/.zshrc.local ];then
source ~/.zshrc.local
fi
# Sourcing aliases
source ~/.bash_aliases
source $HOME/.profile
if [ -e $HOME/.credentials ];then
source $HOME/.credentials
fi
export PYTHONSTARTUP=$HOME/.pythonstartup.py
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 dots(){
cd $(dirname `readlink ~/.zshrc`)
}
eval "$(pyenv init -)"

View File

@ -34,6 +34,9 @@ if [[ $OSTYPE == "darwin*" ]];then
export LDFLAGS="-L/usr/local/opt/icu4c/lib" export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include" export CPPFLAGS="-I/usr/local/opt/icu4c/include"
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig" export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
#LDFLAGS: -L/usr/local/opt/mariadb@10.1/lib
#CPPFLAGS: -I/usr/local/opt/mariadb@10.1/include
#PKG_CONFIG_PATH: /usr/local/opt/mariadb@10.1/share/pkgconfig
fi fi
export PATH="$HOME/.Pokemon-Terminal:$PATH" export PATH="$HOME/.Pokemon-Terminal:$PATH"