diff --git a/.gitignore b/.gitignore index 10bd4bebc..6d7ae549e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -# custom files -custom/ # temp files directories cache/ diff --git a/custom/aliases.zsh b/custom/aliases.zsh new file mode 100755 index 000000000..d0860eeef --- /dev/null +++ b/custom/aliases.zsh @@ -0,0 +1,20 @@ + +#API ALIASES +alias dapi='~/Projects/denim-api'; +alias activate='source ~/Projects/denim-api/.denim-api/bin/activate'; + +#FRONT-END ALIASES +alias dfe='~/Projects/denim-app'; +alias dcw='celery worker --config=app.data.celeryconfig'; +alias dfw='flower --port=5555 --config=app.data.celeryconfig'; +alias dar='python run.py'; +alias dapidev='rabbitmq-server; dcw && dfw && dar'; + +#MAC ALIASES +alias virtualenv3='~/Library/Python/3.5/bin/virtualenv'; + +alias gffs='git flow feature start' +alias gfff='git flow feature finish `git branch | sed -En "s/\* feature\/(.*)/\1/p"`; ggp' +alias ggl="git for-each-ref --sort=-committerdate refs/heads/ --format='%1B[38;5;010m%(authorname)%1B[m: [%1B[0;31m%(refname:short)%1B[m] %1B[38;5;201m%(subject)%1B[m'" + +alias ls='ls -G' diff --git a/custom/example.zsh b/custom/example.zsh deleted file mode 100644 index c505a9673..000000000 --- a/custom/example.zsh +++ /dev/null @@ -1,10 +0,0 @@ -# You can put files here to add functionality separated per file, which -# will be ignored by git. -# Files on the custom/ directory will be automatically loaded by the init -# script, in alphabetical order. - -# For example: add yourself some shortcuts to projects you often work on. -# -# brainstormr=~/Projects/development/planetargon/brainstormr -# cd $brainstormr -# diff --git a/custom/exports.zsh b/custom/exports.zsh new file mode 100755 index 000000000..9e1b68e63 --- /dev/null +++ b/custom/exports.zsh @@ -0,0 +1,4 @@ +export ZSH=$HOME/.oh-my-zsh +export PATH=$HOME/bin:/usr/local/bin:$PATH +export PATH="/usr/local/opt/python/libexec/bin:$PATH" +export ZSH_THEME="dallas" \ No newline at end of file diff --git a/custom/functions.zsh b/custom/functions.zsh new file mode 100755 index 000000000..b10d86315 --- /dev/null +++ b/custom/functions.zsh @@ -0,0 +1,88 @@ +ggp () { + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]] + then + git push origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(git_current_branch)" + git push origin "${b:=$1}" + fi +} + +function killPort(){ + lsof -i tcp:$1 | awk '{print $2}' | grep -v 'PID' | xargs kill +} + +killPort2 () { + lsof -i tcp:$1 | awk '{print $2}' | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} -v 'PID' | xargs kill -9 +} + +reset_zsh(){ + source ~/Projects/zsh-custom/init.zsh +} + +function gitUpstream() { + CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + git checkout master + git fetch upstream + git rebase upstream/master + git push origin master + git checkout "${CURRENT_BRANCH}" +} + +function gitPullRequest() { + local remote=${2:-origin} + git fetch ${remote} +refs/pull/$1/head:refs/remotes/${remote}/pr/$1 + git pull --no-rebase --squash ${remote} pull/$1/head +} + +function gitPullRequestUpstream() { + git reset --hard + gitUpstream + local remote=${2:-upstream} + git fetch ${remote} +refs/pull/$1/head:refs/remotes/${remote}/pr/$1 + git pull --no-rebase --squash ${remote} pull/$1/head +} + +function yarnVersion() { + echo "Uninstalling yarn..." + rm -f /usr/local/bin/yarnpkg + rm -f /usr/local/bin/yarn + + echo "Removing yarn cache..." + if [ -z ${YARN_CACHE_FOLDER+x} ]; then + rm -rf ${YARN_CACHE_FOLDER} + else + rm -rf ${HOME}/.yarn + fi + + echo "Installing yarn..." + curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $1 +} + +function findDepsRecrusivly(){ + cd ~/Projects + grep --include=\package.json -rnw '.' -e $1 +} + +function backupDb(){ +# host=denimsocial-beta.c5gy6o8ang2y.us-east-1.rds.amazonaws.com +# user=admin +# pass=28KBEKpwcgMQTEfd8wbvDeWN + ssh ci.denimsocial.com 'mysqldump --opt denimsocial_beta -h denimsocial-beta.c5gy6o8ang2y.us-east-1.rds.amazonaws.com --user admin -p' | gzip | aws s3 cp - s3://social-dump/beta.sql.gz +} + + +# grab master and update it. +# fetch all branches +# delete all branches merged into master +# grab develop and update it +# delete all branches merged into develop +function git_clean_local(){ + git checkout master && git pull origin master && git fetch -p && git branch -d $(git branch --merged | grep master -v); + git checkout develop && git pull origin develop && git fetch -p && git branch -d $(git branch --merged | grep develop -v); +} + +# show local branches and when they were created +function git_branch_history(){ + for k in $(git branch | sed s/^..//); do echo -e $(git log --color=always -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --)\\t"$k";done | sort +} \ No newline at end of file diff --git a/custom/plugins.zsh b/custom/plugins.zsh new file mode 100755 index 000000000..bf96e1b2b --- /dev/null +++ b/custom/plugins.zsh @@ -0,0 +1,14 @@ +PLUGINS_DIR=$ZSH/plugins +source $PLUGINS_DIR/git/git.plugin.zsh +source $PLUGINS_DIR/z/z.plugin.zsh + +if [ ! -d "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions" ]; then +# Take action if $DIR exists. # +echo "Installing zsh autosuggestions..." + git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +else + source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh +fi + + +eval "$(gh completion -s zsh)" diff --git a/custom/plugins/example/example.plugin.zsh b/custom/plugins/example/example.plugin.zsh deleted file mode 100644 index 406f27445..000000000 --- a/custom/plugins/example/example.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Add your own custom plugins in the custom/plugins directory. Plugins placed -# here will override ones with the same name in the main plugins directory. diff --git a/custom/plugins/zsh-auto-nvm-use b/custom/plugins/zsh-auto-nvm-use new file mode 160000 index 000000000..539ad85cc --- /dev/null +++ b/custom/plugins/zsh-auto-nvm-use @@ -0,0 +1 @@ +Subproject commit 539ad85cc5bd7bb9d2ee940390678760459f75c2 diff --git a/custom/plugins/zsh-autosuggestions b/custom/plugins/zsh-autosuggestions new file mode 160000 index 000000000..a411ef3e0 --- /dev/null +++ b/custom/plugins/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8 diff --git a/custom/secrets.zsh b/custom/secrets.zsh new file mode 100755 index 000000000..b53937a7d --- /dev/null +++ b/custom/secrets.zsh @@ -0,0 +1,16 @@ + +export GOOGLE_MAPS_KEY='AIzaSyC_amaqk2zvjFaxRQsNe1RlQsd2LQDHQvU' +export MAIL_PASS='duvrtRuWdnKgkf4GEe[LBwcHTBEc' +export MAIL_FROM='noreply@denimlabs.com' +export CSE_API_KEY='AIzaSyAGtVgkxshncV0d2r0J5EaeO-IzGuAoZoY' +export CSE_ID='011491340340727568483:21aexljjiig' +export FB_ADMIN_TOKEN='EAASqT3VilxUBAJS9VUWGzZCZBOQ516rmJk7TaHaSP5oGDTLzNxw8qnt5DU4EhyyL4ctscpDI7TQ176XHx18EteB17dqDOVydgxRNjd98XmmJEx04oVZCaLooI2Qscexfs8JzNWnjpZAgjW5mxq1QNM4ZAtu4on3LXUhOgp1QZCN8k8gByyjgrW' +export FB_ADMIN_APPSECRET_PROOF='b5c4f527ec33457e9e9923e81096a75e4ca3823d56e0c82b8467298108cc11f3' +export FB_BUSINESS_ID='1704512749835563' +export FB_APP_SECRET='6e6f5facf2dcbe12c5f114574d8264d0' +export NPM_TOKEN="532aedef-30f6-4f7c-9786-24a7585c23d1" +export ATLAS_API_KEY='3g2r5lMiT2cV9iDv9yHfnoVmHK0RHaGdzO6D5AUcF8n79QvqZN3y364l0dwtkMyx' +# export AWS_ACCESS_KEY_ID="ASIA3E4CFGJKJ2SRH2WV" +# export AWS_SECRET_ACCESS_KEY="NQKMB3dsFYa91PiwAvZ9BGiJ4cRIo+fg/8Tn8zpm" +# export AWS_SESSION_TOKEN="IQoJb3JpZ2luX2VjEH8aCXVzLWVhc3QtMSJHMEUCIFeikgdYda0HQIinUnWk4Jcqy+tPYZFDPUFU9XOUov61AiEA91MDuu3WLrS6buo4lUheZUExrgC/WzVYDzhPFp5YK8gqjQMI2P//////////ARAAGgw3NjYzODc3NjE3NDgiDPI94QCWZmuBx27M5CrhAjpVBPM+QwWB0HIuD7RWxYwULtXgFoJasC8k1AEVkKl/zJnnPtuDybvU3MkisbQ3JxFz22GRhdRECug12cB8xGXRZqAcy1/adYRLO+fRCYj3NyKih7uN2U9ZeZ9XkaQwEn/3YG0rqpaGSFlFknnyOyN7fnTKkMX8mdGdBZr1VTxSbzadnLwfpF+Rl05wiUpoyKus7kwDYkMg1tkXao2TUWQLf/lu1JEatd5L5UlejtiQAekepKi72PRcfK61HjYIEQiXhTFCz8hDUVcrUtgqKiOnSwyfm/J8SFzZkpnyA5rPj+kqORDasySuymZ7HB6Th6TvKPsgeYZYg+wtRJy3/fjlADRNmEVkpiHPUH32lYy3jkkU2Ln7YnD5bpHuG8AvT4Zj/xs+uyO/zdXBI6ypNWxudS7Zi74sleO4kAT/40XsLmNKK8y+5tTtPXOOfUd66CT4cXgX3KUAE4FC9On0Gk2UMITAoooGOqYBj/2ltKS/4adcL2uFOKnaCVpq2uYzNVibQ7iEbzIBKU5psWX7GU/fty1Ur3BFTty2k/OrbtL6Aiyd/Q416Zw7E9IqxcbFvwXY8FV5IaS2XOBBfoIsqTIt3uuj2tUKsYDYiGOmH1grpRnTQ26TKjnBPI/MzgTqONdFbSCgOlOb+jSomFTPdEE7sVLtskxaCGbe0feiGIjlAgFN7BN+IHaJ8tD/2XNF8A==" +export PUBLISHING_BETA_DB_PASS='oJExzjttPKjLFGvc,3KY' \ No newline at end of file diff --git a/custom/sources.zsh b/custom/sources.zsh new file mode 100755 index 000000000..8b1378917 --- /dev/null +++ b/custom/sources.zsh @@ -0,0 +1 @@ + diff --git a/custom/themes/example.zsh-theme b/custom/themes/example.zsh-theme deleted file mode 100644 index ef8f1c630..000000000 --- a/custom/themes/example.zsh-theme +++ /dev/null @@ -1,4 +0,0 @@ -# Put your custom themes in this folder. -# Example: - -PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " diff --git a/custom/zshrc.zsh b/custom/zshrc.zsh new file mode 100755 index 000000000..05198065d --- /dev/null +++ b/custom/zshrc.zsh @@ -0,0 +1,27 @@ +# source ~/Projects/zsh-custom/init.zsh +# backup for new installs..zshrc should be light +# export ZSH=$HOME/.oh-my-zsh +# export ZSH_CUSTOM=/Users/michaelwclark/Projects/zsh-custom/ +# export ZSH_THEME="dallas" +# source $ZSH/oh-my-zsh.sh +export NVM_DIR="$HOME/.nvm" + [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm + [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion + + + +# Sync changes +cwd=$(pwd) + +echo $THIS_CWD +cd ~/.oh-my-zsh +git pull >> /dev/null +git add . >> /dev/null +git commit -m "update" >> /dev/null +git push mine >> /dev/null +cd $cwd + +bindkey "\e[1;3D" backward-word # ⌥← +bindkey "\e[1;3C" forward-word # ⌥→ +bindkey "^[[1;9D" beginning-of-line # cmd+← +bindkey "^[[1;9C" end-of-line # cmd+→