diff --git a/INSTALL.sh b/INSTALL.sh index cfcced4..44e1ee7 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -1,9 +1,8 @@ #!/bin/bash # get initial directories setup -mv ~/bin/* $(pwd)/bin/ -rm -rf ~/bin/ ln -s $(pwd)/bin ~/bin + if [[ $OSTYPE == darwin* ]]; then ~/bin/setup-usr-local.sh fi diff --git a/bash_aliases b/bash_aliases index e6e5af2..7713f9b 100644 --- a/bash_aliases +++ b/bash_aliases @@ -9,8 +9,6 @@ alias ppjson="python -m json.tool" # Addgene specific alias adocs='cd $ADDGENE_CORE_REPO_DIR/docs && make html && open $ADDGENE_CORE_REPO_DIR/docs/build/html/index.html' -alias deploy_all="fab -R silver-web deploy:master && fab -R gold-web deploy:master && fab -R jupyter fab -R jupyter deploy_jupyter && fab --parallel avail_staging_hosts deploy:master" -alias deploy_all_migration="fab -R silver-web deploy:master,1 && fab -R gold-web deploy:master,1 && fab -R jupyter deploy_jupyter & fab --parallel avail_staging_hosts deploy:master,1" alias aenv='env | sort | grep ADDGENE' alias sl="source local.env.$(basename $SHELL)" @@ -56,28 +54,4 @@ function h () { fi } -if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then - export PS1="$PS1" -fi alias stabbats='sudo killall VDCAssistant && open https://appear.in/stab-bats' - - -function GitHub() -{ - git_url=`git config --get remote.origin.url` - if [[ $git_url == https://github* ]]; - then - url=${git_url%.git} - else - if [[ $git_url == git@github.com* ]] - then - url="https://github.com/${${git_url:15}%.git}" - else - echo "ERROR: Remote origin is invalid" && return false; - fi - fi - open $url -} - -alias github=GitHub - diff --git a/bin/chromedriver b/bin/chromedriver new file mode 100755 index 0000000..93c906e Binary files /dev/null and b/bin/chromedriver differ diff --git a/bin/mov_to_gif.sh b/bin/mov_to_gif.sh index 073b11d..e7601f1 100755 --- a/bin/mov_to_gif.sh +++ b/bin/mov_to_gif.sh @@ -7,6 +7,8 @@ if [[ $3 ]]; then else END=$(ffprobe -loglevel error -show_streams $NAME | grep duration\= | cut -f2 -d=) fi +END=$(echo -n $END | cut -d ' ' -f 1) +echo $END echo "Making a gif of $NAME from $START seconds to $END seconds" ffmpeg -y -ss $START -t $END -i $NAME -vf fps=24,scale=640:-1:flags=lanczos,palettegen temp_palette.png diff --git a/bin/mysql_in_ram.sh b/bin/mysql_in_ram.sh index d6cad2c..65bda03 100755 --- a/bin/mysql_in_ram.sh +++ b/bin/mysql_in_ram.sh @@ -1,33 +1,11 @@ #!/bin/bash -set -e -set -x -set -v - -if [ $OSTYPE = "darwin16.0" ];then - umount /Volumes/ramdisk - mysql.server stop - killall mysqld - killall mysqld - killall mysqld - killall mysqld - killall mysqld - killall mysqld - diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://2048000` - cp -r /usr/local/var/mysql /Volumes/ramdisk - mysql.server start -else - sudo service mysql stop - - # This works on Ubuntu 14.04, but not 16.04: - # sudo mkdir -p /mnt/mysql-data-orig - # sudo mount --bind /var/lib/mysql /mnt/mysql-data-orig - # sudo mount -t tmpfs -o size=32G,uid=mysql,gid=mysql,mode=700 tmpfs /var/lib/mysql - # sudo sh -c 'cp -avi /mnt/mysql-data-orig/* /var/lib/mysql/' - - # This works on 16.04 and maybe elsewhere too - sudo mkdir -p /mnt/mysql-ram - sudo mount -t tmpfs -o size=8G,uid=mysql,gid=mysql,mode=700 tmpfs /mnt/mysql-ram - sudo mount -t aufs -o br:/mnt/mysql-ram:/var/lib/mysql=ro aufs /var/lib/mysql - - sudo service mysql start -fi +mysql.server stop +killall mysqld +killall mysqld +killall mysqld +killall mysqld +killall mysqld +killall mysqld +diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://2048000` +cp -r /usr/local/var/mysql /Volumes/ramdisk +mysql.server start diff --git a/bin/oh_fuck.sh b/bin/oh_fuck.sh new file mode 100755 index 0000000..ef51241 --- /dev/null +++ b/bin/oh_fuck.sh @@ -0,0 +1,5 @@ +#!/bin/bash +git tag temp$RANDOM +git reset --hard HEAD^ +git push --force +echo "There. I fixed your stupid mistake Tyrel" diff --git a/bin/subl b/bin/subl new file mode 120000 index 0000000..0170a20 --- /dev/null +++ b/bin/subl @@ -0,0 +1 @@ +/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl \ No newline at end of file diff --git a/bin/virtualenv-auto-activate.sh b/bin/virtualenv-auto-activate.sh new file mode 100755 index 0000000..38c2b09 --- /dev/null +++ b/bin/virtualenv-auto-activate.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# virtualenv-auto-activate.sh +# +# Installation: +# Add this line to your .bashrc or .bash-profile: +# +# source /path/to/virtualenv-auto-activate.sh +# +# Go to your project folder, run "virtualenv .venv", so your project folder +# has a .venv folder at the top level, next to your version control directory. +# For example: +# . +# ├── .git +# │ ├── HEAD +# │ ├── config +# │ ├── description +# │ ├── hooks +# │ ├── info +# │ ├── objects +# │ └── refs +# └── .venv +# ├── bin +# ├── include +# └── lib +# +# The virtualenv will be activated automatically when you enter the directory. + +# Check for virtualenvwrapper +if type workon >/dev/null 2>&1; then + VENV_WRAPPER=true +else + VENV_WRAPPER=false +fi + +function _virtualenv_auto_activate() { + if [ -e ".venv" ]; then + # Check for symlink pointing to virtualenv + if [ -L ".venv" ]; then + _VENV_PATH=$(readlink .venv) + _VENV_WRAPPER_ACTIVATE=false + # Check for directory containing virtualenv + elif [ -d ".venv" ]; then + _VENV_PATH=$(pwd -P)/.venv + _VENV_WRAPPER_ACTIVATE=false + # Check for file containing name of virtualenv + elif [ -f ".venv" -a $VENV_WRAPPER = "true" ]; then + _VENV_PATH=$WORKON_HOME/$(cat .venv) + _VENV_WRAPPER_ACTIVATE=true + else + return + fi + + # Check to see if already activated to avoid redundant activating + if [ "$VIRTUAL_ENV" != $_VENV_PATH ]; then + if $_VENV_WRAPPER_ACTIVATE; then + _VENV_NAME=$(basename $_VENV_PATH) + workon $_VENV_NAME + else + _VENV_NAME=$(basename `pwd`) + VIRTUAL_ENV_DISABLE_PROMPT=1 + source .venv/bin/activate + _OLD_VIRTUAL_PS1="$PS1" + PS1="($_VENV_NAME)$PS1" + export PS1 + fi + echo Activated virtualenv \"$_VENV_NAME\". + fi + fi +} + +export PROMPT_COMMAND=_virtualenv_auto_activate +if [ -n "$ZSH_VERSION" ]; then + function chpwd() { + _virtualenv_auto_activate + } +fi diff --git a/bin/wha.scpt b/bin/wha.scpt new file mode 100755 index 0000000..573191b --- /dev/null +++ b/bin/wha.scpt @@ -0,0 +1 @@ +display notification \"Your free upgrade to Windows 10 is ready. Please click here to start the download.\" with title \"Microsoft\" diff --git a/zprofile.local b/zprofile.local index 50f7043..5577165 100644 --- a/zprofile.local +++ b/zprofile.local @@ -1,43 +1,34 @@ #!/usr/local/bin/zsh export EDITOR=vim -export VISUAL=vim -export GOPATH=$HOME/go +export MP_FULLNAME="Tyrel Souza" +export VISUAL=$EDITOR export LANG=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 +export LC_ALL=$LANG 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 +# Python 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 +elif [ -e /usr/local/bin/virtualenvwrapper.sh ]; then source /usr/local/bin/virtualenvwrapper.sh fi +export PYTHONSTARTUP=$HOME/.pythonstartup.py + +# Node stuff +export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH" +export NPM_PACKAGES="${HOME}/.npm-packages" export PATH="$NPM_PACKAGES/bin:$GOPATH/bin:$HOME/bin:$PATH" + +# Go Stuff +export GOPATH=$HOME/go + +# GPG stuff 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" - source ~/.bash_aliases -if [ -e $HOME/.credentials ];then - source $HOME/.credentials -fi -export PYTHONSTARTUP=$HOME/.pythonstartup.py -eval "$(pyenv init -)"