From c1d0b9405ac1b70be2db20e578be4402d22af01f Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 20 Sep 2017 00:56:39 -0400 Subject: [PATCH 1/4] Add bruise to the system --- git/.gitconfig | 5 ++ install.sh | 3 ++ run/.bashrc | 1 + run/bruise | 144 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 run/bruise diff --git a/git/.gitconfig b/git/.gitconfig index 996fbfb..3761ba5 100755 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -7,3 +7,8 @@ autostash = true [core] editor = vim +[filter "lfs"] + required = true + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process diff --git a/install.sh b/install.sh index 29e2f9c..01ee32c 100755 --- a/install.sh +++ b/install.sh @@ -9,6 +9,8 @@ export EXTRA_DIR [ -d "$DOTFILES_DIR/.git" ] && git --work-tree="$DOTFILES_DIR" --git-dir="$DOTFILES_DIR/.git" pull origin master +#local tools +mkdir -p ~/apps #vim backup folders mkdir -p ~/.vim/{backup_files,swap_files,undo_files} #install vundle @@ -21,6 +23,7 @@ git clone https://github.com/pyenv/pyenv.git ~/.pyenv ln -sfv ~/dotfiles ~/.dotfiles #ln -sfv "$DOTFILES_DIR/run/.bash_profile" ~ ln -sfv "$DOTFILES_DIR/run/.bashrc" ~ +ln -sfv "$DOTFILES_DIR/run/bruise" ~/apps/bruise ln -sfv "$DOTFILES_DIR/git/.gitconfig" ~ ln -sfv "$DOTFILES_DIR/system/.vimrc" ~ ln -sfv "$DOTFILES_DIR/system/.dir_colors" ~ diff --git a/run/.bashrc b/run/.bashrc index e37033b..1276fe0 100755 --- a/run/.bashrc +++ b/run/.bashrc @@ -183,3 +183,4 @@ setxkbmap dvorak export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" +source ~/apps/bruise diff --git a/run/bruise b/run/bruise new file mode 100644 index 0000000..fb2dc9c --- /dev/null +++ b/run/bruise @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +# tabstop: 4 +_VENV_BASE=$HOME/.venvs +## get the name of the branch, within the following revision control systems +function __fetch_repo_details() { + if [ -d ".git" ]; then + BRANCHNAME=`git rev-parse --abbrev-ref HEAD` + # create an SSH wrapper if the tree we're in is "special" + # then use that special wrapper + BBNAME=`cat .git/config|grep bitbucket|cut -d "@" -f 2|cut -d "." -f 1` + if [ $? -eq 0 ]; then + if [ -f "~/bin/${BBNAME}bitbucketwrapper.sh" ]; then + GIT_SSH="~/bin/${BBNAME}bitbucketwrapper.sh" + fi + fi + elif [ -d ".hg" ]; then + BRANCHNAME=`hg branch` + elif [ -d ".bzr" ]; then + BRANCHNAME=`cat .bzr/branch/branch.conf|awk -F/ '{print $(NF-1)}'` + fi + if [ -z $BRANCHNAME ]; then + return + else + REPONAME=`basename "$PWD"` + fi + # figure out our virtual env type + if [ -f requirements.txt ]; then + VENV_TYPE="python" + _VENV_ROOT=$_VENV_BASE/python + fi + if [ ! -d $_VENV_ROOT ]; then + mkdir -p $_VENV_ROOT + fi + # pyenv users get an environment prefixed with python version + if [ -f .python-version ]; then + PYTHON_VERSION=`cat .python-version` + VENV_NAME=$PYTHON_VERSION.$REPONAME.$BRANCHNAME + else + VENV_NAME=$REPONAME.$BRANCHNAME + fi + VENV_PATH=$_VENV_ROOT/$VENV_NAME +} +# create the pythonbrew venv combination +# if there's a requirements.txt we'll pip that puppy +function bruisemake() { + if [ ! -z $2 ]; then + export PATH=$2:$PATH + fi + if [ -z $VENV_TYPE ]; then + echo "You are not in a repository root" + return 1 + fi + if [ $VENV_TYPE == "python" ]; then + if [ ! -z $1 ]; then + VENV_PATH=$_VENV_BASE/python/$1 + fi + if [ ! -d $VENV_PATH ]; then + virtualenv --no-site-packages $VENV_PATH + fi + source $VENV_PATH/bin/activate + pip install -r requirements.txt + fi +} +function __bruise() { + # pyenv support or not ;) + if [ -z $PYTHON_VERSION ]; then + VENV_PREFIX="${PYTHON_VERSION}" + else + VENV_PREFIX="${PYTHON_VERSION}." + fi + # if for some reason we're testing in a local venv, it wins + if [ -d `pwd`/venv ]; then + BRUISE_DIR=`pwd`/venv + else + bruisebase="${_VENV_ROOT}/${VENV_PREFIX}${REPONAME}" + if [ -d ${bruisebase}.${BRANCHNAME} ]; then + BRUISE_DIR=${bruisebase}.${BRANCHNAME} + elif [ -d ${bruisebase}.master ]; then + BRUISE_DIR=${bruisebase}.master + elif [ -d ${bruisebase} ]; then + BRUISE_DIR=${bruisebase} + fi + fi + if [ -f .python-version ]; then + pyenv versions|grep `cat .python-version` + if [ $? -ne 0 ]; then + echo "Looks like you need pyenv to install your version, I'll go do that now." + pyenv install `cat .python-version` + pyenv rehash + pip install virtualenv + cd . + fi + fi + if [ -z $BRUISE_DIR ]; then + echo "No environment exists, try running bruisemake" + return 1 + fi + if [ $VENV_TYPE == "python" ]; then + echo "Environment loaded from ${BRUISE_DIR}" + source $BRUISE_DIR/bin/activate + fi + # todo, compare modified times on requirements.txt and the $VENV_PATH + if [ requirements.txt -nt $BRUISE_DIR ]; then + pip install -r requirements.txt + fi +} +function bruiselist() { + for i in `ls $_VENV_BASE`; do + ls $_VENV_BASE/$i + done +} +function bruiseuse() { + if [ -z $1 ]; then + __bruise + else + source $_VENV_BASE/python/$1/bin/activate + fi +} +function bruisedelete() { + for i in $*; do + _bruisedelete $i + done +} +function _bruisedelete() { + if [ -z $1 ]; then + echo "bruisedelete bruise_to_delete" + return 1 + fi + for i in `ls $_VENV_BASE`; do + envs=`ls $_VENV_BASE/$i` + for e in $envs; do + if [ "X$e" == "X$1" ]; then + rm -rf $_VENV_BASE/$i/$e + fi + done + done +} +cd() { + builtin cd "$@" + __fetch_repo_details + if [ ! -z $VENV_TYPE ]; then + __bruise + fi +} From 2b25dab098672af43b4600758cf4f1f14eae3d7c Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Tue, 17 Oct 2017 09:51:40 -0400 Subject: [PATCH 2/4] Update to nextcloud and assume dotfiles are installed first --- .i3/config | 2 +- install.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.i3/config b/.i3/config index 0c34518..f14ed3e 100755 --- a/.i3/config +++ b/.i3/config @@ -14,7 +14,7 @@ exec "setxkbmap dvorak" exec --no-startup-id ~/.fehbg exec /home/ahosking/.screenlayout/home_desktop.sh exec --no-startup-id nm-applet -exec --no-startup-id owncloud +exec --no-startup-id nextcloud exec --no-startup-id insync start set $mod Mod4 diff --git a/install.sh b/install.sh index 7e22da5..8d9b29c 100755 --- a/install.sh +++ b/install.sh @@ -9,6 +9,9 @@ export EXTRA_DIR [ -d "$DOTFILES_DIR/.git" ] && git --work-tree="$DOTFILES_DIR" --git-dir="$DOTFILES_DIR/.git" pull origin master +### install packages +sudo apt-get install -y -f python-pip python-dev powerline + #vim backup folders mkdir -p ~/.vim/{backup_files,swap_files,undo_files} #install vundle From 95041c5df0ed67b87f67f25c7ca84a5c4ddd55d2 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Tue, 17 Oct 2017 09:59:43 -0400 Subject: [PATCH 3/4] Shiftwidth to 2 because nicer! --- system/.vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/.vimrc b/system/.vimrc index 3c3b6a8..38017c0 100755 --- a/system/.vimrc +++ b/system/.vimrc @@ -27,7 +27,7 @@ set ruler " Always show info along bottom. set autoindent " auto-indent set tabstop=4 " tab spacing set softtabstop=4 " unify -set shiftwidth=4 " indent/outdent by 4 columns +set shiftwidth=2 " indent/outdent by 2 columns set shiftround " always indent/outdent to the nearest tabstop set expandtab " use spaces instead of tabs set smarttab " use tabs at the start of a line, spaces elsewhere From aa1161f7d5d531f6847a9990ed6729db98d62660 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Thu, 19 Oct 2017 21:56:08 -0400 Subject: [PATCH 4/4] Truly Random feh and proper nemo alias --- .fehbg | 2 +- run/.bashrc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.fehbg b/.fehbg index 8a2bcc5..aaf6dc6 100755 --- a/.fehbg +++ b/.fehbg @@ -1,2 +1,2 @@ #!/bin/sh -feh --randomize --recursive --bg-scale ~/wallpaper/wallpaper +feh --bg-scale --no-fehbg --recursive --randomize ~/wallpaper/wallpaper diff --git a/run/.bashrc b/run/.bashrc index 968e4ef..aba09b5 100755 --- a/run/.bashrc +++ b/run/.bashrc @@ -186,3 +186,5 @@ eval "$(pyenv init -)" export PATH="$PATH:$HOME/.local/bin" export PATH="$PATH:/opt/trello:/opt/pycharm/bin" export XDG_CURRENT_DESKTOP=GNOME + +alias nemo='nemo --no-desktop'