Add dot files
This commit is contained in:
parent
4c384b75ea
commit
dc9990db3a
15 changed files with 1294 additions and 0 deletions
45
.bash_aliases
Normal file
45
.bash_aliases
Normal file
|
|
@ -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
|
||||||
117
.bashrc
Normal file
117
.bashrc
Normal file
|
|
@ -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
|
||||||
407
.pylintrc
Normal file
407
.pylintrc
Normal file
|
|
@ -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*(# )?<?https?://\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
|
||||||
18
.pythonrc
Normal file
18
.pythonrc
Normal file
|
|
@ -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()
|
||||||
15
.pythonstartup
Normal file
15
.pythonstartup
Normal file
|
|
@ -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
|
||||||
0
.vim/bundle/placeholder.txt
Normal file
0
.vim/bundle/placeholder.txt
Normal file
116
.vim/python
Normal file
116
.vim/python
Normal file
|
|
@ -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 <Nul> <C-x><C-o>
|
||||||
|
|
||||||
|
" 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 <C-h> :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 <f7> :py SetBreakpoint()<cr>')
|
||||||
|
|
||||||
|
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 <s-f7> :py RemoveBreakpoints()<cr>")
|
||||||
|
EOF
|
||||||
|
"vim:syntax=vim
|
||||||
0
.vim/undo/placeholder.txt
Normal file
0
.vim/undo/placeholder.txt
Normal file
131
.vimrc
Normal file
131
.vimrc
Normal file
|
|
@ -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 <C-n> :NERDTreeTabsToggle<CR>
|
||||||
|
|
||||||
|
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=<F2>
|
||||||
|
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<CR>
|
||||||
|
|
||||||
|
if !exists("autocommands_loaded")
|
||||||
|
let autocommands_loaded = 1
|
||||||
|
autocmd BufRead,BufNewFile,FileReadPost *.py source ~/.vim/python
|
||||||
|
endif
|
||||||
|
au BufRead,BufNewFile *.shpaml setfiletype shpaml
|
||||||
|
|
||||||
|
nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
|
||||||
|
|
||||||
|
" 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 <F3> :mksession! ~/.vim_session <cr>
|
||||||
|
map <F4> :source ~/.vim_session <cr>
|
||||||
|
set runtimepath^=~/.vim/bundle/ctrlp.vim
|
||||||
|
nmap <F8> :TagbarToggle<CR>
|
||||||
|
|
||||||
|
" delete without yanking
|
||||||
|
nnoremap <leader>d "_d
|
||||||
|
vnoremap <leader>d "_d
|
||||||
|
|
||||||
|
vnoremap # :s#^#\##<cr>
|
||||||
|
vnoremap -# :s#^\###<cr>
|
||||||
|
|
||||||
|
fun! JumpToDef()
|
||||||
|
if exists("*GotoDefinition_" . &filetype)
|
||||||
|
call GotoDefinition_{&filetype}()
|
||||||
|
else
|
||||||
|
exe "norm! \<C-]>"
|
||||||
|
endif
|
||||||
|
endf
|
||||||
|
|
||||||
|
" Jump to tag
|
||||||
|
nn <C-g> :call JumpToDef()<cr>
|
||||||
|
ino <C-g> <esc>:call JumpToDef()<cr>i
|
||||||
|
|
||||||
|
" replace currently selected text with default register
|
||||||
|
" without yanking it
|
||||||
|
vnoremap <leader>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
|
||||||
BIN
bashscripts/.collectLogs.bash.swp
Normal file
BIN
bashscripts/.collectLogs.bash.swp
Normal file
Binary file not shown.
BIN
bashscripts/.completeSystemUpgrade.bash.swp
Normal file
BIN
bashscripts/.completeSystemUpgrade.bash.swp
Normal file
Binary file not shown.
BIN
bashscripts/.upgrade-o-matic.sh.swp
Normal file
BIN
bashscripts/.upgrade-o-matic.sh.swp
Normal file
Binary file not shown.
42
bashscripts/gt.bash
Normal file
42
bashscripts/gt.bash
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
gt(){
|
||||||
|
SAVEIFS=$IFS
|
||||||
|
IFS=$(echo -en "\n\b")
|
||||||
|
query=$1
|
||||||
|
|
||||||
|
if [ $query == '-l' ]; then
|
||||||
|
wmctrl -l
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
wins=$(wmctrl -l | grep -i $1 | cut -d' ' -f5-)
|
||||||
|
#echo ${wins[@]}
|
||||||
|
relWins=($(printf "%s\n" "$wins" | grep -i "$query"))
|
||||||
|
|
||||||
|
numElements=${#relWins[@]}
|
||||||
|
# echo ${relWins[@]}
|
||||||
|
# echo $numElements
|
||||||
|
if [ $numElements -gt 1 ]; then
|
||||||
|
|
||||||
|
printf "%s\n" "$wins" | grep -i "$query" | sed '/./=' | sed '/./N; s/\n/ - /' | grep -i "$query"
|
||||||
|
echo ''
|
||||||
|
read -p "Which window would you like to go to? (Enter a number or q to quit) " win
|
||||||
|
|
||||||
|
if [ "$win" == "" ] || [ "$win" == "q" ];then
|
||||||
|
return 1
|
||||||
|
elif ! [[ "$win" =~ ^[0-9]+$ ]] ; then
|
||||||
|
exec >&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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
366
bashscripts/jd.bash
Normal file
366
bashscripts/jd.bash
Normal file
|
|
@ -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
|
||||||
|
|
||||||
37
bashscripts/message.bash
Normal file
37
bashscripts/message.bash
Normal file
|
|
@ -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
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue