Skip to content

Instantly share code, notes, and snippets.

@flyfire
Created February 26, 2015 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flyfire/3a9edce243c45b28dadd to your computer and use it in GitHub Desktop.
Save flyfire/3a9edce243c45b28dadd to your computer and use it in GitHub Desktop.
# ~/.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
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
shopt -s cdspell
shopt -s cmdhist
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
export HISTIGNORE="[ ]*:&:[fb]g:exit:ls:ll:cls:clear:cd\ *:pwd:vim:vim\ *:source\ *:ls\ *:ll\ *:gedit\ *:\.\/*:\.\ *:cdls\ *:cdcls:cdcls\ *:mkcd\ *:\\*:extract\ *:extractWithCD\ *:gvim:geany:source\ *:top:mplayer\ *:gnome-open\ *:history:upd:upg:mp:mf:mf\ *:mp\ *:smplayer\ *:gvim\ *:geany\ *:open\ *:rm\ *:mv\ *:\>*:google-chrome:google-chrome\ *:\\rm\ *:echo\ *:cat\ *:javac\ *:java\ *:bash\ *:sh\ *:cp\ *:htop:mkdir\ *:type\ *:rp:rg:rake\ *:unrar\ *:unzip\ *:tar\ *:firefox:firefox\ *"
PROMPT_COMMAND='history -a'
# 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) 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
PS1='`a=$?;if [ $a -ne 0 ]; then a=" "$a; echo -ne "\[\e[s\e[1A\e[$((COLUMNS-2))G\e[31m\e[1;41m${a:(-3)}\e[u\]\[\e[0m\e[7m\e[2m\]"; fi`\[\e[1;32m\]\u@\h:\[\e[0m\e[1;34m\]\W\[\e[1;34m\]\$ \[\e[0m\]'
# 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
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias s='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 [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
# stylish by Solarex
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias cls='clear'
alias ac='adb logcat -c'
cman() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;37m") \
LESS_TERMCAP_md=$(printf "\e[1;37m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;47;30m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[0;36m") \
# man -M /usr/share/man/zh_CN "$@"
man "$@"
}
mkcd() {
mkdir -p "$@" && cd "$@";
}
cdls() {
declare dir="$*"
cd $dir && ls
}
cdcls() {
cd "$@" && clear
}
adblog() {
adb logcat -c
adb logcat -c
suffix=`date +%F-%H-%M-%S`
adb logcat -v threadtime | tee $suffix.log
}
alog(){
adb logcat -c
adb logcat -c
suffix=`date +%F-%H-%M-%S`
adb logcat -v threadtime | grep -i --color=auto "$@" | tee $suffix.$@.log
}
adbs(){
suffix=`date +%F-%H-%M-%S`
adb logcat -v threadtime -s "$@" | tee $suffix."$@".log
}
greps(){
grep -nrHi "$@" .
}
mkill(){
adb shell kill -9 `adb shell ps | grep "$@" | awk '{print $2}'`
}
bind 'set completion-ignore-case on'
bind 'set completion-prefix-display-length 2'
bind 'set skip-completed-text on'
bind 'set colored-stats on'
bind 'set show-all-if-ambiguous on'
# Dev
JAVA_HOME=/usr/lib/jvm/java-6-oracle
ADT_HOME=/home/houruhou/Software/Apps/adt-bundle-linux-x86_64-20140702/sdk
PATH=$PATH:$JAVA_HOME/bin:$ADT_HOME/tools:$ADT_HOME/platform-tools:$ADT_HOME/build-tools/android-4.4W:/home/houruhou/Software/Apps/bin
# decompile
PATH=$PATH:/home/houruhou/Software/Apps/apktool1.5.2:/home/houruhou/Software/Apps/dex2jar-0.0.9.15:/home/houruhou/Software/Apps/jd-gui:
alias si="wine /home/houruhou/.wine/drive_c/Program\ Files\ \(x86\)/Source\ Insight\ 3/Insight3.exe"
alias subl="/home/houruhou/Software/Done/sublime_text_3/sublime_text"
alias sl="ls"
alias open="gnome-open "
alias bypy="/home/houruhou/OpenSource/Python/bypy/bypy.py"
alias bypygui="/home/houruhou/OpenSource/Python/bypy/bypygui.pyw"
alias asm="java -jar /home/houruhou/Software/Apps/bin/asm.jar"
alias resize9="java -jar /home/houruhou/Software/Apps/bin/9-Patch-Resizer_1.3.2_flyme.jar"
alias m76fast="/home/houruhou/Software/Confs/fastboot_m76.sh"
# Git
ssh-add ~/.ssh/id_rsa_github >/dev/null 2>&1
ssh-add ~/.ssh/id_rsa_meizu >/dev/null 2>&1
# Locale
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
# Path
SRC="/home/houruhou/Workspace/MeiZu/m76/packages/apps/VoiceAssistant"
BUG="/home/houruhou/Workspace/BugFix"
M71="/home/houruhou/Workspace/MeiZu/m71"
M76="/home/houruhou/Workspace/MeiZu/m76"
BUG="/home/houruhou/Workspace/BugFix"
ROM="/home/houruhou/Workspace/RomPackages"
M71C="/home/houruhou/Workspace/MeiZu/m71c"
WORKON_HOME="/home/houruhou/Software/Apps/PyVirtualEnvs"
FLY="/home/houruhou/Workspace/MeiZu/flyme_base"
M76B="/home/houruhou/Workspace/MeiZu/m76_base"
BLOG="/home/houruhou/Workspace/Solarex/repos/solarex.github.com/tmp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment