From dc9990db3a2403230689a0389285bf4140932b46 Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Sun, 5 Feb 2017 11:03:44 -0700 Subject: [PATCH] Add dot files --- .bash_aliases | 45 +++ .bashrc | 117 ++++++ .pylintrc | 407 ++++++++++++++++++++ .pythonrc | 18 + .pythonstartup | 15 + .vim/bundle/placeholder.txt | 0 .vim/python | 116 ++++++ .vim/undo/placeholder.txt | 0 .vimrc | 131 +++++++ bashscripts/.collectLogs.bash.swp | Bin 0 -> 16384 bytes bashscripts/.completeSystemUpgrade.bash.swp | Bin 0 -> 12288 bytes bashscripts/.upgrade-o-matic.sh.swp | Bin 0 -> 12288 bytes bashscripts/gt.bash | 42 ++ bashscripts/jd.bash | 366 ++++++++++++++++++ bashscripts/message.bash | 37 ++ 15 files changed, 1294 insertions(+) create mode 100644 .bash_aliases create mode 100644 .bashrc create mode 100644 .pylintrc create mode 100644 .pythonrc create mode 100644 .pythonstartup create mode 100644 .vim/bundle/placeholder.txt create mode 100644 .vim/python create mode 100644 .vim/undo/placeholder.txt create mode 100644 .vimrc create mode 100644 bashscripts/.collectLogs.bash.swp create mode 100644 bashscripts/.completeSystemUpgrade.bash.swp create mode 100644 bashscripts/.upgrade-o-matic.sh.swp create mode 100644 bashscripts/gt.bash create mode 100644 bashscripts/jd.bash create mode 100644 bashscripts/message.bash diff --git a/.bash_aliases b/.bash_aliases new file mode 100644 index 0000000..7e7bd8f --- /dev/null +++ b/.bash_aliases @@ -0,0 +1,45 @@ +export PATH=$HOME/Qt/5.5/gcc_64/bin:$HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin:/usr/sbin:/local/bin:/usr/local/bin:/sbin:/usr/games:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk:/usr/local/Trolltech/Qt-4.8.6/bin +export PATH=$PATH:$HOME/Nim/bin:$HOME/Swift/usr/bin:$HOME/.nimble/bin:$HOME/nimlibs +export JAVA_HOME=/usr/lib/jvm/java-8-oracle +export PATH=/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:$PATH +export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/lib:/usr/lib:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu" +export LFS=/mnt/lfs +export PYTHONSTARTUP="$HOME/.pythonstartup" +#export WINEPREFIX=$HOME/prefix32 +#export WINEARCH='win32' +export ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" +alias vim="/usr/bin/vim" +# User specific aliases and functions: +alias ls="ls -h --color=auto" + +PS1="\n\[\e[30;01m\](\[\e[31;01m\]\w\[\e[30;01m\])-(\[\e[33;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')B\[\e[30;1m\])\[\e[30;1m\]\n\[\e[30;1m\](\[\e[34m\]\$(/bin/date)\[\e[30;1m\])\n\[\e[30;1m\](\[\e[32;1m\]\u @ \h\[\e[30;1m\])-> \[\e[0m\]" + +export LANG=en_US.UTF-8 + +export TERM=xterm + +alias grep="grep --color" + +alias openurl="x-www-browser" + +# Use bash-completion, if available +[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \ + . /usr/share/bash-completion/bash_completion + + + +#DISPLAY=:0.0 xhost + +source ~/bashscripts/jd.bash + +HISTSIZE=50000 +HISTFILESIZE=500000 + +#st(){ +# while read line;do +# sudo apt-get install -y "$line" +# done < "b.txt" +#} +#if [ -n "$DISPLAY" -a "$TERM" == "xterm" ]; then +# export TERM=xterm-256color +#fi diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..b488fcc --- /dev/null +++ b/.bashrc @@ -0,0 +1,117 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..68d52b1 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,407 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Add files or directories matching the regex patterns to the blacklist. The +# regex matches against base names, not paths. +ignore-patterns= + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Use multiple processes to speed up Pylint. +jobs=1 + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist=PySide,Signal + +# Allow optimization of some AST trees. This will activate a peephole AST +# optimizer, which will apply various small optimizations. For instance, it can +# be used to obtain the result of joining multiple strings with the addition +# operator. Joining a lot of strings can lead to a maximum recursion error in +# Pylint and this flag can prevent that. It has one side effect, the resulting +# AST will be different than the one from reality. This option is deprecated +# and it will be removed in Pylint 2.0. +optimize-ast=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +disable=no-absolute-import,old-division,too-many-locals,old-octal-literal,round-builtin,long-suffix,intern-builtin,wildcard-import,apply-builtin,buffer-builtin,too-many-arguments,setslice-method,import-star-module-level,bare-except,file-builtin,range-builtin-not-iterating,indexing-exception,basestring-builtin,execfile-builtin,hex-method,invalid-name,raw_input-builtin,zip-builtin-not-iterating,backtick,xrange-builtin,old-raise-syntax,old-ne-operator,unicode-builtin,getslice-method,using-cmp-argument,useless-suppression,dict-view-method,suppressed-message,coerce-method,reload-builtin,dict-iter-method,delslice-method,parameter-unpacking,cmp-method,missing-docstring,cmp-builtin,reduce-builtin,map-builtin-not-iterating,next-method-called,unpacking-in-except,oct-method,redefined-outer-name,unused-wildcard-import,too-many-lines,standarderror-builtin,input-builtin,raising-string,filter-builtin-not-iterating,unichr-builtin,long-builtin,metaclass-assignment,too-many-statements,nonzero-method,print-statement,coerce-builtin,too-many-branches + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". This option is deprecated +# and it will be removed in Pylint 2.0. +files-output=no + +# Tells whether to display a full report or only the messages +reports=yes + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details +#msg-template= + + +[TYPECHECK] + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local,PySide.QtCore.Signal + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + + +[BASIC] + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Include a hint for the correct naming format with invalid-name +include-naming-hint=no + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +property-classes=abc.abstractproperty + +# Regular expression matching correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for argument names +argument-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for variable names +variable-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Naming hint for class names +class-name-hint=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression matching correct inline iteration names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Naming hint for inline iteration names +inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ + +# Regular expression matching correct function names +function-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for function names +function-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Naming hint for module names +module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression matching correct class attribute names +class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Naming hint for class attribute names +class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Regular expression matching correct constant names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Naming hint for constant names +const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Regular expression matching correct attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for attribute names +attr-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression matching correct method names +method-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Naming hint for method names +method-name-hint=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + + +[ELIF] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the name of dummy variables (i.e. expectedly +# not used). +dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_,_cb + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,future.builtins + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=100 + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + +# List of optional constructs for which whitespace checking is disabled. `dict- +# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. +# `trailing-comma` allows a space between comma and closing bracket: (a, ). +# `empty-line` allows space-only lines. +no-space-check=trailing-comma,dict-separator + +# Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + + +[SPELLING] + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[LOGGING] + +# Logging modules to check that the string format arguments are in logging +# function parameter format +logging-modules=logging + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict,_fields,_replace,_source,_make + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branches=12 + +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of boolean expressions in a if statement +max-bool-expr=5 + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=optparse + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception diff --git a/.pythonrc b/.pythonrc new file mode 100644 index 0000000..00b4d8b --- /dev/null +++ b/.pythonrc @@ -0,0 +1,18 @@ +import atexit +import os +import re +import readline +import rlcompleter +import socket +import _socket +import sys +import time +import timeit + +history = os.path.expanduser('~/.python_history') +readline.read_history_file(history) +readline.parse_and_bind('tab: complete') +atexit.register(readline.write_history_file, history) + +def t(*args): + return timeit.Timer(*args).timeit() diff --git a/.pythonstartup b/.pythonstartup new file mode 100644 index 0000000..649b64d --- /dev/null +++ b/.pythonstartup @@ -0,0 +1,15 @@ +# python startup file +import readline +import rlcompleter +import atexit +import os +# tab completion +readline.parse_and_bind('tab: complete') +# history file +histfile = os.path.join(os.environ['HOME'], '.pythonhistory') +try: + readline.read_history_file(histfile) +except IOError: + pass +atexit.register(readline.write_history_file, histfile) +del os, histfile, readline, rlcompleter diff --git a/.vim/bundle/placeholder.txt b/.vim/bundle/placeholder.txt new file mode 100644 index 0000000..e69de29 diff --git a/.vim/python b/.vim/python new file mode 100644 index 0000000..11db9b6 --- /dev/null +++ b/.vim/python @@ -0,0 +1,116 @@ +" The magical turn-Vim-into-a-Python-IDE vim resource file! +" +" Mostly taken from http://www.sontek.net/category/Vim.aspx +" Other bits culled from various sources, Canonical guys, or made up by me. +" +" Julian Edwards 2008-05-30 + +" Wrapping and tabs. +set tw=78 ts=4 sw=4 sta et sts=4 ai + +" More syntax highlighting. +let python_highlight_all = 1 + +" Smart indenting +set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class + +" Auto completion via ctrl-space (instead of the nasty ctrl-x ctrl-o) +set omnifunc=pythoncomplete#Complete +inoremap + +" Get this plugin from http://www.vim.org/scripts/script.php?script_id=1112 +" Pressing "K" takes you to the documentation for the word under the cursor. +" autocmd filetype python source ~/.vim/pydoc.vim + +" Wrap at 72 chars for comments. +set formatoptions=cq textwidth=72 foldignore= wildignore+=*.py[co] + +" Highlight end of line whitespace. +highlight WhitespaceEOL ctermbg=red guibg=red +match WhitespaceEOL /\s\+$/ + +" The next two highlight matches break the previous one, I don't know why. +" Show long lines. +"highlight LongLine guibg=red ctermbg=red +"match LongLine /\%>79v.\+/ +" Highlight bzr merge markers. +"highlight MergeMarker guibg=red ctermbg=red +"match MergeMarker /^[<=>\|]\{7\}\( [A-Z]\+\)?$/ + +" `gf` jumps to the filename under the cursor. Point at an import statement +" and jump to it! +python << EOF +import os +import sys +import vim +for p in sys.path: + if os.path.isdir(p): + vim.command(r"set path+=%s" % (p.replace(" ", r"\ "))) +EOF + +" Generate tags with: ctags -R -f ~/.vim/tags/python24.ctags /usr/lib/python2.4/ +" ctrl-[ to go to the tag under the cursor, ctrl-T to go back. +set tags+=$HOME/.vim/tags/python24.ctags + +" Use :make to see syntax errors. (:cn and :cp to move around, :dist to see +" all errors) +set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\" +set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m + +" Execute a selection of code (very cool!) +" Use VISUAL to select a range and then hit ctrl-h to execute it. +python << EOL +import vim +def EvaluateCurrentRange(): + eval(compile('\n'.join(vim.current.range),'','exec'),globals()) +EOL +map :py EvaluateCurrentRange() + +" Use F7/Shift-F7 to add/remove a breakpoint (pdb.set_trace) +" Totally cool. +python << EOF +def SetBreakpoint(): + import re + nLine = int( vim.eval( 'line(".")')) + + strLine = vim.current.line + strWhite = re.search( '^(\s*)', strLine).group(1) + + vim.current.buffer.append( + "%(space)spdb.set_trace() %(mark)s Breakpoint %(mark)s" % + {'space':strWhite, 'mark': '#' * 30}, nLine - 1) + + for strLine in vim.current.buffer: + if strLine == "import pdb": + break + else: + vim.current.buffer.append( 'import pdb', 0) + vim.command( 'normal j1') + +vim.command( 'map :py SetBreakpoint()') + +def RemoveBreakpoints(): + import re + + nCurrentLine = int( vim.eval( 'line(".")')) + + nLines = [] + nLine = 1 + for strLine in vim.current.buffer: + if strLine == "import pdb" or strLine.lstrip()[:15] == "pdb.set_trace()": + nLines.append( nLine) + nLine += 1 + + nLines.reverse() + + for nLine in nLines: + vim.command( "normal %dG" % nLine) + vim.command( "normal dd") + if nLine < nCurrentLine: + nCurrentLine -= 1 + + vim.command( "normal %dG" % nCurrentLine) + +vim.command( "map :py RemoveBreakpoints()") +EOF +"vim:syntax=vim diff --git a/.vim/undo/placeholder.txt b/.vim/undo/placeholder.txt new file mode 100644 index 0000000..e69de29 diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..3775fc2 --- /dev/null +++ b/.vimrc @@ -0,0 +1,131 @@ +" this is necessary to get the "indent paragraph" command to work +" + +set autoindent +set ruler + +set backspace=2 +set autowrite + +set smarttab + +set expandtab +set nocompatible +set foldmethod=indent +set foldlevel=99 +let g:python_highlight_all=1 +let g:python_version_2 = 1 +map :NERDTreeTabsToggle + +set undofile " Save undo's after file closes +set undodir=$HOME/.vim/undo " where to save undo histories +set undolevels=10000 +set undoreload=10000 " number of lines to save for undo +filetype plugin indent on +set pastetoggle= +set incsearch +set title + +set mouse=a +set tabstop=4 +set shiftwidth=4 + +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +let g:syntastic_check_on_wq = 0 + +autocmd Filetype nim setlocal ts=2 sts=2 sw=2 expandtab + +set hlsearch +highlight Search ctermbg=blue ctermfg=white guibg=blue + +filetype on +:autocmd ColorScheme * highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen +highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen +:match ExtraWhitespace /\s\+$/ +highlight OverLength ctermbg=red ctermfg=white guibg=darkred +2match OverLength /\%81v.*/ + +au! FileType python setl nosmartindent +au BufRead,BufNewFile *.py syntax match OverLength /\%80v.\+/ +au BufRead,BufNewFile *.py,*.js syntax match ExtraWhiteSpace /\s\+$\|\t/ +au StdinReadPost * set buftype=nofile +syntax on + +command C let @/="" +command CC :%s#_\(\l\)#\u\1#g +command U :%s#\C\(\<\u[a-z0-9]\+\|[a-z0-9]\+\)\(\u\)#\l\1_\l\2#g + +nmap =j :%!python -m json.tool + +if !exists("autocommands_loaded") + let autocommands_loaded = 1 + autocmd BufRead,BufNewFile,FileReadPost *.py source ~/.vim/python +endif +au BufRead,BufNewFile *.shpaml setfiletype shpaml + +nnoremap :let _s=@/:%s/\s\+$//e:let @/=_s:nohl + +" This beauty remembers where you were the last time you edited the file, and returns to the same position. +au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif +au BufRead,BufNewFile *.sass set filetype=sass + +map :mksession! ~/.vim_session +map :source ~/.vim_session +set runtimepath^=~/.vim/bundle/ctrlp.vim +nmap :TagbarToggle + +" delete without yanking +nnoremap d "_d +vnoremap d "_d + +vnoremap # :s#^#\## +vnoremap -# :s#^\### + +fun! JumpToDef() + if exists("*GotoDefinition_" . &filetype) + call GotoDefinition_{&filetype}() + else + exe "norm! \" + endif +endf + +" Jump to tag +nn :call JumpToDef() +ino :call JumpToDef()i + +" replace currently selected text with default register +" without yanking it +vnoremap p "_dP +let g:ycm_autoclose_preview_window_after_completion = 1 +let g:ycm_min_num_of_chars_for_completion = 99 + +"set statusline+=%#warningmsg# +"set statusline+=%{SyntasticStatuslineFlag()} +"set statusline+=%* + +"let g:syntastic_always_populate_loc_list = 1 +"let g:syntastic_auto_loc_list = 1 +"let g:syntastic_check_on_wq = 0 + +set nocompatible +filetype off +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() +Plugin 'gmarik/vundle' +Plugin 'zah/nim.vim' +Plugin 'tpope/vim-fugitive' +Plugin 'vim-syntastic/syntastic' +Plugin 'hynek/vim-python-pep8-indent' +Plugin 'pangloss/vim-javascript' +Plugin 'Glench/Vim-Jinja2-Syntax' +Plugin 'tpope/vim-haml' +Plugin 'hdima/python-syntax' +Plugin 'hail2u/vim-css3-syntax' +Plugin 'mxw/vim-jsx' +Plugin 'elixir-lang/vim-elixir' +Plugin 'scrooloose/nerdtree' +Plugin 'jistr/vim-nerdtree-tabs' +call vundle#end() " required +filetype plugin indent on diff --git a/bashscripts/.collectLogs.bash.swp b/bashscripts/.collectLogs.bash.swp new file mode 100644 index 0000000000000000000000000000000000000000..5e98650ea5a1d89288d36db3361dc69715520af5 GIT binary patch literal 16384 zcmeI3U1%It6vwZ%Sk$&ki{OLE?PS4ZaWdTmjHJX;vQ`8A!Zy*`mU1(DcV?P9Gu!!S zl2)zaiw{ase6fC@)EDu^7fTUDD)=B+sI;I}{J{Do`l5ZaSpRosHaj~e+a?H2!X5Z! zvoq)3Irl$zX6KwUGrn0- zLt~tUc4!7pBMJ@E7lND7Hs1<+<@(NhQd^Y*N`VC_5Jz?W;Webcud-3L@6tBV_3K6# z)Rk(a6i^B%1(X6x0i}RaKq;UUPzo$f1)|0ZavZL&$lUMCK5r>}-kN=XH2dr-Y|p-` z52b)oKq;UUPzopolmbctrGQdEDWDWk3Md5@p#rQ%h<67ePuvOTQ2%en|5xrJ_da1mSpXTZnc6nG0f4Ji114I!U_6X1Ce0}t#4JHTV07j%L9z_rzc zTmgT8Z^1e61vm{NFbHk~m*DFM;3PN!UINE}01P|@b^|%4%}8AQh~&l@FajP2WpEV< zjvv4|@F92;oCITF6pVm*EoP0D%s2?DP5>`VlZW9!^Dv7dYm%CNW18xE;K1f6Z`gYr zbAm^-+#9g~>+61Ca$1oV?!nNHlW&BWjm)BCHe|2dw0)`#qc6v^D4K3{1P^KCW5?1! zBkn}aL5GcOMb=_F9^*g*Y{G*UelR^_p0pa$=rUNyG8hA``5s>u1Ca-Vhs<0SgW0rc zNe?67Q5<+natQK*w`3e2>{$}7F7nyDh-Yj1^GlnHUYq$v-RcDHBn!CwIoB4|EJ%Ic z*@zt93kRw0QrB{$UCf+d)*^B@b#pX?Q-io!avOq2eD`!1ad)&~1+2#DK0h7AftxFE z;^~NYgbCcsvA~L5?nS+A$DGXkjJN#+=1#oAB$s_AJ>)JSovmr>o=q3Ygv=hJrKWJG zz_YY1l~QdJBl!o@RxVBZVZHi52V=9%*t8v&2W-|IwB{IVYr}*{>}hw6*I6v0o}z0r zhkfQjU>YWe-eWGOhx~CGrMJs-P5~nKxPNo&0-RGX8|bibhAN4j=ww!PnC1B)b{J;n zwNB>4sUVrD*~xT^5Sba9)ohkIp^h>RtDUN4vXIkKT`-F}9?mc_X(RZd7LRaU2&rZ> zvnDhu4G5__$&uz$PDIm#UOWjpois(;IZv3P;q^|I)PBAvO4@26Cy7(1`}WaN7u7vZ z`{{uLn`mTn5ApT}W8CqQ$MA`a{|9bIe2*M}jQ^YU{cDKxW&Hme_zqkGUxAb04e$zh z85{%;fqTKvi1~j4=fFo`C)feDfk(h<@IK=FQ{X-DI*|DQ8TbDKu7W?odGHQ61}v}z z=-@%{D`NV~-~#v>oClwSv*2Cu8aNIbfP=kY3{=4VU_Dp`R)WhI^F{C__!N8sUIj0L zDIkCYY>?g$f@;Ehk* z~ zYzO&OML7^f7I&2vd35ekZNH}x@@(2?z8WQa{9h_kiED+blw6m_D4i-((yCaUYPFoR zLM2VIDwPp7EY1Q0FAlTFw2e~tr0p};=`nI8wKTU7#xX?KP zhG@nSQgQ~>>y;iji?bF9FR2J2=|4l7Vf!vOg4pwTU_>0rDbF%WX^PA^9P^kPvXPuO gY594mwCl+#A+16)eC*d`fB2_QBWY9oU%}<#UxslWVgLXD literal 0 HcmV?d00001 diff --git a/bashscripts/.completeSystemUpgrade.bash.swp b/bashscripts/.completeSystemUpgrade.bash.swp new file mode 100644 index 0000000000000000000000000000000000000000..0b2ea37e0b59adc5c95c3c53da641ee8a17217ab GIT binary patch literal 12288 zcmeI2Pj4GV7>B35(GsYNgt$P5#fK!Yo-`Fgb!8x_lggrLtU8I1no`EQWAEVor?RxDbmSvF}m1d&tKXdv#Aw%Am(L4E#`Nw~a`*0MtGQ)3!VlK&l2(g z{0{DdFM$M?!7{i2o&jgUL(K01xDS2>zkr{>kKhOJIrt2G3n4#jZp35RMIzS=gx9B)s27=5zlYkIo9%j~y|%Z3 z3qt%P7KGvuntR1X-nepQa;b#LR6J=4FGz|;ZE4asKbkspe7HWvEQ?v^Q$65HR1H_o zBvYQ9I@_s{Nvvzsjc8Ff_xijyGjvzuMvcz=P?p|GMu~1u4bY4SJd{4=s+UC~Hq~PM z{nuvBs9cu1Q`v6qtlhje%H_|DEhSIIMl)k)c>Uj)3Pu%sTnk$1hP+2*jGaOb0&GOu z69!^6b%Lno*BqJ$5HguN(`ip|#oiNXaHo^W(AR9xSY2TuH`tKav)4D?ywh5{`o`L| zjW%1xPQ@DL>)_^FTPQa@y53~604Gg6-fC{Q+-p;bv7XHvjrv7=?}-nqJDTDFqDhyU zK+tXy`a)^UyJ&iuQYet>tTWC!96d;j#g=tNOr8CBzvC>C^3keSis!3?xnybi0Dn+y zG@bbgWx{w&#?n-M7HiL^`BTr8nH|A1lXUg`m|==H!eO4nx5(ns`vfEBnTw&llveVx z8dBw7m`6#xJSr#U5vrLP7i)bWjTcnCB<>#me3(vkVALcWj5>=c9(#qAl^iLgh&i6T z=o%+38l$?7m3nlX@nrJCY1GF8O$wx|uQFc@Se%6+IkFUaA*F)4!%UR2REe$0MqDoz H%_08+Un>P4 literal 0 HcmV?d00001 diff --git a/bashscripts/.upgrade-o-matic.sh.swp b/bashscripts/.upgrade-o-matic.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..0055765ae912efe0d2ea157125ac83c4f4486834 GIT binary patch literal 12288 zcmeI2&u<$=6vw9s4p0IJRL(CGD~(guj?+V>IF2eI3Xuq)s^O9vvDqDar}h5m&NxYF zO85^rzyXO9m!9}1I8fRv;>@KS0F@hvE8p4m`bSiyD7Q*)q>t9S^WK~HzVl`!%idl2 zcyo&`H7*K_*M#`?=+TG6AI?4h%a#zg{hKoH;=;XC{mK9(HPOHG2xVYL{ao!7Zp5AzU`?P`Bj}>4ASOHdm6<`He0akz& zU?cYp`p z1TTO;P|wfcA-E5I1mA-%!7UI01w!CzzXo`)0;~WlzzVPetN<&(3Y=1bJSH#iQO(9# zsBfeLSavD5cuS*rlN}~RY{_nbl2)35-JxT=tR*W1w)kBYmpbib&{ZSIjI1r z&<@seQ6zObv@EL?Jh@EWkzOv$exwJAa^;8QtfvHC7>i4Vy5)lS*I*Eix71?Wytk`c z@(%WTSQbxrv8R$YnxWcjCd0u%6lKZn1arAg`q0xtF1VeE zcS!wQWpw^}BhTX6`KkD{y0O@z!$T;kNPdtK3{0_URWkUl5b2(EQC)H!S!+pwK0=v& z>w0MHy>0xyTBF*^cw4-l&f|SQR}GibPNk)3G#Xtg+>%Rmx6! zyF%O*PHHzykWHf6H1Lve*f@v>ljdJ5I;vX2gN>UP&Uptr@?`HWEiTgaN&l5?sS|A* zVN(TZOgLq^l|>jAYR2F*6%0J1>@X|MTri1n&d`lx##wYbADQQ>i2D?Wspx5TqHSV& z`^aI|%9v;(&ulWI(kAx8<$KIw{2KD}z8Yz8%%o`PV!G`*hrDg_Je>SM(X#8cQaHDH z#qA`WHP`HjI@O9r3S}#7mM=Hg?^i$CGL+&aQtd45X&(n*DyQ-@4#8}4Q%AxTSNV5j ro~HKl&2; echo "error: Not a number"; return 1 + else + echo '' + echo ${relWins[$((win-1))]} + wmctrl -F -a ${relWins[$((win-1))]} + wmctrl -F -a ${relWins[$((win-1))]} + fi + + elif [[ $numElements -gt 0 ]];then + wmctrl -F -a ${relWins[0]} + wmctrl -F -a ${relWins[0]} + fi + IFS=$SAVEIFS +} + + diff --git a/bashscripts/jd.bash b/bashscripts/jd.bash new file mode 100644 index 0000000..4c119af --- /dev/null +++ b/bashscripts/jd.bash @@ -0,0 +1,366 @@ +#!/bin/bash -x +declare PROMPT_COMMAND="_execBeforePrompt" + +source $HOME/bashscripts/gt.bash +source $HOME/bashscripts/message.bash + +_execBeforePrompt(){ + + echo -ne "\033]0;${PWD/$HOME/~}\007" + _cache "d$PWD" +} + +ds(){ + du -ch 2>/dev/null| /bin/grep -P "\ttotal" | /bin/sed "s/\ttotal//" +} + +ut () +{ + if [ -z "$1" ]; then + return; + fi; + local upto=$1; + cd "${PWD/\/$upto\/*//$upto}" +} + +trap _restoreIFS SIGINT + +_restoreIFS(){ + IFS=$(echo -en " \t\n") +} + +_ut () +{ + SIFS=$IFS + IFS=$'/\t\n' + local cur=${COMP_WORDS[COMP_CWORD]} + cur=${cur//\"/} + + dirss=$PWD + COMPREPLY=( $( compgen -P\" -S\" -W "$dirss" -- "$cur" ) ) + IFS=$SIFS +} +complete -F _ut ut + +cacheFile="$(eval echo ~${USER})/.jdcache" + +_cache(){ + path="$1" + if [[ $PWD == "/" ]]; then + path=$(echo "$1" | sed -e '0,/\//s/\///') + fi + if [ -z "$1" ]; then + cat $cacheFile + + else + touch $cacheFile + #for var in $1; do + isin=$(_cachecontains $path) + if [ $isin -eq 0 ]; then + echo "$path" >> $cacheFile + fi + #done >> $cacheFile + fi +} + +_cachecontains(){ + touch $cacheFile + if [ -n "$1" ]; then + a=$(grep "$1" $cacheFile) + if [ -n "$a" ]; then + echo 1 + return + fi + fi + echo 0 + +} + +_cachefind(){ + touch $cacheFile + fType=$2 + query=$1 + if [[ "$query" != "" ]]; then + grep "^$fType" $cacheFile | sed -e 's/.\(.*\)/\1/' | grep -i "$query" + if [[ "$?" == "1" ]];then + return 0 + fi + return 1 + fi + return 0 +} +#while read line +#do +# echo hi $line +# done <<< "`ls -1d *`" + +#ls -1RAp | grep -v /\$ +jd(){ + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") + #grabs all of the folders in the current subdirectory + local suffix="" + OPTIND=1 + while getopts "hf:s:p:" flag + do + case $flag in + h) + _jdhelp + return + ;; + f) + + _findDirs "$OPTARG" "f" "$3" + return + ;; + p) + suffix="$OPTARG" + ;; + s) + grep --color=always --include="*$suffix" -r -n -i "$OPTARG" * | sed -e "s/:/ +/" | sed -e "s/:/ --/" | sed -e "s/^/vim /" + return + ;; + + \?) + echo Invalid argument. + _jdhelp + return + ;; + :) + echo + return + ;; + esac + + #echo "$flag" $OPTIND $OPTARG + done + + _findDirs "$1" "d" "$2" + + IFS=$SAVEIFS + + +} + +_jdhelp(){ + + echo + echo "jd [-f] QUERY [depth]" + echo + + echo "Search for files or folders." + + printf "%-20s %-30s\n" "-f" "Searches files instead of directories" + printf "%-20s %-30s\n" "-h" "Display this message" + printf "%-20s %-30s\n" "-s" "Search files recursively in current dir." + printf "%-20s %-30s\n" "depth" "A number from 0-N that specifies the depth to search." + printf "%-20s %-50s\n" "" "No flag is needed, just enter the number after the query." + +} + +_jd(){ + + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") + + local cur=${COMP_WORDS[COMP_CWORD]} + cur=${cur//\"/} + + ftype=${COMP_WORDS[1]} + + if [[ "$ftype" == "-f" ]]; then + fs=$(_cachefind "$cur" "f" ) + else + fs=$(_cachefind "$cur" "d" ) + fi + + t=$(printf "%s\n\b" "$fs" | grep -i "$cur" ) + + COMPREPLY=( $( compgen -P\" -S\" -W "$t" -X "\!*$cur*" ) ) + + IFS=$SAVEIFS + +} + +complete -F _jd jd + +_findDirs(){ + query=${1//\*/\.\*} + fType="$2" + depth="$3" + + if [[ $fType == "d" ]]; then + + if [[ "$depth" == "" ]]; then + + direcs=$(ls -AR 2>/dev/null | grep ":$" | sed -e 's/\(.*\)./\1/' -e 's/..\(.*\)/\1/') + + else + if [ $depth -gt 4 ]; then + direcs=$(ls -AR 2>/dev/null | grep ":$" | sed -e 's/\(.*\)./\1/' -e 's/..\(.*\)/\1/' | cut -d/ -f-$depth | uniq) + else + direcs=$(find -maxdepth $depth -type d 2>/dev/null | sed -e 's/..\(.*\)/\1/') + fi + + fi + else + old=$query + query="$1" + if [[ "$depth" == "" ]]; then + direcs=$(find . -type f -iname \*$query\* -print 2>/dev/null | sed -e 's/..\(.*\)/\1/') + else + direcs=$(find . -maxdepth $depth -type f -iname \*$query\* -print 2>/dev/null | sed -e 's/..\(.*\)/\1/') + fi + query=$old + fi + + relevantDirs=($(printf "%s\n" "$direcs" | grep -i "$query")) + numElements=${#relevantDirs[@]} + + if [[ "${relevantDirs[0]}" == "$query" ]]; then + + echo $query + + + if [[ $fType == "f" ]];then + xdg-open $query 2>/dev/null + return + fi + + cd $query + return + fi + + if [ $numElements -gt 0 ]; then + echo + + if [[ $fType == "f" ]];then + printf "%s\n" "$direcs" | grep -i "$query" | sed 's/^/-> vim /' | grep -i "$query" + else + printf "%s\n" "$direcs" | grep -i "$query" | sed 's/^/-> cd /' | grep -i "$query" + fi + echo + fi +} + +_checkCache(){ + fType=$2 + query=${1//\*/\.\*} + ccont="$(_cachefind "$query" "$fType")" + if [[ "$?" != "0" ]];then + relevantDirs=($(printf "%s\n" "$ccont" | grep -i "$query")) + numElements=${#relevantFolders[@]} + + if [[ "${relevantDirs[0]}" == "$query" ]]; then + + echo $query + + + if [[ $fType == "f" ]];then + xdg-open $query 2>/dev/null + return 0 + fi + + cd $query + return 0 + fi + + + echo + + printf "%s\n" "$ccont" | grep -i "$query" | sed '/./=' | sed '/./N; s/\n/ - /' | grep -i "$query" + + echo + + if [[ $fType == "d" ]]; then + read -p "Which cached folder? (Enter a number, c to continue to search, or q to quit) " fold + else + read -p "Which cached file? (Enter a number, c to continue to search, or q to quit) " fold + fi + + if [ "$fold" == "" ] || [[ "$fold" == "c" ]];then + return 1 + elif [ "$fold" == "q" ];then + return 0 + elif ! [[ "$fold" =~ ^[0-9]+$ ]] ; then + exec >&2; echo "error: Not a number"; return 0 + else + choice=${relevantDirs[$((fold-1))]} + fi + + if [[ $fType == "f" ]];then + read -p "Which application would you like to open it with? (Enter for default)" app + fi + + echo + + if [[ "$fold" != "" ]] && [[ $fold != "c" ]];then + echo $choice + + + if [[ $fType == "f" ]];then + if [ "$app" == "" ]; then + xdg-open $choice 2>/dev/null + + else + $app $choice 2>/dev/null + fi + + return 0 + fi + + cd $choice + return 0 + fi + fi + return 1 + +} + +rme(){ + patt="$1" + except="$2" + + epatt=$(ls | grep "$1.*$2") + + rms=$(ls | grep $1) + + for rs in $rms; do + if [[ $rs != "*$except*" ]] && [[ $rs != "*$patt*" ]]; then + rm "-rf" $rs + + fi + done + +} + +q(){ + sysname="$1" + testing="\/home\/runner\/testing\/" + relSys=($(compgen -d $testing | cut -d/ -f5 | grep -i $sysname)) + relDirs=($(compgen -d $testing | grep -i $sysname | sed -e "s/$/\/queue/")) + message $sysname relSys[@] relDirs[@] "Which queue folder would you like to go to?" "cd" + +} + +_q(){ + + #SAVEIFS=$IFS + #IFS=$(echo -en "\n\b") + + sysname="$1" + direcs="$(compgen -d "\/home\/runner\/testing\/" | cut -d/ -f5)" + + local cur=${COMP_WORDS[COMP_CWORD]} + + fs=$direcs + + t=$(printf "%s\n\b" "$fs" | grep -i "$cur" ) + + COMPREPLY=( $( compgen -W "${direcs}" -- ${cur} ) ) + + #IFS=$SAVEIFS + +} +complete -F _q q + diff --git a/bashscripts/message.bash b/bashscripts/message.bash new file mode 100644 index 0000000..d623fa2 --- /dev/null +++ b/bashscripts/message.bash @@ -0,0 +1,37 @@ +message(){ + #if [ -z $1 ];then + # echo "message [query] (elements) (selection items) [selection message] [command]" + # return + #fi + query="$1" + elements=("${!2}") + selitems=("${!3}") + msg="$4" + command="$5" + + numElements=${#elements[@]} + + # echo ${relWins[@]} + # echo $numElements + + if [ $numElements -gt 1 ]; then + + printf "%s\n" "${elements[@]}" | grep -i "$query" | sed '/./=' | sed '/./N; s/\n/ - /' | grep -i "$query" + echo '' + read -p "$msg (Enter q to quit) " sel + + if [ "$sel" == "" ] || [ "$sel" == "q" ];then + return 1 + elif ! [[ "$sel" =~ ^[0-9]+$ ]] ; then + exec >&2; echo "error: Not a number"; return 1 + else + echo '' + echo ${selitems[$((sel-1))]} + $command ${selitems[$((sel-1))]} + fi + + else + $command ${selitems[0]} + fi + +}