├── LICENSE ├── LinuxBase ├── cuda.repo ├── nvidia-docker2-Install.sh ├── ubuntu16.04&18.04-aptrepo └── 字符集设置 ├── README.md ├── bash ├── README.md ├── bashrc └── install.sh ├── bin ├── README.md ├── de ├── di ├── dr ├── git-get ├── git-id ├── git-proxy-wrapper ├── git-url ├── install.sh ├── jsonformat ├── pgit ├── sshcpid ├── svndiff ├── svnvi ├── vbox ├── www └── youdown ├── ctags ├── ctags └── install.sh ├── dircolors ├── dircolors └── install.sh ├── git ├── gitconfig.sh └── install.sh ├── install.sh ├── karabiner ├── README.md ├── install.sh └── karabiner.json ├── mac-defaults └── install.sh ├── mutt ├── install.sh └── muttrc ├── mycalsh.yml ├── profiles.d-examples ├── aws-cli-completion.sh ├── docker-machine-env.sh ├── go-path.sh └── ruby-env.sh ├── screen ├── install.sh └── screenrc ├── squirrel ├── README.md ├── install.sh └── squirrel.custom.yaml ├── ssh ├── config.sample └── install.sh ├── tmux ├── install.sh └── tmux.conf ├── vim ├── README.md ├── install.sh └── vimrc └── zsh ├── README.md ├── install.sh └── zshrc /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /LinuxBase/cuda.repo: -------------------------------------------------------------------------------- 1 | [cuda] 2 | name=cuda 3 | baseurl=http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64 4 | enabled=1 5 | gpgcheck=1 6 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA -------------------------------------------------------------------------------- /LinuxBase/nvidia-docker2-Install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \ 4 | sudo apt-key add - 5 | 6 | distribution=$(. /etc/os-release;echo $ID$VERSION_ID) 7 | 8 | curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu16.04/nvidia-docker.list | \ 9 | sudo tee /etc/apt/sources.list.d/nvidia-docker.list 10 | sudo apt-get update 11 | sudo apt-get install -y nvidia-docker2 -------------------------------------------------------------------------------- /LinuxBase/ubuntu16.04&18.04-aptrepo: -------------------------------------------------------------------------------- 1 | # ubuntu14.04 2 | 3 | deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse 4 | deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse 5 | deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse 6 | deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse 7 | deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 8 | deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse 9 | deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse 10 | deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse 11 | deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse 12 | deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 13 | 14 | 15 | # ubuntu16.04 16 | 17 | 18 | deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse 19 | deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse 20 | deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse 21 | deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse 22 | deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse 23 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse 24 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse 25 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse 26 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse 27 | deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse 28 | 29 | # ubuntu18.04 30 | 31 | 32 | deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 33 | deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 34 | deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 35 | deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 36 | deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 37 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 38 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 39 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 40 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 41 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse -------------------------------------------------------------------------------- /LinuxBase/字符集设置: -------------------------------------------------------------------------------- 1 | LANG=en_US.UTF-8 2 | LANGUAGE=en_US.UTF-8 3 | LC_CTYPE=en_US.UTF-8 4 | LC_NUMERIC=en_US.UTF-8 5 | LC_TIME=en_US.UTF-8 6 | LC_COLLATE=en_US.UTF-8 7 | LC_MONETARY=en_US.UTF-8 8 | LC_MESSAGES=en_US.UTF-8 9 | LC_PAPER=en_US.UTF-8 10 | LC_NAME=en_US.UTF-8 11 | LC_ADDRESS=en_US.UTF-8 12 | LC_TELEPHONE=en_US.UTF-8 13 | LC_MEASUREMENT=en_US.UTF-8 14 | LC_IDENTIFICATION=en_US.UTF-8 15 | LC_ALL=en_US.UTF-8 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | My dot files 2 | ============ 3 | 4 | Run `./install.sh [component]` to install them to `$HOME` directory. 5 | 6 | - `bash`: bashrc for general Linux host with nice shortcuts (f, vif, etc.) 7 | - `bin`: useful small scripts to be put into ~/bin 8 | - `ctags`: config file for ctags 9 | - `dircolors`: ls color scheme be placed as ~/.dircolors 10 | - `git`: script to configure git perferences 11 | - `karabiner`: config file for karabiner key mapper 12 | - `mac-defaults`: script to write useful defaults for Mac OS X 13 | - `mutt`: common config for mutt 14 | - `profiles.d-examples`: example shell environment 15 | - `screen`: config file for GNU screen (date/time in status line) 16 | - `squirrel`: config for Squirrel (Rime) IME 17 | - `ssh`: example ssh config 18 | - `tmux`: tmux profile with lots of cool stuff 19 | - `vim`: vim profile that use vim-plug to manage plugins 20 | - `zsh`: zshrc for general Linux host with nice shortcuts (f, vif, etc.) 21 | 22 | ![Screenshot](https://raw.github.com/ymattw/profiles/gh-pages/img/profiles.png) 23 | -------------------------------------------------------------------------------- /bash/README.md: -------------------------------------------------------------------------------- 1 | # Bash Profile 2 | Just run `./install.sh` to install it as `~/.bashrc`. You can put your own 3 | customization under `~/.profiles.d` dir (shared by both my zsh profiles and 4 | bash profiles). See also `../profiles.d-examples`. 5 | -------------------------------------------------------------------------------- /bash/bashrc: -------------------------------------------------------------------------------- 1 | # Matt Wang's bash profile for general Linux/Unix 2 | # 3 | # Suggestion: ln -sf .bashrc .bash_profile 4 | # 5 | # - Functions with name starts with '__' are considered 'private' and will be 6 | # unset at the end. 7 | # - Functions with name starts with only one '_' are considered 'protected', 8 | # users can implement their own to override (via ~/.profiles.d). 9 | 10 | # Find a file which name matches given pattern (ERE, case insensitive) 11 | function f 12 | { 13 | local pat=${1?'Usage: f ERE-pattern [path...]'} 14 | shift 15 | find ${@:-.} \( -path '*/.svn' -o -path '*/.git' -o -path '*/.idea' \) \ 16 | -prune -o -print -follow | grep -iE "$pat" 17 | } 18 | 19 | # Load file list generated by f() in vim, type 'gf' to jump to the file 20 | function vif 21 | { 22 | local tmpf=/tmp/viftmpfile.$RANDOM$$ 23 | f "$@" > $tmpf && vi -c "/$1" $tmpf && rm -f $tmpf 24 | } 25 | 26 | # "Protected" helper to decorate CWD used to setup PS1 27 | function _source_control_cwd 28 | { 29 | [[ $PWD != ${HOME}* ]] || { echo ${PWD/$HOME/\~}; return 0; } 30 | echo $PWD 31 | } 32 | 33 | # "Protected" helper to decorate source control information used to setup 34 | # PS1, by default this only detect active git branch information. User can 35 | # extend this to detect other version control system. 36 | # 37 | function _source_control_info 38 | { 39 | if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) == true ]]; then 40 | _git_active_branch 41 | fi 42 | } 43 | 44 | function _git_active_branch 45 | { 46 | local branch info age track 47 | 48 | branch=$(git symbolic-ref HEAD 2>/dev/null) 49 | branch=${branch#refs/heads/} 50 | info=$(git status -s 2>/dev/null) 51 | age=$(git log --pretty=format:'%cr' -1 refs/heads/$branch 2>/dev/null) 52 | track=$(git status -sb 2>/dev/null | sed -n 's/^##.*\[\(.*\)\].*/, \1/p') 53 | 54 | # NOTE: have to use $'string' for ansi escape sequence here 55 | if [[ -z $info ]]; then 56 | echo -ne $'\e[32m'" ($branch) "$'\e[36m'"[${age}${track}]" 57 | elif [[ -z $(echo "$info" | grep -v '^??') ]]; then 58 | echo -ne $'\e[35m'" ($branch) "$'\e[36m'"[${age}${track}]" 59 | else 60 | echo -ne $'\e[31m'" ($branch) "$'\e[36m'"[${age}${track}]" 61 | fi 62 | } 63 | 64 | function __main 65 | { 66 | local fn 67 | 68 | [[ ! -f /etc/profile ]] || source /etc/profile 69 | [[ ! -f /etc/bashrc ]] || source /etc/bashrc 70 | unset PROMPT_COMMAND # Let tmux manage it 71 | 72 | for fn in \ 73 | __setup_path \ 74 | __setup_shell_options \ 75 | __setup_environments \ 76 | __setup_aliases \ 77 | __setup_completions \ 78 | __setup_dir_colors \ 79 | __setup_ssh_agent \ 80 | __setup_prompt \ 81 | __setup_custom_profiles \ 82 | ; do 83 | $fn; unset -f $fn 84 | done 85 | } 86 | 87 | function __prepend_path 88 | { 89 | [[ :$PATH: == *:${1:?}:* ]] || PATH=$1:$PATH 90 | } 91 | 92 | function __setup_path 93 | { 94 | local x 95 | 96 | # prepend paths 97 | for x in /sbin /usr/sbin /bin /usr/bin /usr/local/bin; do 98 | __prepend_path $x 99 | done 100 | 101 | # ~/bin takes precedence 102 | __prepend_path ~/bin 103 | 104 | export PATH 105 | } 106 | 107 | function __setup_shell_options 108 | { 109 | bind 'set match-hidden-files off' >& /dev/null # No tab-expand hidden files 110 | ! test -t 0 || stty stop undef >& /dev/null # Make 'C-s' to do i-search 111 | } 112 | 113 | function __setup_environments 114 | { 115 | export HISTFILE=~/.bash_history # In case switched from zsh temporally 116 | export HISTSIZE=10000 117 | export EDITOR=vim 118 | 119 | # Locale (LC_*) matters for ls and sort on Linux, see also 120 | # www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021 121 | # 122 | [[ $(uname -s) != Linux ]] || export LC_COLLATE=C 123 | } 124 | 125 | # Non "private" helper function to auto complete hostnames, note 'complete -A 126 | # hostname' also works but it does not recognize new $HOSTFILE 127 | # 128 | function _host_complete 129 | { 130 | local cur=${COMP_WORDS[COMP_CWORD]} 131 | local hosts=$(sed -ne 's/[, ].*//p' ~/.ssh/known_hosts* 2>/dev/null) 132 | COMPREPLY=($(compgen -W "$hosts" -- $cur)) 133 | } 134 | 135 | function __setup_completions 136 | { 137 | # git-completion.bash is installed by install.sh 138 | [[ ! -f ~/.git-completion.bash ]] || . ~/.git-completion.bash 139 | complete -F _host_complete ssh scp host nc ping telnet 140 | complete -A export unset 141 | } 142 | 143 | function __setup_aliases 144 | { 145 | local lsprog="/bin/ls" 146 | 147 | alias ..='cd ..' 148 | alias ...='cd ../..' 149 | alias ....='cd ../../..' 150 | alias .....='cd ../../../..' 151 | # Skip system wide vimrc to reduce startup time 152 | ! type vim >& /dev/null || alias vi='vim -Xn -u ~/.vimrc' 153 | ! type ag >& /dev/null || alias ag='command ag --nogroup' 154 | alias grep='grep --color=auto' 155 | 156 | case $(uname -s) in 157 | Linux) 158 | lsprog="/bin/ls --color=auto" 159 | alias ls="$lsprog -F" 160 | alias l="$lsprog -lF" 161 | alias lsps='ps -ef f | grep -vw grep | grep -i' 162 | ;; 163 | Darwin) 164 | type gls >& /dev/null && lsprog="gls --color=auto" 165 | alias ls="$lsprog -F" 166 | alias l="$lsprog -lF" 167 | alias lsps='ps -ax -o user,pid,ppid,stime,tty,time,command | grep -vw grep | grep -i' 168 | ;; 169 | *) 170 | alias ls="$lsprog -F" 171 | alias l="$lsprog -lF" 172 | alias lsps='ps -auf | grep -vw grep | grep -i' 173 | ;; 174 | esac 175 | } 176 | 177 | function __setup_dir_colors 178 | { 179 | local prog=dircolors 180 | 181 | [[ $(uname -s) != Darwin ]] || prog=gdircolors 182 | if type $prog >& /dev/null && [[ -f ~/.dircolors ]]; then 183 | eval $($prog -b ~/.dircolors) 184 | fi 185 | } 186 | 187 | function __has_ssh_key 188 | { 189 | [[ -f ~/.ssh/$USER.key ]] || ls ~/.ssh/id_?sa >& /dev/null 190 | } 191 | 192 | function __load_ssh_key 193 | { 194 | [[ ! -f "${1:?}" ]] || ssh-add -L | grep -qw "$1" || ssh-add "$1" 195 | } 196 | 197 | # ssh-add -l exits code 2 when unable to connect to the agent 198 | function __setup_ssh_agent 199 | { 200 | local rc=~/.ssh-agent.rc 201 | 202 | # Skip in typical corporation environment 203 | [[ -z $SK_SIGNING_PLUGIN ]] || return 0 204 | 205 | __has_ssh_key || return 0 206 | [[ ! -f $rc ]] || source $rc 207 | if [[ $(ssh-add -l >& /dev/null; echo $?) == 2 ]]; then 208 | print -P "%{\e[31m%}Starting a new ssh-agent process...%{\e[0m}" >&2 209 | rm -f ~/.ssh-agent.sock 210 | ssh-agent -s -a ~/.ssh-agent.sock | sed '/^echo/d' > $rc 211 | source $rc 212 | fi 213 | 214 | __load_ssh_key ~/.ssh/$USER.key 215 | __load_ssh_key ~/.ssh/id_rsa 216 | __load_ssh_key ~/.ssh/id_dsa 217 | } 218 | 219 | # Fancy PS1, prompt exit status of last command, currenet time, hostname, time, 220 | # cwd, git status and branch, also prompt the '%' in reverse color when we have 221 | # background jobs. '\[' and '\]' is to mark ansi colors to allow shell to 222 | # calculate prompt string length correctly 223 | # 224 | function __setup_prompt 225 | { 226 | local _DR="\[\e[31m\]" # red 227 | local _DG="\[\e[32m\]" # green 228 | local _DY="\[\e[33m\]" # yellow 229 | local _DB="\[\e[34m\]" # blue 230 | local _DM="\[\e[35m\]" # magenta 231 | local _DC="\[\e[36m\]" # cyan 232 | local _RV="\[\e[7m\]" # reverse 233 | local _NC="\[\e[0m\]" # no color 234 | 235 | PS1="\$([[ \$? == 0 ]] && echo '${_DG}✔' || echo '${_DR}✘') \t " 236 | 237 | # Detect whether this box has ssh keys, distinguish hostname color and setup 238 | # ssh-agent related environment accordingly 239 | # 240 | if __has_ssh_key; then 241 | # I am on my own machine, try load ssh-agent related environments 242 | PS1="${PS1}${_DB}" # blue hostname 243 | else 244 | # Otherwise assume I am on other's box, highlight hostname in magenta 245 | PS1="${PS1}${_DM}" # magenta hostname 246 | fi 247 | 248 | # Highlight hostname in reverse green if inside a container 249 | if [[ -n $container_uuid ]] || [[ -f /.dockerenv ]]; then 250 | PS1="${PS1}${_RV}${_DG}" 251 | fi 252 | PS1="${PS1}$(hostname -f | cut -d. -f1-2)" # 2 hostname components 253 | PS1="${PS1}${_NC}:${_DY}\$(_source_control_cwd)" # yellow cwd 254 | PS1="${PS1}${_NC}\$(_source_control_info)" # source control info 255 | PS1="${PS1}${_DC} ⤾\n" # cyan wrap char, NL 256 | PS1="${PS1}\$([[ -z \$(jobs) ]] || echo '$_RV')" # reverse bg job 257 | PS1="${PS1}\\\$${_NC} " # $ or # 258 | } 259 | 260 | # Load custom settings from ~/.profile.d/*.sh, typical settings are 261 | # docker-machine env, GOPATH, customized PATH etc. 262 | # 263 | function __setup_custom_profiles 264 | { 265 | local p 266 | 267 | ls ~/.profiles.d/*.sh >& /dev/null || return 0 268 | 269 | for p in ~/.profiles.d/*.sh; do 270 | source $p 271 | done 272 | } 273 | 274 | ######################################################################## 275 | # Setup everything and unset the rest "private" functions 276 | ######################################################################## 277 | 278 | __main 279 | unset -f __prepend_path __has_ssh_key __load_ssh_key __main 280 | 281 | # vim:set et sts=4 sw=4 ft=sh: 282 | -------------------------------------------------------------------------------- /bash/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | readonly BACKUP_DIR=~/.bash.backup 8 | readonly BASH_FILES=(~/.bash_profile ~/.bashrc ~/.bash_login ~/.profile) 9 | 10 | mkdir -p $BACKUP_DIR 11 | for x in ${BASH_FILES[@]}; do 12 | [[ ! -f $x ]] || cp $x $BACKUP_DIR/ 13 | done 14 | 15 | rm -f ${BASH_FILES[@]} 16 | 17 | cp $SELF_DIR/bashrc ~/.bashrc 18 | ln -s .bashrc ~/.bash_profile 19 | 20 | [[ -s ~/.git-completion.bash ]] || { 21 | curl -fksSLo ~/.git-completion.bash \ 22 | https://raw.github.com/git/git/master/contrib/completion/git-completion.bash 23 | } 24 | -------------------------------------------------------------------------------- /bin/README.md: -------------------------------------------------------------------------------- 1 | # Home Made Scripts 2 | 3 | Scripts to be placed into my `~/bin`, or just clone the whole repo into 4 | `~/bin`. 5 | 6 | - di - display major info of a docker container filtering by name 7 | - de - shortcut for `docker exec` 8 | - dr - start an interactive docker container 9 | - git-get - wrapper of `git clone` to clone into an author/repo dir 10 | - git-id - list or switch git ids defined in ~/.git-ids 11 | - git-url - show git remotes and clickable urls 12 | - jsonformat - pretty print json input from stdin with python json.tool 13 | - sshcpid - expect script, a better ssh-copy-id(1) 14 | - vbox - start a VirtualBox VM headlessly (Mac only) 15 | - www - serve a directry over http via python SimpleHTTPServer 16 | - youdown - download video with youtube-dl and merge parts with ffmpeg 17 | -------------------------------------------------------------------------------- /bin/de: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker exec -it ${1:?} /bin/sh -c \ 4 | 'if [ -x /bin/bash ]; then exec /bin/bash; else exec /bin/sh; fi' 5 | -------------------------------------------------------------------------------- /bin/di: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Display major info of a docker container filtering by name 3 | 4 | NAME_PATTERN="${1:?}" 5 | 6 | function inspect 7 | { 8 | local id=${1:?} 9 | 10 | local name=$(docker inspect --format='{{.Name}}' $id) 11 | local image=$(docker inspect --format='{{.Config.Image}}' $id) 12 | local ip=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $id) 13 | local ports=$(docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}}->{{$conf}} {{end}}' $id) 14 | local logpath=$(docker inspect --format='{{.LogPath}}' $id) 15 | 16 | echo -e $'\e[32m'${name#/}$'\e[0m'" ($image)" 17 | echo " $ip $ports" 18 | echo " $logpath" 19 | } 20 | 21 | # Main 22 | IDS=$(docker ps | awk "/ [a-zA-Z0-9_-]*${NAME_PATTERN}[a-zA-Z0-9_-]*$/ {print \$1}") 23 | 24 | for ID in $IDS; do 25 | inspect $ID 26 | done 27 | -------------------------------------------------------------------------------- /bin/dr: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [[ -n $1 ]] || { 4 | cat << EOF 5 | Usage: $0 [docker run options] [cmd...]" 6 | 7 | NOTE! '--rm' is implicit unless '--name' is provided 8 | 9 | Available images: 10 | 11 | $(docker images) 12 | EOF 13 | exit 1 14 | } 15 | 16 | IMAGE="$1"; shift 17 | OPTS=() 18 | NAME="" 19 | 20 | while (( $# > 0 )); do 21 | case $1 in 22 | --name) 23 | NAME="$2" 24 | shift 25 | ;; 26 | --name=*) 27 | NAME=${1##*=} 28 | ;; 29 | --rm|--*=*) 30 | OPTS+=("$1") 31 | ;; 32 | -v|-e) 33 | OPTS+=(-v "$2") 34 | shift 35 | ;; 36 | *) 37 | break # break at first non option arg 38 | ;; 39 | esac 40 | shift 41 | done 42 | 43 | OPTS+=( 44 | -it 45 | -P 46 | -v /etc/localtime:/etc/localtime:ro 47 | -v $HOME:$HOME 48 | -w "$PWD" 49 | ) 50 | 51 | if [[ -n $NAME ]]; then 52 | OPTS+=(--name "$NAME" --hostname "$NAME") 53 | else 54 | OPTS+=(--rm) 55 | fi 56 | 57 | if [[ $(ps -p ${SSH_AGENT_PID:-0} -o comm= 2>/dev/null) == ssh-agent ]] \ 58 | && [[ -S $SSH_AUTH_SOCK ]]; then 59 | OPTS+=(-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK:ro) 60 | OPTS+=(-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK) 61 | fi 62 | 63 | docker run "${OPTS[@]}" $IMAGE "${@:-/bin/bash}" 64 | -------------------------------------------------------------------------------- /bin/git-get: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Wrapper of `git clone` to clone into an author/repo dir 3 | 4 | GIT_URL="" 5 | 6 | # Detect git url from input arguments 7 | for x in "$@"; do 8 | if [[ $x == http*//*/* ]] || [[ $x == *@*:* ]]; then 9 | GIT_URL="$x" 10 | break 11 | fi 12 | done 13 | 14 | [[ -n $GIT_URL ]] || { echo "Git url required"; exit 1; } 15 | REPO_NAME=$(basename ${GIT_URL%.git}) 16 | AUTHOR=$(basename ${GIT_URL%/*}) 17 | AUTHOR=${AUTHOR##*:} 18 | 19 | git clone "$@" $AUTHOR/$REPO_NAME 20 | -------------------------------------------------------------------------------- /bin/git-id: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # List or switch git ids (user.name and user.email) defined in ~/.git-ids, 4 | # for example, define ~/.git-ids as below: 5 | # 6 | # github ymattw@example.com Matthew Wang 7 | # corp matt@example.org Matthew Y Wang 8 | # 9 | # Then you can run 'git-id github' to setup user.name and user.email to your 10 | # github account and run 'git-id corp' to switch to your corp account. 11 | 12 | set -o errexit 13 | set -o nounset 14 | 15 | readonly GIT_ID_FILE=~/.git-ids 16 | readonly ID=${1:-""} 17 | 18 | [[ -r $GIT_ID_FILE ]] || { 19 | echo "$GIT_ID_FILE not found, define your ids as 'id email first last'" >&2 20 | echo "there (one id per line) to switch id quickly" >&2 21 | exit 0 22 | } 23 | 24 | [[ -n $ID ]] || { 25 | echo "Current user:" 26 | echo " $(git config user.name) $(git config user.email)" 27 | echo 28 | echo "Available ids:" 29 | cat $GIT_ID_FILE | sed 's/^/ /' 30 | exit 0 31 | } 32 | 33 | BLANK="[[:blank:]]*" 34 | ID_LINE=$(grep -Eo "^${BLANK}${ID}${BLANK}.*" $GIT_ID_FILE) || { 35 | echo "Id '$ID' not found in $GIT_ID_FILE" >&2 36 | exit 1 37 | } 38 | 39 | set -- $ID_LINE 40 | 41 | : ${3:?"Incomplete config for id '$ID' in $GIT_ID_FILE"} 42 | 43 | git config user.email $2 44 | shift; shift 45 | git config user.name "$*" 46 | -------------------------------------------------------------------------------- /bin/git-proxy-wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | GIT_SOCKS5_PROXY=${GIT_SOCKS_PROXY:-"localhost:1080"} 4 | 5 | nc -x $GIT_SOCKS5_PROXY -X5 "$@" 6 | -------------------------------------------------------------------------------- /bin/git-url: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Convert git https or ssh url to clickable hyperlink 3 | 4 | FILENAME=${1:-""} 5 | 6 | REPO_URLS=$(git remote -v \ 7 | | perl -pe 's,(.*\sgit@|.*://|\.git .*),,g; s,:,/,' \ 8 | | sort -u) 9 | 10 | BRANCH=$(git symbolic-ref HEAD 2>/dev/null) 11 | BRANCH=${BRANCH#refs/heads/} 12 | 13 | if [[ -n $FILENAME ]]; then 14 | [[ -f $FILENAME ]] || { echo "No such file $FILENAME" >&2; exit 1; } 15 | LEAF=$(git log -1 --name-only --pretty=format: $FILENAME) 16 | for URL in $REPO_URLS; do 17 | echo $URL/blob/$BRANCH/$LEAF 18 | done 19 | else 20 | for URL in $REPO_URLS; do 21 | echo $URL 22 | done 23 | fi 24 | -------------------------------------------------------------------------------- /bin/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | mkdir -p ~/bin 9 | rsync -a --exclude install.sh --exclude README.md $SELF_DIR/ ~/bin/ 10 | -------------------------------------------------------------------------------- /bin/jsonformat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python -m json.tool "$@" 4 | -------------------------------------------------------------------------------- /bin/pgit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Example usage: GIT_SOCKS5_PROXY=localhost:1081 pgit clone ... 3 | 4 | GIT_PROXY_COMMAND=git-proxy-wrapper git "$@" 5 | -------------------------------------------------------------------------------- /bin/sshcpid: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env expect 2 | # 3 | # Script to install your ssh public key on a remote machine. This is an 4 | # enhanced version of /usr/bin/ssh-copy-id, it utilizes expect(1) to input 5 | # password automatically. Run me without argument to get usage information. 6 | 7 | if {$argc < 3} { 8 | puts "" 9 | puts "Usage: sshcpid.ex \[ssh_options...]" 10 | puts "" 11 | puts "E.g. : sshcpid.ex 12.34.56.78 'ChangeMe' identity.pub -l root" 12 | puts "" 13 | puts "Ssh_options are extra ssh options, most used options are" 14 | puts "" 15 | puts " -l login_name" 16 | puts " -p port" 17 | puts " -o UserKnownHostsFile=/path/to/file" 18 | puts " -o CheckHostIP=yes|no" 19 | puts " -o StrictHostKeyChecking=yes|no" 20 | puts "" 21 | puts "See ssh(1) and ssh_config(5) for details." 22 | puts "" 23 | exit 1 24 | } 25 | 26 | set hostname [lindex $argv 0] 27 | set password [lindex $argv 1] 28 | set pubkey [lindex $argv 2] 29 | 30 | # Form ssh options 31 | set sshoptions "-o PreferredAuthentications=keyboard-interactive,password -o VerifyHostKeyDNS=no" 32 | for {set i 3} {$i < $argc} {incr i 1} { 33 | set sshoptions "$sshoptions [lindex $argv $i]" 34 | } 35 | 36 | # Read pubkey and save into $publickey 37 | set pubkey_fd [open $pubkey] 38 | set publickey [read $pubkey_fd] 39 | close $pubkey_fd 40 | set publickey [string trimright "$publickey" "\n"] 41 | 42 | set new_ps1 "\n(sshcpid.ex)# " 43 | set sshd_cfg "/etc/ssh/sshd_config" 44 | 45 | set timeout 120 46 | eval spawn ssh -F /dev/null $sshoptions $hostname 47 | expect { 48 | "continue connecting (yes/no)\? " { 49 | send "yes\r" 50 | expect "assword: " 51 | sleep 1 52 | send "$password\r" 53 | } 54 | "assword: " { 55 | send "$password\r" 56 | } 57 | -re "\\\$|#|>" { 58 | send "\r" 59 | } 60 | "Connection refused" { 61 | puts "*** sshd not running?" 62 | exit 1 63 | } 64 | "Host key verification failed" { 65 | puts "*** Offending host key, system reinstalled?" 66 | exit 1 67 | } 68 | timeout { 69 | puts "*** Timed out." 70 | exit 1 71 | } 72 | } 73 | 74 | # First command: set PS1 and disable command "clear" by making an empty alias 75 | # for it to keep output on the screen after ssh session ended (works for Redhat) 76 | # 77 | expect { 78 | -re "\\\$|#|>" { 79 | send "PS1='$new_ps1'; alias clear=''\r" 80 | } 81 | "assword:" { 82 | puts "*** Wrong password?" 83 | exit 1 84 | } timeout { 85 | puts "*** Timed out." 86 | exit 1 87 | } 88 | } 89 | 90 | # Other commands 91 | # 92 | 93 | # Create dirs 94 | expect { 95 | -re "Connection to .* closed." { 96 | exit 1 97 | } 98 | "$new_ps1" { 99 | send "mkdir -p ~/.ssh || exit 1\r" 100 | } 101 | } 102 | 103 | # Shouldn't overwrite authorized_keys, append instead 104 | expect { 105 | -re "Connection to .* closed." { 106 | exit 1 107 | } 108 | "$new_ps1" { 109 | send "AKEY=~/.ssh/authorized_keys\r" 110 | send "PUBKEY='$publickey'\r" 111 | send "grep -q \"^\$PUBKEY\" \$AKEY 2>/dev/null || " 112 | send "/bin/echo \"\$PUBKEY\" >> \$AKEY || exit 1\r" 113 | } 114 | } 115 | 116 | # file/dir permissions 117 | expect { 118 | -re "Connection to .* closed." { 119 | exit 1 120 | } 121 | "$new_ps1" { 122 | send "chmod go-w ~ \$AKEY || exit 1\r" 123 | } 124 | } 125 | expect { 126 | -re "Connection to .* closed." { 127 | exit 1 128 | } 129 | "$new_ps1" { 130 | send "chmod 700 ~/.ssh || exit 1\r" 131 | } 132 | } 133 | 134 | # Last command: exit 0 135 | # 136 | expect "$new_ps1" 137 | send "exit 0\r" 138 | 139 | set timeout 30 140 | expect eof 141 | exit 0 142 | 143 | # vim:set tw=80 et sts=4 ts=8 sw=4: 144 | -------------------------------------------------------------------------------- /bin/svndiff: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Configure your favorite diff program here. 4 | DIFF="/usr/bin/vimdiff" 5 | 6 | # Subversion provides the paths we need as the sixth and seventh 7 | # parameters. 8 | LEFT="$6" 9 | RIGHT="${5%% *}" # It's a tab! 10 | 11 | # Call the diff command (change the following line to make sense for 12 | # your merge program). 13 | $DIFF $LEFT $RIGHT 14 | -------------------------------------------------------------------------------- /bin/svnvi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | svn diff --diff-cmd ~/bin/svndiff "$@" 4 | -------------------------------------------------------------------------------- /bin/vbox: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless \ 4 | -s ${1?"vm name required"} & 5 | -------------------------------------------------------------------------------- /bin/www: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | DIR="." 7 | PORT=8080 8 | 9 | function get_external_ip 10 | { 11 | local os=$(uname -s) 12 | local interface 13 | local ip 14 | 15 | case "$os" in 16 | Darwin) 17 | interface=$(/sbin/route -n get default | grep interface: | awk '{print $2}') 18 | ip=$(/sbin/ifconfig $interface | grep -w inet | awk '{print $2}') 19 | ;; 20 | Linux) 21 | ip=$(/sbin/ip route get 1.1.1.1 | sed -n 's/.*src \(.*\) \?$/\1/p') 22 | ;; 23 | *) 24 | echo "Unsupported system '$os'" >&2 25 | return 1 26 | ;; 27 | esac 28 | 29 | [[ -n $ip ]] || return 1 30 | echo $ip 31 | } 32 | 33 | while (( $# > 0 )); do 34 | case "$1" in 35 | -d|--dir) 36 | DIR="$2" 37 | shift; shift 38 | ;; 39 | -p|--port) 40 | PORT="$2" 41 | shift; shift 42 | ;; 43 | *) 44 | echo "Unknow option '$1'" >&2 45 | echo "Usage: $0 [-d|--dir dir] [-p|--port port]" 46 | exit 1 47 | ;; 48 | esac 49 | done 50 | 51 | EXTERNAL_IP=$(get_external_ip) 52 | cd $DIR && DIR=$(pwd) 53 | 54 | echo "Serving $DIR as http://$(hostname -f):$PORT (http://$EXTERNAL_IP:$PORT)" 55 | python -m SimpleHTTPServer $PORT 56 | -------------------------------------------------------------------------------- /bin/youdown: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Download video with youtube-dl [1] and merge parts with ffmpeg [2] 4 | # 5 | # [1] https://github.com/rg3/youtube-dl 6 | # [2] https://www.ffmpeg.org 7 | 8 | set -o errexit 9 | set -o nounset 10 | 11 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 12 | readonly TAG="---___---" # special tag to identify the file just downloaded 13 | 14 | function merge 15 | { 16 | local output=${1:?} 17 | shift 18 | local f 19 | local file=files-$$.txt 20 | 21 | trap "rm -f $file" RETURN 22 | 23 | for f in "$@"; do echo "file '$f'"; done > $file 24 | cat $file 25 | ffmpeg -f concat -i $file -c copy "$output" 26 | } 27 | 28 | readonly URL=${1:-} 29 | readonly NAME=${2:-"%(title)s"} 30 | 31 | [[ -n $URL ]] || { 32 | echo "Usage: $0 [youtube-dl options]" 33 | exit 1 34 | } 35 | 36 | shift 37 | [[ -z $NAME ]] || shift 38 | 39 | # Now the rest args are youtube-dl options 40 | youtube-dl -o "${NAME}${TAG}%(id)s.%(ext)s" "$@" "$URL" 41 | 42 | # Detect destination name, realname and file extension 43 | DEST=$(/bin/ls *${TAG}*part1.*) 44 | REALNAME=${DEST%%${TAG}*} 45 | EXT=${DEST##*.} 46 | 47 | # If we have a 'part2' file, then merge it with ffmpeg, otherwise just rename 48 | # downloaded file. Watch out possible spaces in filename! 49 | # 50 | if ls "${REALNAME}"*part2.${EXT} >& /dev/null; then 51 | merge "${REALNAME}".${EXT} "${REALNAME}${TAG}"*part*.${EXT} 52 | else 53 | mv "${REALNAME}${TAG}"*part1.${EXT} "${REALNAME}".${EXT} 54 | fi 55 | -------------------------------------------------------------------------------- /ctags/ctags: -------------------------------------------------------------------------------- 1 | -R 2 | --exclude=.git 3 | 4 | --langdef=Go 5 | --langmap=Go:.go 6 | --regex-Go=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/ 7 | --regex-Go=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/ 8 | --regex-Go=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/ 9 | 10 | --langdef=js 11 | --langmap=js:.js 12 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\{/\5/,object/ 13 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\5/,function/ 14 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\[/\5/,array/ 15 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[^"]'[^']*/\5/,string/ 16 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*(true|false)/\5/,boolean/ 17 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[0-9]+/\5/,number/ 18 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*.+([,;=]|$)/\5/,variable/ 19 | --regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*[ \t]*([,;]|$)/\5/,variable/ 20 | --regex-js=/function[ \t]+([A-Za-z0-9_$]+)[ \t]*\([^)]*\)/\1/,function/ 21 | --regex-js=/(,|^)[ \t]*([A-Za-z_$][A-Za-z0-9_$]+)[ \t]*:[ \t]*\{/\2/,object/ 22 | --regex-js=/(,|^)[ \t]*([A-Za-z_$][A-Za-z0-9_$]+)[ \t]*:[ \t]*function[ \t]*\(/\2/,function/ 23 | --regex-js=/(,|^)[ \t]*([A-Za-z_$][A-Za-z0-9_$]+)[ \t]*:[ \t]*\[/\2/,array/ 24 | --regex-js=/(,|^)[ \t]*([A-Za-z_$][A-Za-z0-9_$]+)[ \t]*:[ \t]*[^"]'[^']*/\2/,string/ 25 | --regex-js=/(,|^)[ \t]*([A-Za-z_$][A-Za-z0-9_$]+)[ \t]*:[ \t]*(true|false)/\2/,boolean/ 26 | --regex-js=/(,|^)[ \t]*([A-Za-z_$][A-Za-z0-9_$]+)[ \t]*:[ \t]*[0-9]+/\2/,number/ 27 | --regex-js=/(,|^)[ \t]*([A-Za-z_$][A-Za-z0-9_$]+)[ \t]*:[ \t]*[^=]+([,;]|$)/\2/,variable/ 28 | -------------------------------------------------------------------------------- /ctags/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | rsync $SELF_DIR/ctags ~/.ctags 9 | -------------------------------------------------------------------------------- /dircolors/dircolors: -------------------------------------------------------------------------------- 1 | # My LS_COLORS preference 2 | 3 | # General 4 | BLK 38;5;136 5 | CAPABILITY 38;5;136 6 | CHR 38;5;136 7 | DIR 38;5;33 8 | DOOR 38;5;136 9 | EXEC 38;5;40 10 | FIFO 38;5;126 11 | FILE 38;1;254 12 | LINK target 13 | MULTIHARDLINK 38;5;222;1 14 | 15 | NORMAL 38;1;254 16 | ORPHAN 38;5;196;4 17 | OTHER_WRITABLE 38;5;196 18 | SETGID 38;5;196 19 | SETUID 38;5;196 20 | SOCK 38;5;126 21 | STICKY 38;5;112;4 22 | STICKY_OTHER_WRITABLE 38;5;112;3 23 | 24 | # Executables 25 | .sh 38;5;112 26 | .bash 38;5;112 27 | .pl 38;5;112 28 | .py 38;5;112 29 | .rb 38;5;112 30 | 31 | # Temp files 32 | .o 38;5;238 33 | .*~ 38;5;238 34 | .orig 38;5;238 35 | .swp 38;5;238 36 | .swo 38;5;238 37 | .tmp 38;5;238 38 | 39 | # Archives 40 | .gz 38;5;210 41 | .tar 38;5;210 42 | .tgz 38;5;210 43 | .bz2 38;5;210 44 | .zip 38;5;210 45 | .jar 38;5;210 46 | .rpm 38;5;210 47 | .bin 38;5;210 48 | 49 | # Common termcap 50 | TERM ansi 51 | TERM color-xterm 52 | TERM console 53 | TERM cygwin 54 | TERM gnome 55 | TERM gnome-256color 56 | TERM konsole 57 | TERM linux 58 | TERM putty 59 | TERM rxvt 60 | TERM rxvt-256color 61 | TERM rxvt-cygwin 62 | TERM rxvt-cygwin-native 63 | TERM rxvt-unicode 64 | TERM rxvt-unicode-256color 65 | TERM rxvt-unicode256 66 | TERM screen 67 | TERM screen-256color 68 | TERM screen-256color-bce 69 | TERM screen-bce 70 | TERM screen-w 71 | TERM screen.linux 72 | TERM screen.rxvt 73 | TERM terminator 74 | TERM vt100 75 | TERM xterm 76 | TERM xterm-16color 77 | TERM xterm-256color 78 | TERM xterm-88color 79 | TERM xterm-color 80 | TERM xterm-debian 81 | 82 | # vim:set ft=dircolors et sw=2: 83 | -------------------------------------------------------------------------------- /dircolors/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | cp dircolors ~/.dircolors 9 | -------------------------------------------------------------------------------- /git/gitconfig.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git config --global alias.st status 4 | git config --global alias.ci commit 5 | git config --global alias.info "remote -v show -n" 6 | git config --global alias.vi \ 7 | "difftool -y -x 'vimdiff -M \"+wincmd l\" \"+set modifiable write\"'" 8 | git config --global alias.mt "mergetool -y --tool vi" 9 | git config --global alias.br "branch --sort=-committerdate" 10 | git config --global alias.co checkout 11 | git config --global alias.ls \ 12 | "log --name-status --pretty=format:'%C(yellow)%h%C(red)%d%Creset %s %C(blue)- %an, %ar%Creset'" 13 | git config --global alias.hist \ 14 | "log --graph --pretty=format:'%C(yellow)%h%C(red)%d%Creset %s %C(blue)- %an, %ar%Creset'" 15 | git config --global alias.tail "log --oneline --decorate --graph -10" 16 | git config --global alias.loggrep "log --decorate --all-match -i --grep" 17 | git config --global alias.pick cherry-pick 18 | git config --global alias.ff "merge --ff-only" 19 | git config --global alias.noff "merge --no-ff" 20 | git config --global alias.tr "branch --set-upstream-to" 21 | 22 | # Use https://github.com/ymattw/cdiff 23 | git config --global alias.d '!cdiff -sw0' 24 | 25 | git config --global alias.rb \ 26 | '!fn() { git stash && git rebase "$@" && git stash pop; }; fn' 27 | 28 | git config --global core.editor vim 29 | git config --global color.ui true 30 | git config --global log.abbrevcommit true 31 | git config --global log.decorate short 32 | git config --global diff.noprefix true 33 | 34 | # The layout (REMOTE has patches to apply to BASE version): 35 | # 36 | # LOCAL | BASE | REMOTE 37 | # --------------------- 38 | # MERGED 39 | # 40 | # Note we need to handle filename contains spaces, also note vim '+' command 41 | # treats double quotes as comments so we use single ('\'' denotes a single 42 | # quote in shell) 43 | # 44 | git config --global mergetool.vi.cmd \ 45 | 'vimdiff -M "$LOCAL" "$BASE" "$REMOTE" '\''+botright diffsplit '\''"$MERGED" "+set modifiable write"' 46 | 47 | git config --global push.default simple 48 | 49 | # Leave user.name as per repo setting 50 | # Leave user.email as per repo setting 51 | -------------------------------------------------------------------------------- /git/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | $SELF_DIR/gitconfig.sh 9 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Install dotfiles into $HOME 3 | # 4 | 5 | function get_all_components 6 | { 7 | /bin/ls -1d */install.sh 2>/dev/null | sed 's|/install\.sh$||' 8 | } 9 | 10 | function usage 11 | { 12 | echo "Usage: $0 [component]" 13 | echo "List of components:" $(get_all_components) 14 | } 15 | 16 | function install_component 17 | { 18 | local component=${1:?} 19 | 20 | echo "Installing component '$component' ..." 21 | 22 | [[ -d $component ]] || { 23 | echo "Component dir $component does not exist" >&2 24 | return 1 25 | } 26 | [[ -x $component/install.sh ]] || { 27 | echo "Installer for $component is not implemented yet, skipping" >&2 28 | return 0 29 | } 30 | 31 | (cd $component && ./install.sh) 32 | } 33 | 34 | function main 35 | { 36 | local components 37 | local component 38 | 39 | if [[ ${1:-} == "-h" ]] || [[ ${1:-} == "--help" ]]; then 40 | usage 41 | return 0 42 | fi 43 | 44 | components=${@:-$(get_all_components)} 45 | 46 | for component in $components; do 47 | install_component $component 48 | done 49 | } 50 | 51 | main "$@" 52 | -------------------------------------------------------------------------------- /karabiner/README.md: -------------------------------------------------------------------------------- 1 | # Karabiner Config 2 | 3 | This is my personal [Karabiner](//github.com/tekezo/Karabiner-Elements) 4 | configuration, which maps Caps lock to F13 (Shift-F1) as tmux prefix, as well 5 | as other very personal stuff. 6 | 7 | NOTE: Disable Caps Lock (System Preferences > Keyboard > Modifier Keys...) 8 | as suggested by Karabiner. 9 | -------------------------------------------------------------------------------- /karabiner/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | if [[ $(uname -s) == Darwin ]]; then 9 | mkdir -p ~/.config/karabiner 10 | cp karabiner.json ~/.config/karabiner/karabiner.json 11 | fi 12 | -------------------------------------------------------------------------------- /karabiner/karabiner.json: -------------------------------------------------------------------------------- 1 | { 2 | "global": { 3 | "check_for_updates_on_startup": true, 4 | "show_in_menu_bar": true, 5 | "show_profile_name_in_menu_bar": true 6 | }, 7 | "profiles": [ 8 | { 9 | "complex_modifications": { 10 | "parameters": { 11 | "basic.simultaneous_threshold_milliseconds": 50, 12 | "basic.to_delayed_action_delay_milliseconds": 500, 13 | "basic.to_if_alone_timeout_milliseconds": 1000, 14 | "basic.to_if_held_down_threshold_milliseconds": 500 15 | }, 16 | "rules": [] 17 | }, 18 | "devices": [ 19 | { 20 | "disable_built_in_keyboard_if_exists": false, 21 | "fn_function_keys": [], 22 | "identifiers": { 23 | "is_keyboard": true, 24 | "is_pointing_device": false, 25 | "product_id": 597, 26 | "vendor_id": 1452 27 | }, 28 | "ignore": true, 29 | "manipulate_caps_lock_led": true, 30 | "simple_modifications": [] 31 | }, 32 | { 33 | "disable_built_in_keyboard_if_exists": false, 34 | "fn_function_keys": [], 35 | "identifiers": { 36 | "is_keyboard": true, 37 | "is_pointing_device": false, 38 | "product_id": 628, 39 | "vendor_id": 1452 40 | }, 41 | "ignore": false, 42 | "manipulate_caps_lock_led": true, 43 | "simple_modifications": [ 44 | { 45 | "from": { 46 | "key_code": "right_command" 47 | }, 48 | "to": { 49 | "key_code": "page_up" 50 | } 51 | }, 52 | { 53 | "from": { 54 | "key_code": "right_option" 55 | }, 56 | "to": { 57 | "key_code": "page_down" 58 | } 59 | }, 60 | { 61 | "from": { 62 | "key_code": "right_shift" 63 | }, 64 | "to": { 65 | "consumer_key_code": "play_or_pause" 66 | } 67 | } 68 | ] 69 | }, 70 | { 71 | "disable_built_in_keyboard_if_exists": false, 72 | "fn_function_keys": [ 73 | { 74 | "from": { 75 | "key_code": "f3" 76 | }, 77 | "to": { 78 | "key_code": "mission_control" 79 | } 80 | }, 81 | { 82 | "from": { 83 | "key_code": "f4" 84 | }, 85 | "to": { 86 | "key_code": "launchpad" 87 | } 88 | }, 89 | { 90 | "from": { 91 | "key_code": "f7" 92 | }, 93 | "to": { 94 | "consumer_key_code": "rewind" 95 | } 96 | }, 97 | { 98 | "from": { 99 | "key_code": "f8" 100 | }, 101 | "to": { 102 | "consumer_key_code": "play_or_pause" 103 | } 104 | }, 105 | { 106 | "from": { 107 | "key_code": "f9" 108 | }, 109 | "to": { 110 | "consumer_key_code": "fastforward" 111 | } 112 | }, 113 | { 114 | "from": { 115 | "key_code": "f10" 116 | }, 117 | "to": { 118 | "consumer_key_code": "mute" 119 | } 120 | }, 121 | { 122 | "from": { 123 | "key_code": "f11" 124 | }, 125 | "to": { 126 | "consumer_key_code": "volume_decrement" 127 | } 128 | }, 129 | { 130 | "from": { 131 | "key_code": "f12" 132 | }, 133 | "to": { 134 | "consumer_key_code": "volume_increment" 135 | } 136 | } 137 | ], 138 | "identifiers": { 139 | "is_keyboard": true, 140 | "is_pointing_device": false, 141 | "product_id": 34050, 142 | "vendor_id": 2652 143 | }, 144 | "ignore": false, 145 | "manipulate_caps_lock_led": false, 146 | "simple_modifications": [ 147 | { 148 | "from": { 149 | "key_code": "application" 150 | }, 151 | "to": { 152 | "consumer_key_code": "fastforward" 153 | } 154 | }, 155 | { 156 | "from": { 157 | "key_code": "delete_forward" 158 | }, 159 | "to": { 160 | "key_code": "page_down" 161 | } 162 | }, 163 | { 164 | "from": { 165 | "key_code": "left_command" 166 | }, 167 | "to": { 168 | "key_code": "left_option" 169 | } 170 | }, 171 | { 172 | "from": { 173 | "key_code": "left_option" 174 | }, 175 | "to": { 176 | "key_code": "left_command" 177 | } 178 | }, 179 | { 180 | "from": { 181 | "key_code": "right_option" 182 | }, 183 | "to": { 184 | "consumer_key_code": "play_or_pause" 185 | } 186 | }, 187 | { 188 | "from": { 189 | "key_code": "right_shift" 190 | }, 191 | "to": { 192 | "key_code": "page_up" 193 | } 194 | } 195 | ] 196 | } 197 | ], 198 | "fn_function_keys": [ 199 | { 200 | "from": { 201 | "key_code": "f1" 202 | }, 203 | "to": { 204 | "key_code": "f1" 205 | } 206 | }, 207 | { 208 | "from": { 209 | "key_code": "f2" 210 | }, 211 | "to": { 212 | "key_code": "f2" 213 | } 214 | }, 215 | { 216 | "from": { 217 | "key_code": "f3" 218 | }, 219 | "to": { 220 | "key_code": "f3" 221 | } 222 | }, 223 | { 224 | "from": { 225 | "key_code": "f4" 226 | }, 227 | "to": { 228 | "key_code": "f4" 229 | } 230 | }, 231 | { 232 | "from": { 233 | "key_code": "f5" 234 | }, 235 | "to": { 236 | "key_code": "f5" 237 | } 238 | }, 239 | { 240 | "from": { 241 | "key_code": "f6" 242 | }, 243 | "to": { 244 | "key_code": "f6" 245 | } 246 | }, 247 | { 248 | "from": { 249 | "key_code": "f7" 250 | }, 251 | "to": { 252 | "key_code": "f7" 253 | } 254 | }, 255 | { 256 | "from": { 257 | "key_code": "f8" 258 | }, 259 | "to": { 260 | "key_code": "f8" 261 | } 262 | }, 263 | { 264 | "from": { 265 | "key_code": "f9" 266 | }, 267 | "to": { 268 | "key_code": "f9" 269 | } 270 | }, 271 | { 272 | "from": { 273 | "key_code": "f10" 274 | }, 275 | "to": { 276 | "key_code": "f10" 277 | } 278 | }, 279 | { 280 | "from": { 281 | "key_code": "f11" 282 | }, 283 | "to": { 284 | "key_code": "f11" 285 | } 286 | }, 287 | { 288 | "from": { 289 | "key_code": "f12" 290 | }, 291 | "to": { 292 | "key_code": "f12" 293 | } 294 | } 295 | ], 296 | "name": "♡", 297 | "selected": true, 298 | "simple_modifications": [ 299 | { 300 | "from": { 301 | "key_code": "caps_lock" 302 | }, 303 | "to": { 304 | "key_code": "f13" 305 | } 306 | }, 307 | { 308 | "from": { 309 | "key_code": "f1" 310 | }, 311 | "to": { 312 | "consumer_key_code": "display_brightness_decrement" 313 | } 314 | }, 315 | { 316 | "from": { 317 | "key_code": "f2" 318 | }, 319 | "to": { 320 | "consumer_key_code": "display_brightness_increment" 321 | } 322 | }, 323 | { 324 | "from": { 325 | "key_code": "f3" 326 | }, 327 | "to": { 328 | "key_code": "mission_control" 329 | } 330 | }, 331 | { 332 | "from": { 333 | "key_code": "f4" 334 | }, 335 | "to": { 336 | "key_code": "launchpad" 337 | } 338 | }, 339 | { 340 | "from": { 341 | "key_code": "f5" 342 | }, 343 | "to": { 344 | "key_code": "illumination_decrement" 345 | } 346 | }, 347 | { 348 | "from": { 349 | "key_code": "f6" 350 | }, 351 | "to": { 352 | "key_code": "illumination_increment" 353 | } 354 | }, 355 | { 356 | "from": { 357 | "key_code": "f7" 358 | }, 359 | "to": { 360 | "consumer_key_code": "rewind" 361 | } 362 | }, 363 | { 364 | "from": { 365 | "key_code": "f8" 366 | }, 367 | "to": { 368 | "consumer_key_code": "play_or_pause" 369 | } 370 | }, 371 | { 372 | "from": { 373 | "key_code": "f9" 374 | }, 375 | "to": { 376 | "consumer_key_code": "fastforward" 377 | } 378 | }, 379 | { 380 | "from": { 381 | "key_code": "f10" 382 | }, 383 | "to": { 384 | "consumer_key_code": "mute" 385 | } 386 | }, 387 | { 388 | "from": { 389 | "key_code": "f11" 390 | }, 391 | "to": { 392 | "consumer_key_code": "volume_decrement" 393 | } 394 | }, 395 | { 396 | "from": { 397 | "key_code": "f12" 398 | }, 399 | "to": { 400 | "consumer_key_code": "volume_increment" 401 | } 402 | } 403 | ], 404 | "virtual_hid_keyboard": { 405 | "caps_lock_delay_milliseconds": 0, 406 | "keyboard_type": "ansi" 407 | } 408 | } 409 | ] 410 | } 411 | -------------------------------------------------------------------------------- /mac-defaults/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | [[ $(uname -s) == Darwin ]] || { 9 | echo "Skipped (not on Mac OS X)" 10 | exit 0 11 | } 12 | 13 | # Show "Quit Finder" Menu Item 14 | defaults write com.apple.finder QuitMenuItem -bool true && killall Finder 15 | 16 | # Show Full Path in Finder Title 17 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 18 | 19 | # Show path bar 20 | defaults write com.apple.finder ShowPathbar -bool true 21 | 22 | # Show status bar 23 | defaults write com.apple.finder ShowStatusBar -bool true 24 | 25 | # Show All File Extensions 26 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 27 | 28 | # Use Plain Text Mode as Default 29 | defaults write com.apple.TextEdit RichText -int 0 30 | -------------------------------------------------------------------------------- /mutt/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | rsync $SELF_DIR/muttrc ~/.muttrc 9 | -------------------------------------------------------------------------------- /mutt/muttrc: -------------------------------------------------------------------------------- 1 | # User information 2 | set realname = "FIXME" 3 | set from = FIXME 4 | 5 | # OS Stuff 6 | set tmpdir = /tmp 7 | set print_split = yes 8 | #set print_command = "a2ps -1 -o - | lpr" # Default (override in per-host file) 9 | 10 | # IMAP 11 | set mail_check = 60 12 | set timeout = 15 13 | set imap_list_subscribed = yes 14 | set imap_user = FIXME 15 | set imap_passive = no 16 | set folder = imaps://FIXME.example.com/ 17 | set spoolfile = imaps://FIXME.example.com/ 18 | set header_cache = ~/.mutt/cache/headers 19 | set message_cachedir = ~/.mutt/cache 20 | set imap_keepalive = 300 21 | set mail_check = 120 22 | 23 | set smtp_url = smtp://FIXME.example.com 24 | 25 | # XXX: not supported by default 26 | # set sidebar_visible = no 27 | # set sidebar_width = 25 28 | # set sidebar_delim = ' | ' 29 | # set sidebar_sort = no 30 | 31 | # Index Menu 32 | set sort=threads 33 | set sort_aux = date 34 | set strict_threads = no 35 | set wrap_search = yes 36 | set mark_old = no # Do not mark unread new messages as 'old' 37 | set collapse_unread = no # Do not let me collapse threads with unread msgs 38 | set uncollapse_jump = yes # When uncollapsing, jump to new msgs 39 | set index_format="%4C %Z %{%b %d} %-15.15n (%4l) %s" 40 | 41 | # Message Display Options 42 | set smart_wrap = yes # Wrap at word boundaries if possible 43 | set pager_index_lines = 25 # Show a few lines from the index above the msg 44 | set pager_stop = yes # PgDown at bottom does not move to next message 45 | set markers = no # Don't add "+" on wrapped lines (hard to copy) 46 | 47 | # Composing 48 | #set signature = "~/.signature" 49 | set editor = 'vim +/^$ "+normal j"' # Open vim one line past first blank line 50 | set fast_reply = yes 51 | set abort_nosubject = no 52 | set abort_unmodified = ask-yes 53 | 54 | # Replying 55 | set reply_self = no # Reply to recipients, not to myself on my own msgs 56 | set indent_string = "> " 57 | set include = yes 58 | set attribution = "On %d, %n wrote:" 59 | set bounce_delivered = yes 60 | 61 | # Forwarding 62 | set forward_format = "Fw: %s" 63 | set forward_quote = yes 64 | 65 | # Folder and Mailbox 66 | set copy = yes # Save copy of outgoing msgs 67 | set record = =Sent # Where do we keep sent messages? 68 | set move = no 69 | set fcc_attach = yes # Save outgoing attachments 70 | set fcc_clear = no # Keep encryption/signatures 71 | set folder_format="%F %-8.8u %-8.8g %d %8s %N %f" 72 | 73 | # Headers 74 | set hdrs = yes # ??? 75 | set header = yes # Headers in reply 76 | set edit_headers = yes # Headers in editor 77 | 78 | # Sending 79 | #set write_bcc = yes 80 | set use_from = yes 81 | set envelope_from = yes 82 | 83 | # Key bindings 84 | bind generic gg first-entry 85 | bind generic G last-entry 86 | bind generic \Cf next-page 87 | bind generic \Cb previous-page 88 | bind index \Cf next-page 89 | bind index \Cb previous-page 90 | bind index [ previous-thread 91 | bind index ] next-thread 92 | bind index gg first-entry 93 | bind index G last-entry 94 | bind index $ sync-mailbox 95 | bind index \Cr imap-fetch-mail 96 | bind index collapse-thread 97 | bind index display-message 98 | macro index "c?\t" "Get Folder List" 99 | macro index I "c!\n" "Go to INBOX" 100 | macro index \\ ":set sidebar_visible=no\n" "Close sidebar" 101 | macro index | ":set sidebar_visible=yes\n" "Open sidebar" 102 | 103 | # Which boxes are checked for new mail? Can be overriden in host-specific 104 | # config file. 105 | # 106 | mailboxes =INBOX 107 | mailboxes =00-meetings 108 | mailboxes =00-to-me 109 | mailboxes =FIXME 110 | mailboxes =Drafts 111 | mailboxes =Outbox 112 | mailboxes =Trash 113 | 114 | 115 | # autoview HTML mail using lynx -dump 116 | auto_view text/html 117 | alternative_order text/enriched text/plain text/html 118 | 119 | # Headers 120 | ignore * 121 | unignore From To Cc Subject Date Reply-To Newsgroups: 122 | unignore Organization Organisation 123 | unignore X-Mailer User-Agent X-Agent X-Newsreader 124 | unignore X-Bogosity X-Spam-Status 125 | hdr_order From: To: Cc: Date: Subject: 126 | 127 | # Colors 128 | color index yellow default "~N" 129 | color index red default "~T" 130 | color index cyan default "~v" 131 | -------------------------------------------------------------------------------- /mycalsh.yml: -------------------------------------------------------------------------------- 1 | mixed-port: 7890 2 | allow-lan: true 3 | bind-address: '*' 4 | mode: rule 5 | log-level: info 6 | external-controller: '127.0.0.1:9090' 7 | dns: 8 | enable: true 9 | ipv6: false 10 | default-nameserver: [223.5.5.5, 119.29.29.29] 11 | enhanced-mode: fake-ip 12 | fake-ip-range: 198.18.0.1/16 13 | use-hosts: true 14 | nameserver: ['https://doh.pub/dns-query', 'https://dns.alidns.com/dns-query'] 15 | fallback: ['https://doh.dns.sb/dns-query', 'https://dns.cloudflare.com/dns-query', 'https://dns.twnic.tw/dns-query', 'tls://8.8.4.4:853'] 16 | fallback-filter: { geoip: true, ipcidr: [240.0.0.0/4, 0.0.0.0/32] } 17 | proxies: 18 | - { name: '永久地址:lanhai.app', type: trojan, server: hkw.lanhaijiasu.top, port: 40835, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hkw.lanhai777.com, skip-cert-verify: true } 19 | - { name: 香港01|V1线路|1.5X, type: trojan, server: hk1.lanhaijiasu.top, port: 24233, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: xhk1.lanhai777.com, skip-cert-verify: true } 20 | - { name: 香港02|V2线路|1.5X, type: trojan, server: hk6.lanhaijiasu.top, port: 38300, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hk2.lanhai777.com, skip-cert-verify: true } 21 | - { name: 香港03|V3线路|1.5X, type: trojan, server: xhk3.lanhaijiasu.top, port: 39653, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hk1.lanhai777.com, skip-cert-verify: true } 22 | - { name: 香港06|解锁流媒体|1.5X, type: trojan, server: hk1.lanhaijiasu.top, port: 19087, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hgc.lanhai777.com, skip-cert-verify: true } 23 | - { name: 香港07|解锁流媒体|1.5X, type: trojan, server: hk6.lanhaijiasu.top, port: 41662, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hgc.lanhai777.com, skip-cert-verify: true } 24 | - { name: 香港08|解锁流媒体|1.5X, type: trojan, server: hk3.lanhaijiasu.top, port: 21675, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hgc.lanhai777.com, skip-cert-verify: true } 25 | - { name: 台湾01|解锁流媒体|1.5X, type: trojan, server: xtw1.lanhaijiasu.top, port: 43827, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tw1.lanhai777.com, skip-cert-verify: true } 26 | - { name: 台湾02|解锁流媒体|1.5X, type: trojan, server: xtw2.lanhaijiasu.top, port: 25315, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tw1.lanhai777.com, skip-cert-verify: true } 27 | - { name: 台湾03|解锁流媒体|1.5X, type: trojan, server: xtw3.lanhaijiasu.top, port: 10086, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tw1.lanhai777.com, skip-cert-verify: true } 28 | - { name: 韩国01|V1线路|1.5X, type: trojan, server: hg1.lanhaijiasu.top, port: 58277, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hg1.lanhai777.com, skip-cert-verify: true } 29 | - { name: 韩国02|V2线路|1.5X, type: trojan, server: hg2.lanhaijiasu.top, port: 32489, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hg1.lanhai777.com, skip-cert-verify: true } 30 | - { name: 韩国03|V3线路|1.5X, type: trojan, server: hg3.lanhaijiasu.top, port: 25902, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: hg1.lanhai777.com, skip-cert-verify: true } 31 | - { name: 日本01|V1线路|1.5X, type: trojan, server: jp1.lanhaijiasu.top, port: 59811, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jp1.lanhai777.com, skip-cert-verify: true } 32 | - { name: 日本02|V2线路|1.5X, type: trojan, server: jp2.lanhaijiasu.top, port: 37556, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jp3.lanhai777.com, skip-cert-verify: true } 33 | - { name: 日本03|V3线路|1.5X, type: trojan, server: jp3.lanhaijiasu.top, port: 27660, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jp3.lanhai777.com, skip-cert-verify: true } 34 | - { name: 日本05|解锁流媒体|1.5X, type: trojan, server: jp1.lanhaijiasu.top, port: 60673, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jp2.lanhai777.com, skip-cert-verify: true } 35 | - { name: 日本06|解锁流媒体|1.5X, type: trojan, server: jp2.lanhaijiasu.top, port: 37373, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jp2.lanhai777.com, skip-cert-verify: true } 36 | - { name: 日本07|解锁流媒体|1.5X, type: trojan, server: jp3.lanhaijiasu.top, port: 21857, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jp2.lanhai777.com, skip-cert-verify: true } 37 | - { name: 新加坡01|V1线路|1.5X, type: trojan, server: sg1.lanhaijiasu.top, port: 34633, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: sg1.lanhaijiasu.xyz, skip-cert-verify: true } 38 | - { name: 新加坡02|V2线路|1.5X, type: trojan, server: sg2.lanhaijiasu.top, port: 14579, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: sg1.lanhaijiasu.xyz, skip-cert-verify: true } 39 | - { name: 新加坡03|V3线路|1.5X, type: trojan, server: sg3.lanhaijiasu.top, port: 29829, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: sg1.lanhaijiasu.xyz, skip-cert-verify: true } 40 | - { name: 新加坡05|解锁流媒体|1.5X, type: trojan, server: sg1.lanhaijiasu.top, port: 60743, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: sg2.lanhai777.com, skip-cert-verify: true } 41 | - { name: 新加坡06|解锁流媒体|1.5X, type: trojan, server: sg2.lanhaijiasu.top, port: 24457, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: sg2.lanhai777.com, skip-cert-verify: true } 42 | - { name: 新加坡07|解锁流媒体|1.5X, type: trojan, server: sg3.lanhaijiasu.top, port: 18963, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: sg2.lanhai777.com, skip-cert-verify: true } 43 | - { name: 美国01|V1线路|1.5X, type: trojan, server: xus1.lanhaijiasu.top, port: 45424, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: us1.lanhai777.com, skip-cert-verify: true } 44 | - { name: 美国02|V2线路|1.5X, type: trojan, server: us2.lanhaijiasu.top, port: 52348, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: us2.lanhai777.com, skip-cert-verify: true } 45 | - { name: 美国03|V3线路|1.5X, type: trojan, server: us3.lanhaijiasu.top, port: 30576, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: us3.lanhai777.com, skip-cert-verify: true } 46 | - { name: 美国05|解锁流媒体|1.5X, type: trojan, server: xus1.lanhaijiasu.top, port: 57936, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: us5.lanhai777.com, skip-cert-verify: true } 47 | - { name: 美国06|解锁流媒体|1.5X, type: trojan, server: us2.lanhaijiasu.top, port: 17242, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: us5.lanhai777.com, skip-cert-verify: true } 48 | - { name: 美国07|解锁流媒体|1.5X, type: trojan, server: us3.lanhaijiasu.top, port: 42189, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: us5.lanhai777.com, skip-cert-verify: true } 49 | - { name: 加拿大01|V1线路|1.5X, type: trojan, server: ca1.lanhaijiasu.top, port: 52003, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ca1.lanhaijiasu.xyz, skip-cert-verify: true } 50 | - { name: 加拿大02|V2线路|1.5X, type: trojan, server: ca2.lanhaijiasu.top, port: 33472, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ca1.lanhaijiasu.xyz, skip-cert-verify: true } 51 | - { name: 加拿大03|V3线路|1.5X, type: trojan, server: ca3.lanhaijiasu.top, port: 54102, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ca1.lanhaijiasu.xyz, skip-cert-verify: true } 52 | - { name: 澳大利亚01|V1线路|1.5X, type: trojan, server: au1.lanhaijiasu.top, port: 55417, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: au1.lanhai777.com, skip-cert-verify: true } 53 | - { name: 澳大利亚02|V2线路|1.5X, type: trojan, server: au2.lanhaijiasu.top, port: 11034, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: au1.lanhai777.com, skip-cert-verify: true } 54 | - { name: 澳大利亚03|V3线路|1.5X, type: trojan, server: au3.lanhaijiasu.top, port: 40747, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: au1.lanhai777.com, skip-cert-verify: true } 55 | - { name: 英国01|V1线路|1.5X, type: trojan, server: uk1.lanhaijiasu.top, port: 13885, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: uk1.lanhaijiasu.xyz, skip-cert-verify: true } 56 | - { name: 英国02|V2线路|1.5X, type: trojan, server: uk2.lanhaijiasu.top, port: 11804, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: uk1.lanhaijiasu.xyz, skip-cert-verify: true } 57 | - { name: 英国03|V3线路|1.5X, type: trojan, server: uk3.lanhaijiasu.top, port: 47991, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: uk1.lanhaijiasu.xyz, skip-cert-verify: true } 58 | - { name: 意大利01|V1线路|1.5X, type: trojan, server: it1.lanhaijiasu.top, port: 39294, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: it1.lanhaijiasu.xyz, skip-cert-verify: true } 59 | - { name: 意大利02|V2线路|1.5X, type: trojan, server: it2.lanhaijiasu.top, port: 27558, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: it1.lanhaijiasu.xyz, skip-cert-verify: true } 60 | - { name: 俄罗斯01|V1线路|1.5X, type: trojan, server: ru1.lanhaijiasu.top, port: 37001, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ru1.lanhaijiasu.xyz, skip-cert-verify: true } 61 | - { name: 俄罗斯02|V2线路|1.5X, type: trojan, server: ru2.lanhaijiasu.top, port: 34541, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ru1.lanhaijiasu.xyz, skip-cert-verify: true } 62 | - { name: 俄罗斯03|V3线路|1.5X, type: trojan, server: ru3.lanhaijiasu.top, port: 40881, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ru1.lanhaijiasu.xyz, skip-cert-verify: true } 63 | - { name: 泰国01|V1线路|1.5X, type: trojan, server: tg1.lanhaijiasu.top, port: 63800, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tg1.lanhaijiasu.xyz, skip-cert-verify: true } 64 | - { name: 泰国02|V2线路|1.5X, type: trojan, server: tg2.lanhaijiasu.top, port: 22204, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tg1.lanhaijiasu.xyz, skip-cert-verify: true } 65 | - { name: 泰国03|V3线路|1.5X, type: trojan, server: tg3.lanhaijiasu.top, port: 21498, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tg1.lanhaijiasu.xyz, skip-cert-verify: true } 66 | - { name: 沙特01|V1线路|1.5X, type: trojan, server: tg1.lanhaijiasu.top, port: 47845, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: st1.lanhai777.com, skip-cert-verify: true } 67 | - { name: 沙特02|V2线路|1.5X, type: trojan, server: tg2.lanhaijiasu.top, port: 45154, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: st1.lanhai777.com, skip-cert-verify: true } 68 | - { name: 沙特03|V3线路|1.5X, type: trojan, server: tg3.lanhaijiasu.top, port: 57895, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: st1.lanhai777.com, skip-cert-verify: true } 69 | - { name: 越南01|V1线路|1.5X, type: trojan, server: yn1.lanhaijiasu.top, port: 14435, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: yn1.lanhaijiasu.xyz, skip-cert-verify: true } 70 | - { name: 越南02|V2线路|1.5X, type: trojan, server: yn2.lanhaijiasu.top, port: 22990, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: yn1.lanhaijiasu.xyz, skip-cert-verify: true } 71 | - { name: 越南03|V3线路|1.5X, type: trojan, server: yn3.lanhaijiasu.top, port: 12433, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: yn1.lanhaijiasu.xyz, skip-cert-verify: true } 72 | - { name: 印尼01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 58116, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: in1.lanhai777.com, skip-cert-verify: true } 73 | - { name: 印尼02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 59164, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: in1.lanhai777.com, skip-cert-verify: true } 74 | - { name: 印尼03|V3线路|1.5X, type: trojan, server: fb3.lanhaijiasu.top, port: 48587, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: in1.lanhai777.com, skip-cert-verify: true } 75 | - { name: 印度01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 18303, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: yd.lanhai777.com, skip-cert-verify: true } 76 | - { name: 印度02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 52979, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: yd.lanhai777.com, skip-cert-verify: true } 77 | - { name: 印度03|V3线路|1.5X, type: trojan, server: fb3.lanhaijiasu.top, port: 32372, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: yd.lanhai777.com, skip-cert-verify: true } 78 | - { name: 马来西亚01|解锁流媒体|1.5X, type: trojan, server: ml1.lanhaijiasu.top, port: 28226, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ml1.lanhaijiasu.xyz, skip-cert-verify: true } 79 | - { name: 马来西亚02|解锁流媒体|1.5X, type: trojan, server: ml2.lanhaijiasu.top, port: 17112, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ml1.lanhaijiasu.xyz, skip-cert-verify: true } 80 | - { name: 马来西亚03|解锁流媒体|1.5X, type: trojan, server: ml3.lanhaijiasu.top, port: 62927, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ml1.lanhaijiasu.xyz, skip-cert-verify: true } 81 | - { name: 柬埔寨01|V1线路|1.5X, type: trojan, server: jpz1.lanhaijiasu.top, port: 26424, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jpz1.lanhaijiasu.xyz, skip-cert-verify: true } 82 | - { name: 柬埔寨02|V2线路|1.5X, type: trojan, server: jpz2.lanhaijiasu.top, port: 50106, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jpz1.lanhaijiasu.xyz, skip-cert-verify: true } 83 | - { name: 柬埔寨03|V3线路|1.5X, type: trojan, server: jpz3.lanhaijiasu.top, port: 16945, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: jpz1.lanhaijiasu.xyz, skip-cert-verify: true } 84 | - { name: 菲律宾01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 14221, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: fb1.lanhaijiasu.xyz, skip-cert-verify: true } 85 | - { name: 菲律宾02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 18085, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: fb1.lanhaijiasu.xyz, skip-cert-verify: true } 86 | - { name: 菲律宾03|V3线路|1.5X, type: trojan, server: fb3.lanhaijiasu.top, port: 13036, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: fb1.lanhaijiasu.xyz, skip-cert-verify: true } 87 | - { name: 土耳其01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 46195, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tr.lanhai777.com, skip-cert-verify: true } 88 | - { name: 土耳其02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 16065, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: tr.lanhai777.com, skip-cert-verify: true } 89 | - { name: 巴西01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 51482, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: bx.lanhai777.com, skip-cert-verify: true } 90 | - { name: 巴西02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 43294, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: bx.lanhai777.com, skip-cert-verify: true } 91 | - { name: 德国01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 10614, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: dg.lanhai777.com, skip-cert-verify: true } 92 | - { name: 德国02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 23674, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: dg.lanhai777.com, skip-cert-verify: true } 93 | - { name: 法国01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 13580, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: fg.lanhai777.com, skip-cert-verify: true } 94 | - { name: 法国02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 28419, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: fg.lanhai777.com, skip-cert-verify: true } 95 | - { name: 阿根廷01|V1线路|1.5X, type: trojan, server: fb1.lanhaijiasu.top, port: 26139, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ar.lanhai777.com, skip-cert-verify: true } 96 | - { name: 阿根廷02|V2线路|1.5X, type: trojan, server: fb2.lanhaijiasu.top, port: 20036, password: d59f3822-7888-4181-a841-fc2c357c8943, udp: true, sni: ar.lanhai777.com, skip-cert-verify: true } 97 | proxy-groups: 98 | - { name: 蓝海加速, type: select, proxies: [自动选择, 故障转移, '永久地址:lanhai.app', 香港01|V1线路|1.5X, 香港02|V2线路|1.5X, 香港03|V3线路|1.5X, 香港06|解锁流媒体|1.5X, 香港07|解锁流媒体|1.5X, 香港08|解锁流媒体|1.5X, 台湾01|解锁流媒体|1.5X, 台湾02|解锁流媒体|1.5X, 台湾03|解锁流媒体|1.5X, 韩国01|V1线路|1.5X, 韩国02|V2线路|1.5X, 韩国03|V3线路|1.5X, 日本01|V1线路|1.5X, 日本02|V2线路|1.5X, 日本03|V3线路|1.5X, 日本05|解锁流媒体|1.5X, 日本06|解锁流媒体|1.5X, 日本07|解锁流媒体|1.5X, 新加坡01|V1线路|1.5X, 新加坡02|V2线路|1.5X, 新加坡03|V3线路|1.5X, 新加坡05|解锁流媒体|1.5X, 新加坡06|解锁流媒体|1.5X, 新加坡07|解锁流媒体|1.5X, 美国01|V1线路|1.5X, 美国02|V2线路|1.5X, 美国03|V3线路|1.5X, 美国05|解锁流媒体|1.5X, 美国06|解锁流媒体|1.5X, 美国07|解锁流媒体|1.5X, 加拿大01|V1线路|1.5X, 加拿大02|V2线路|1.5X, 加拿大03|V3线路|1.5X, 澳大利亚01|V1线路|1.5X, 澳大利亚02|V2线路|1.5X, 澳大利亚03|V3线路|1.5X, 英国01|V1线路|1.5X, 英国02|V2线路|1.5X, 英国03|V3线路|1.5X, 意大利01|V1线路|1.5X, 意大利02|V2线路|1.5X, 俄罗斯01|V1线路|1.5X, 俄罗斯02|V2线路|1.5X, 俄罗斯03|V3线路|1.5X, 泰国01|V1线路|1.5X, 泰国02|V2线路|1.5X, 泰国03|V3线路|1.5X, 沙特01|V1线路|1.5X, 沙特02|V2线路|1.5X, 沙特03|V3线路|1.5X, 越南01|V1线路|1.5X, 越南02|V2线路|1.5X, 越南03|V3线路|1.5X, 印尼01|V1线路|1.5X, 印尼02|V2线路|1.5X, 印尼03|V3线路|1.5X, 印度01|V1线路|1.5X, 印度02|V2线路|1.5X, 印度03|V3线路|1.5X, 马来西亚01|解锁流媒体|1.5X, 马来西亚02|解锁流媒体|1.5X, 马来西亚03|解锁流媒体|1.5X, 柬埔寨01|V1线路|1.5X, 柬埔寨02|V2线路|1.5X, 柬埔寨03|V3线路|1.5X, 菲律宾01|V1线路|1.5X, 菲律宾02|V2线路|1.5X, 菲律宾03|V3线路|1.5X, 土耳其01|V1线路|1.5X, 土耳其02|V2线路|1.5X, 巴西01|V1线路|1.5X, 巴西02|V2线路|1.5X, 德国01|V1线路|1.5X, 德国02|V2线路|1.5X, 法国01|V1线路|1.5X, 法国02|V2线路|1.5X, 阿根廷01|V1线路|1.5X, 阿根廷02|V2线路|1.5X] } 99 | - { name: 自动选择, type: url-test, proxies: ['永久地址:lanhai.app', 香港01|V1线路|1.5X, 香港02|V2线路|1.5X, 香港03|V3线路|1.5X, 香港06|解锁流媒体|1.5X, 香港07|解锁流媒体|1.5X, 香港08|解锁流媒体|1.5X, 台湾01|解锁流媒体|1.5X, 台湾02|解锁流媒体|1.5X, 台湾03|解锁流媒体|1.5X, 韩国01|V1线路|1.5X, 韩国02|V2线路|1.5X, 韩国03|V3线路|1.5X, 日本01|V1线路|1.5X, 日本02|V2线路|1.5X, 日本03|V3线路|1.5X, 日本05|解锁流媒体|1.5X, 日本06|解锁流媒体|1.5X, 日本07|解锁流媒体|1.5X, 新加坡01|V1线路|1.5X, 新加坡02|V2线路|1.5X, 新加坡03|V3线路|1.5X, 新加坡05|解锁流媒体|1.5X, 新加坡06|解锁流媒体|1.5X, 新加坡07|解锁流媒体|1.5X, 美国01|V1线路|1.5X, 美国02|V2线路|1.5X, 美国03|V3线路|1.5X, 美国05|解锁流媒体|1.5X, 美国06|解锁流媒体|1.5X, 美国07|解锁流媒体|1.5X, 加拿大01|V1线路|1.5X, 加拿大02|V2线路|1.5X, 加拿大03|V3线路|1.5X, 澳大利亚01|V1线路|1.5X, 澳大利亚02|V2线路|1.5X, 澳大利亚03|V3线路|1.5X, 英国01|V1线路|1.5X, 英国02|V2线路|1.5X, 英国03|V3线路|1.5X, 意大利01|V1线路|1.5X, 意大利02|V2线路|1.5X, 俄罗斯01|V1线路|1.5X, 俄罗斯02|V2线路|1.5X, 俄罗斯03|V3线路|1.5X, 泰国01|V1线路|1.5X, 泰国02|V2线路|1.5X, 泰国03|V3线路|1.5X, 沙特01|V1线路|1.5X, 沙特02|V2线路|1.5X, 沙特03|V3线路|1.5X, 越南01|V1线路|1.5X, 越南02|V2线路|1.5X, 越南03|V3线路|1.5X, 印尼01|V1线路|1.5X, 印尼02|V2线路|1.5X, 印尼03|V3线路|1.5X, 印度01|V1线路|1.5X, 印度02|V2线路|1.5X, 印度03|V3线路|1.5X, 马来西亚01|解锁流媒体|1.5X, 马来西亚02|解锁流媒体|1.5X, 马来西亚03|解锁流媒体|1.5X, 柬埔寨01|V1线路|1.5X, 柬埔寨02|V2线路|1.5X, 柬埔寨03|V3线路|1.5X, 菲律宾01|V1线路|1.5X, 菲律宾02|V2线路|1.5X, 菲律宾03|V3线路|1.5X, 土耳其01|V1线路|1.5X, 土耳其02|V2线路|1.5X, 巴西01|V1线路|1.5X, 巴西02|V2线路|1.5X, 德国01|V1线路|1.5X, 德国02|V2线路|1.5X, 法国01|V1线路|1.5X, 法国02|V2线路|1.5X, 阿根廷01|V1线路|1.5X, 阿根廷02|V2线路|1.5X], url: 'http://www.gstatic.com/generate_204', interval: 86400 } 100 | - { name: 故障转移, type: fallback, proxies: ['永久地址:lanhai.app', 香港01|V1线路|1.5X, 香港02|V2线路|1.5X, 香港03|V3线路|1.5X, 香港06|解锁流媒体|1.5X, 香港07|解锁流媒体|1.5X, 香港08|解锁流媒体|1.5X, 台湾01|解锁流媒体|1.5X, 台湾02|解锁流媒体|1.5X, 台湾03|解锁流媒体|1.5X, 韩国01|V1线路|1.5X, 韩国02|V2线路|1.5X, 韩国03|V3线路|1.5X, 日本01|V1线路|1.5X, 日本02|V2线路|1.5X, 日本03|V3线路|1.5X, 日本05|解锁流媒体|1.5X, 日本06|解锁流媒体|1.5X, 日本07|解锁流媒体|1.5X, 新加坡01|V1线路|1.5X, 新加坡02|V2线路|1.5X, 新加坡03|V3线路|1.5X, 新加坡05|解锁流媒体|1.5X, 新加坡06|解锁流媒体|1.5X, 新加坡07|解锁流媒体|1.5X, 美国01|V1线路|1.5X, 美国02|V2线路|1.5X, 美国03|V3线路|1.5X, 美国05|解锁流媒体|1.5X, 美国06|解锁流媒体|1.5X, 美国07|解锁流媒体|1.5X, 加拿大01|V1线路|1.5X, 加拿大02|V2线路|1.5X, 加拿大03|V3线路|1.5X, 澳大利亚01|V1线路|1.5X, 澳大利亚02|V2线路|1.5X, 澳大利亚03|V3线路|1.5X, 英国01|V1线路|1.5X, 英国02|V2线路|1.5X, 英国03|V3线路|1.5X, 意大利01|V1线路|1.5X, 意大利02|V2线路|1.5X, 俄罗斯01|V1线路|1.5X, 俄罗斯02|V2线路|1.5X, 俄罗斯03|V3线路|1.5X, 泰国01|V1线路|1.5X, 泰国02|V2线路|1.5X, 泰国03|V3线路|1.5X, 沙特01|V1线路|1.5X, 沙特02|V2线路|1.5X, 沙特03|V3线路|1.5X, 越南01|V1线路|1.5X, 越南02|V2线路|1.5X, 越南03|V3线路|1.5X, 印尼01|V1线路|1.5X, 印尼02|V2线路|1.5X, 印尼03|V3线路|1.5X, 印度01|V1线路|1.5X, 印度02|V2线路|1.5X, 印度03|V3线路|1.5X, 马来西亚01|解锁流媒体|1.5X, 马来西亚02|解锁流媒体|1.5X, 马来西亚03|解锁流媒体|1.5X, 柬埔寨01|V1线路|1.5X, 柬埔寨02|V2线路|1.5X, 柬埔寨03|V3线路|1.5X, 菲律宾01|V1线路|1.5X, 菲律宾02|V2线路|1.5X, 菲律宾03|V3线路|1.5X, 土耳其01|V1线路|1.5X, 土耳其02|V2线路|1.5X, 巴西01|V1线路|1.5X, 巴西02|V2线路|1.5X, 德国01|V1线路|1.5X, 德国02|V2线路|1.5X, 法国01|V1线路|1.5X, 法国02|V2线路|1.5X, 阿根廷01|V1线路|1.5X, 阿根廷02|V2线路|1.5X], url: 'http://www.gstatic.com/generate_204', interval: 7200 } 101 | rules: 102 | - 'DOMAIN,lh.lanhaidingyue.com,DIRECT' 103 | - 'DOMAIN-SUFFIX,services.googleapis.cn,蓝海加速' 104 | - 'DOMAIN-SUFFIX,xn--ngstr-lra8j.com,蓝海加速' 105 | - 'DOMAIN,safebrowsing.urlsec.qq.com,DIRECT' 106 | - 'DOMAIN,safebrowsing.googleapis.com,DIRECT' 107 | - 'DOMAIN,developer.apple.com,蓝海加速' 108 | - 'DOMAIN-SUFFIX,digicert.com,蓝海加速' 109 | - 'DOMAIN,ocsp.apple.com,蓝海加速' 110 | - 'DOMAIN,ocsp.comodoca.com,蓝海加速' 111 | - 'DOMAIN,ocsp.usertrust.com,蓝海加速' 112 | - 'DOMAIN,ocsp.sectigo.com,蓝海加速' 113 | - 'DOMAIN,ocsp.verisign.net,蓝海加速' 114 | - 'DOMAIN-SUFFIX,apple-dns.net,蓝海加速' 115 | - 'DOMAIN,testflight.apple.com,蓝海加速' 116 | - 'DOMAIN,sandbox.itunes.apple.com,蓝海加速' 117 | - 'DOMAIN,itunes.apple.com,蓝海加速' 118 | - 'DOMAIN-SUFFIX,apps.apple.com,蓝海加速' 119 | - 'DOMAIN-SUFFIX,blobstore.apple.com,蓝海加速' 120 | - 'DOMAIN,cvws.icloud-content.com,蓝海加速' 121 | - 'DOMAIN-SUFFIX,mzstatic.com,DIRECT' 122 | - 'DOMAIN-SUFFIX,itunes.apple.com,DIRECT' 123 | - 'DOMAIN-SUFFIX,icloud.com,DIRECT' 124 | - 'DOMAIN-SUFFIX,icloud-content.com,DIRECT' 125 | - 'DOMAIN-SUFFIX,me.com,DIRECT' 126 | - 'DOMAIN-SUFFIX,aaplimg.com,DIRECT' 127 | - 'DOMAIN-SUFFIX,cdn20.com,DIRECT' 128 | - 'DOMAIN-SUFFIX,cdn-apple.com,DIRECT' 129 | - 'DOMAIN-SUFFIX,akadns.net,DIRECT' 130 | - 'DOMAIN-SUFFIX,akamaiedge.net,DIRECT' 131 | - 'DOMAIN-SUFFIX,edgekey.net,DIRECT' 132 | - 'DOMAIN-SUFFIX,mwcloudcdn.com,DIRECT' 133 | - 'DOMAIN-SUFFIX,mwcname.com,DIRECT' 134 | - 'DOMAIN-SUFFIX,apple.com,DIRECT' 135 | - 'DOMAIN-SUFFIX,apple-cloudkit.com,DIRECT' 136 | - 'DOMAIN-SUFFIX,apple-mapkit.com,DIRECT' 137 | - 'DOMAIN-SUFFIX,126.com,DIRECT' 138 | - 'DOMAIN-SUFFIX,126.net,DIRECT' 139 | - 'DOMAIN-SUFFIX,127.net,DIRECT' 140 | - 'DOMAIN-SUFFIX,163.com,DIRECT' 141 | - 'DOMAIN-SUFFIX,360buyimg.com,DIRECT' 142 | - 'DOMAIN-SUFFIX,36kr.com,DIRECT' 143 | - 'DOMAIN-SUFFIX,acfun.tv,DIRECT' 144 | - 'DOMAIN-SUFFIX,air-matters.com,DIRECT' 145 | - 'DOMAIN-SUFFIX,aixifan.com,DIRECT' 146 | - 'DOMAIN-KEYWORD,alicdn,DIRECT' 147 | - 'DOMAIN-KEYWORD,alipay,DIRECT' 148 | - 'DOMAIN-KEYWORD,taobao,DIRECT' 149 | - 'DOMAIN-SUFFIX,amap.com,DIRECT' 150 | - 'DOMAIN-SUFFIX,autonavi.com,DIRECT' 151 | - 'DOMAIN-KEYWORD,baidu,DIRECT' 152 | - 'DOMAIN-SUFFIX,bdimg.com,DIRECT' 153 | - 'DOMAIN-SUFFIX,bdstatic.com,DIRECT' 154 | - 'DOMAIN-SUFFIX,bilibili.com,DIRECT' 155 | - 'DOMAIN-SUFFIX,bilivideo.com,DIRECT' 156 | - 'DOMAIN-SUFFIX,caiyunapp.com,DIRECT' 157 | - 'DOMAIN-SUFFIX,clouddn.com,DIRECT' 158 | - 'DOMAIN-SUFFIX,cnbeta.com,DIRECT' 159 | - 'DOMAIN-SUFFIX,cnbetacdn.com,DIRECT' 160 | - 'DOMAIN-SUFFIX,cootekservice.com,DIRECT' 161 | - 'DOMAIN-SUFFIX,csdn.net,DIRECT' 162 | - 'DOMAIN-SUFFIX,ctrip.com,DIRECT' 163 | - 'DOMAIN-SUFFIX,dgtle.com,DIRECT' 164 | - 'DOMAIN-SUFFIX,dianping.com,DIRECT' 165 | - 'DOMAIN-SUFFIX,douban.com,DIRECT' 166 | - 'DOMAIN-SUFFIX,doubanio.com,DIRECT' 167 | - 'DOMAIN-SUFFIX,duokan.com,DIRECT' 168 | - 'DOMAIN-SUFFIX,easou.com,DIRECT' 169 | - 'DOMAIN-SUFFIX,ele.me,DIRECT' 170 | - 'DOMAIN-SUFFIX,feng.com,DIRECT' 171 | - 'DOMAIN-SUFFIX,fir.im,DIRECT' 172 | - 'DOMAIN-SUFFIX,frdic.com,DIRECT' 173 | - 'DOMAIN-SUFFIX,g-cores.com,DIRECT' 174 | - 'DOMAIN-SUFFIX,godic.net,DIRECT' 175 | - 'DOMAIN-SUFFIX,gtimg.com,DIRECT' 176 | - 'DOMAIN,cdn.hockeyapp.net,DIRECT' 177 | - 'DOMAIN-SUFFIX,hongxiu.com,DIRECT' 178 | - 'DOMAIN-SUFFIX,hxcdn.net,DIRECT' 179 | - 'DOMAIN-SUFFIX,iciba.com,DIRECT' 180 | - 'DOMAIN-SUFFIX,ifeng.com,DIRECT' 181 | - 'DOMAIN-SUFFIX,ifengimg.com,DIRECT' 182 | - 'DOMAIN-SUFFIX,ipip.net,DIRECT' 183 | - 'DOMAIN-SUFFIX,iqiyi.com,DIRECT' 184 | - 'DOMAIN-SUFFIX,jd.com,DIRECT' 185 | - 'DOMAIN-SUFFIX,jianshu.com,DIRECT' 186 | - 'DOMAIN-SUFFIX,knewone.com,DIRECT' 187 | - 'DOMAIN-SUFFIX,le.com,DIRECT' 188 | - 'DOMAIN-SUFFIX,lecloud.com,DIRECT' 189 | - 'DOMAIN-SUFFIX,lemicp.com,DIRECT' 190 | - 'DOMAIN-SUFFIX,licdn.com,DIRECT' 191 | - 'DOMAIN-SUFFIX,luoo.net,DIRECT' 192 | - 'DOMAIN-SUFFIX,meituan.com,DIRECT' 193 | - 'DOMAIN-SUFFIX,meituan.net,DIRECT' 194 | - 'DOMAIN-SUFFIX,mi.com,DIRECT' 195 | - 'DOMAIN-SUFFIX,miaopai.com,DIRECT' 196 | - 'DOMAIN-SUFFIX,microsoft.com,DIRECT' 197 | - 'DOMAIN-SUFFIX,microsoftonline.com,DIRECT' 198 | - 'DOMAIN-SUFFIX,miui.com,DIRECT' 199 | - 'DOMAIN-SUFFIX,miwifi.com,DIRECT' 200 | - 'DOMAIN-SUFFIX,mob.com,DIRECT' 201 | - 'DOMAIN-SUFFIX,netease.com,DIRECT' 202 | - 'DOMAIN-SUFFIX,office.com,DIRECT' 203 | - 'DOMAIN-SUFFIX,office365.com,DIRECT' 204 | - 'DOMAIN-KEYWORD,officecdn,DIRECT' 205 | - 'DOMAIN-SUFFIX,oschina.net,DIRECT' 206 | - 'DOMAIN-SUFFIX,ppsimg.com,DIRECT' 207 | - 'DOMAIN-SUFFIX,pstatp.com,DIRECT' 208 | - 'DOMAIN-SUFFIX,qcloud.com,DIRECT' 209 | - 'DOMAIN-SUFFIX,qdaily.com,DIRECT' 210 | - 'DOMAIN-SUFFIX,qdmm.com,DIRECT' 211 | - 'DOMAIN-SUFFIX,qhimg.com,DIRECT' 212 | - 'DOMAIN-SUFFIX,qhres.com,DIRECT' 213 | - 'DOMAIN-SUFFIX,qidian.com,DIRECT' 214 | - 'DOMAIN-SUFFIX,qihucdn.com,DIRECT' 215 | - 'DOMAIN-SUFFIX,qiniu.com,DIRECT' 216 | - 'DOMAIN-SUFFIX,qiniucdn.com,DIRECT' 217 | - 'DOMAIN-SUFFIX,qiyipic.com,DIRECT' 218 | - 'DOMAIN-SUFFIX,qq.com,DIRECT' 219 | - 'DOMAIN-SUFFIX,qqurl.com,DIRECT' 220 | - 'DOMAIN-SUFFIX,rarbg.to,DIRECT' 221 | - 'DOMAIN-SUFFIX,ruguoapp.com,DIRECT' 222 | - 'DOMAIN-SUFFIX,segmentfault.com,DIRECT' 223 | - 'DOMAIN-SUFFIX,sinaapp.com,DIRECT' 224 | - 'DOMAIN-SUFFIX,smzdm.com,DIRECT' 225 | - 'DOMAIN-SUFFIX,snapdrop.net,DIRECT' 226 | - 'DOMAIN-SUFFIX,sogou.com,DIRECT' 227 | - 'DOMAIN-SUFFIX,sogoucdn.com,DIRECT' 228 | - 'DOMAIN-SUFFIX,sohu.com,DIRECT' 229 | - 'DOMAIN-SUFFIX,soku.com,DIRECT' 230 | - 'DOMAIN-SUFFIX,speedtest.net,DIRECT' 231 | - 'DOMAIN-SUFFIX,sspai.com,DIRECT' 232 | - 'DOMAIN-SUFFIX,suning.com,DIRECT' 233 | - 'DOMAIN-SUFFIX,taobao.com,DIRECT' 234 | - 'DOMAIN-SUFFIX,tencent.com,DIRECT' 235 | - 'DOMAIN-SUFFIX,tenpay.com,DIRECT' 236 | - 'DOMAIN-SUFFIX,tianyancha.com,DIRECT' 237 | - 'DOMAIN-SUFFIX,tmall.com,DIRECT' 238 | - 'DOMAIN-SUFFIX,tudou.com,DIRECT' 239 | - 'DOMAIN-SUFFIX,umetrip.com,DIRECT' 240 | - 'DOMAIN-SUFFIX,upaiyun.com,DIRECT' 241 | - 'DOMAIN-SUFFIX,upyun.com,DIRECT' 242 | - 'DOMAIN-SUFFIX,veryzhun.com,DIRECT' 243 | - 'DOMAIN-SUFFIX,weather.com,DIRECT' 244 | - 'DOMAIN-SUFFIX,weibo.com,DIRECT' 245 | - 'DOMAIN-SUFFIX,xiami.com,DIRECT' 246 | - 'DOMAIN-SUFFIX,xiami.net,DIRECT' 247 | - 'DOMAIN-SUFFIX,xiaomicp.com,DIRECT' 248 | - 'DOMAIN-SUFFIX,ximalaya.com,DIRECT' 249 | - 'DOMAIN-SUFFIX,xmcdn.com,DIRECT' 250 | - 'DOMAIN-SUFFIX,xunlei.com,DIRECT' 251 | - 'DOMAIN-SUFFIX,yhd.com,DIRECT' 252 | - 'DOMAIN-SUFFIX,yihaodianimg.com,DIRECT' 253 | - 'DOMAIN-SUFFIX,yinxiang.com,DIRECT' 254 | - 'DOMAIN-SUFFIX,ykimg.com,DIRECT' 255 | - 'DOMAIN-SUFFIX,youdao.com,DIRECT' 256 | - 'DOMAIN-SUFFIX,youku.com,DIRECT' 257 | - 'DOMAIN-SUFFIX,zealer.com,DIRECT' 258 | - 'DOMAIN-SUFFIX,zhihu.com,DIRECT' 259 | - 'DOMAIN-SUFFIX,zhimg.com,DIRECT' 260 | - 'DOMAIN-SUFFIX,zimuzu.tv,DIRECT' 261 | - 'DOMAIN-SUFFIX,zoho.com,DIRECT' 262 | - 'DOMAIN-KEYWORD,amazon,蓝海加速' 263 | - 'DOMAIN-KEYWORD,google,蓝海加速' 264 | - 'DOMAIN-KEYWORD,gmail,蓝海加速' 265 | - 'DOMAIN-KEYWORD,youtube,蓝海加速' 266 | - 'DOMAIN-KEYWORD,facebook,蓝海加速' 267 | - 'DOMAIN-SUFFIX,fb.me,蓝海加速' 268 | - 'DOMAIN-SUFFIX,fbcdn.net,蓝海加速' 269 | - 'DOMAIN-KEYWORD,twitter,蓝海加速' 270 | - 'DOMAIN-KEYWORD,instagram,蓝海加速' 271 | - 'DOMAIN-KEYWORD,dropbox,蓝海加速' 272 | - 'DOMAIN-SUFFIX,twimg.com,蓝海加速' 273 | - 'DOMAIN-KEYWORD,blogspot,蓝海加速' 274 | - 'DOMAIN-SUFFIX,youtu.be,蓝海加速' 275 | - 'DOMAIN-KEYWORD,whatsapp,蓝海加速' 276 | - 'DOMAIN-KEYWORD,admarvel,REJECT' 277 | - 'DOMAIN-KEYWORD,admaster,REJECT' 278 | - 'DOMAIN-KEYWORD,adsage,REJECT' 279 | - 'DOMAIN-KEYWORD,adsmogo,REJECT' 280 | - 'DOMAIN-KEYWORD,adsrvmedia,REJECT' 281 | - 'DOMAIN-KEYWORD,adwords,REJECT' 282 | - 'DOMAIN-KEYWORD,adservice,REJECT' 283 | - 'DOMAIN-SUFFIX,appsflyer.com,REJECT' 284 | - 'DOMAIN-KEYWORD,domob,REJECT' 285 | - 'DOMAIN-SUFFIX,doubleclick.net,REJECT' 286 | - 'DOMAIN-KEYWORD,duomeng,REJECT' 287 | - 'DOMAIN-KEYWORD,dwtrack,REJECT' 288 | - 'DOMAIN-KEYWORD,guanggao,REJECT' 289 | - 'DOMAIN-KEYWORD,lianmeng,REJECT' 290 | - 'DOMAIN-SUFFIX,mmstat.com,REJECT' 291 | - 'DOMAIN-KEYWORD,mopub,REJECT' 292 | - 'DOMAIN-KEYWORD,omgmta,REJECT' 293 | - 'DOMAIN-KEYWORD,openx,REJECT' 294 | - 'DOMAIN-KEYWORD,partnerad,REJECT' 295 | - 'DOMAIN-KEYWORD,pingfore,REJECT' 296 | - 'DOMAIN-KEYWORD,supersonicads,REJECT' 297 | - 'DOMAIN-KEYWORD,uedas,REJECT' 298 | - 'DOMAIN-KEYWORD,umeng,REJECT' 299 | - 'DOMAIN-KEYWORD,usage,REJECT' 300 | - 'DOMAIN-SUFFIX,vungle.com,REJECT' 301 | - 'DOMAIN-KEYWORD,wlmonitor,REJECT' 302 | - 'DOMAIN-KEYWORD,zjtoolbar,REJECT' 303 | - 'DOMAIN-SUFFIX,9to5mac.com,蓝海加速' 304 | - 'DOMAIN-SUFFIX,abpchina.org,蓝海加速' 305 | - 'DOMAIN-SUFFIX,adblockplus.org,蓝海加速' 306 | - 'DOMAIN-SUFFIX,adobe.com,蓝海加速' 307 | - 'DOMAIN-SUFFIX,akamaized.net,蓝海加速' 308 | - 'DOMAIN-SUFFIX,alfredapp.com,蓝海加速' 309 | - 'DOMAIN-SUFFIX,amplitude.com,蓝海加速' 310 | - 'DOMAIN-SUFFIX,ampproject.org,蓝海加速' 311 | - 'DOMAIN-SUFFIX,android.com,蓝海加速' 312 | - 'DOMAIN-SUFFIX,angularjs.org,蓝海加速' 313 | - 'DOMAIN-SUFFIX,aolcdn.com,蓝海加速' 314 | - 'DOMAIN-SUFFIX,apkpure.com,蓝海加速' 315 | - 'DOMAIN-SUFFIX,appledaily.com,蓝海加速' 316 | - 'DOMAIN-SUFFIX,appshopper.com,蓝海加速' 317 | - 'DOMAIN-SUFFIX,appspot.com,蓝海加速' 318 | - 'DOMAIN-SUFFIX,arcgis.com,蓝海加速' 319 | - 'DOMAIN-SUFFIX,archive.org,蓝海加速' 320 | - 'DOMAIN-SUFFIX,armorgames.com,蓝海加速' 321 | - 'DOMAIN-SUFFIX,aspnetcdn.com,蓝海加速' 322 | - 'DOMAIN-SUFFIX,att.com,蓝海加速' 323 | - 'DOMAIN-SUFFIX,awsstatic.com,蓝海加速' 324 | - 'DOMAIN-SUFFIX,azureedge.net,蓝海加速' 325 | - 'DOMAIN-SUFFIX,azurewebsites.net,蓝海加速' 326 | - 'DOMAIN-SUFFIX,bing.com,蓝海加速' 327 | - 'DOMAIN-SUFFIX,bintray.com,蓝海加速' 328 | - 'DOMAIN-SUFFIX,bit.com,蓝海加速' 329 | - 'DOMAIN-SUFFIX,bit.ly,蓝海加速' 330 | - 'DOMAIN-SUFFIX,bitbucket.org,蓝海加速' 331 | - 'DOMAIN-SUFFIX,bjango.com,蓝海加速' 332 | - 'DOMAIN-SUFFIX,bkrtx.com,蓝海加速' 333 | - 'DOMAIN-SUFFIX,blog.com,蓝海加速' 334 | - 'DOMAIN-SUFFIX,blogcdn.com,蓝海加速' 335 | - 'DOMAIN-SUFFIX,blogger.com,蓝海加速' 336 | - 'DOMAIN-SUFFIX,blogsmithmedia.com,蓝海加速' 337 | - 'DOMAIN-SUFFIX,blogspot.com,蓝海加速' 338 | - 'DOMAIN-SUFFIX,blogspot.hk,蓝海加速' 339 | - 'DOMAIN-SUFFIX,bloomberg.com,蓝海加速' 340 | - 'DOMAIN-SUFFIX,box.com,蓝海加速' 341 | - 'DOMAIN-SUFFIX,box.net,蓝海加速' 342 | - 'DOMAIN-SUFFIX,cachefly.net,蓝海加速' 343 | - 'DOMAIN-SUFFIX,chromium.org,蓝海加速' 344 | - 'DOMAIN-SUFFIX,cl.ly,蓝海加速' 345 | - 'DOMAIN-SUFFIX,cloudflare.com,蓝海加速' 346 | - 'DOMAIN-SUFFIX,cloudfront.net,蓝海加速' 347 | - 'DOMAIN-SUFFIX,cloudmagic.com,蓝海加速' 348 | - 'DOMAIN-SUFFIX,cmail19.com,蓝海加速' 349 | - 'DOMAIN-SUFFIX,cnet.com,蓝海加速' 350 | - 'DOMAIN-SUFFIX,cocoapods.org,蓝海加速' 351 | - 'DOMAIN-SUFFIX,comodoca.com,蓝海加速' 352 | - 'DOMAIN-SUFFIX,crashlytics.com,蓝海加速' 353 | - 'DOMAIN-SUFFIX,culturedcode.com,蓝海加速' 354 | - 'DOMAIN-SUFFIX,d.pr,蓝海加速' 355 | - 'DOMAIN-SUFFIX,danilo.to,蓝海加速' 356 | - 'DOMAIN-SUFFIX,dayone.me,蓝海加速' 357 | - 'DOMAIN-SUFFIX,db.tt,蓝海加速' 358 | - 'DOMAIN-SUFFIX,deskconnect.com,蓝海加速' 359 | - 'DOMAIN-SUFFIX,disq.us,蓝海加速' 360 | - 'DOMAIN-SUFFIX,disqus.com,蓝海加速' 361 | - 'DOMAIN-SUFFIX,disquscdn.com,蓝海加速' 362 | - 'DOMAIN-SUFFIX,dnsimple.com,蓝海加速' 363 | - 'DOMAIN-SUFFIX,docker.com,蓝海加速' 364 | - 'DOMAIN-SUFFIX,dribbble.com,蓝海加速' 365 | - 'DOMAIN-SUFFIX,droplr.com,蓝海加速' 366 | - 'DOMAIN-SUFFIX,duckduckgo.com,蓝海加速' 367 | - 'DOMAIN-SUFFIX,dueapp.com,蓝海加速' 368 | - 'DOMAIN-SUFFIX,dytt8.net,蓝海加速' 369 | - 'DOMAIN-SUFFIX,edgecastcdn.net,蓝海加速' 370 | - 'DOMAIN-SUFFIX,edgekey.net,蓝海加速' 371 | - 'DOMAIN-SUFFIX,edgesuite.net,蓝海加速' 372 | - 'DOMAIN-SUFFIX,engadget.com,蓝海加速' 373 | - 'DOMAIN-SUFFIX,entrust.net,蓝海加速' 374 | - 'DOMAIN-SUFFIX,eurekavpt.com,蓝海加速' 375 | - 'DOMAIN-SUFFIX,evernote.com,蓝海加速' 376 | - 'DOMAIN-SUFFIX,fabric.io,蓝海加速' 377 | - 'DOMAIN-SUFFIX,fast.com,蓝海加速' 378 | - 'DOMAIN-SUFFIX,fastly.net,蓝海加速' 379 | - 'DOMAIN-SUFFIX,fc2.com,蓝海加速' 380 | - 'DOMAIN-SUFFIX,feedburner.com,蓝海加速' 381 | - 'DOMAIN-SUFFIX,feedly.com,蓝海加速' 382 | - 'DOMAIN-SUFFIX,feedsportal.com,蓝海加速' 383 | - 'DOMAIN-SUFFIX,fiftythree.com,蓝海加速' 384 | - 'DOMAIN-SUFFIX,firebaseio.com,蓝海加速' 385 | - 'DOMAIN-SUFFIX,flexibits.com,蓝海加速' 386 | - 'DOMAIN-SUFFIX,flickr.com,蓝海加速' 387 | - 'DOMAIN-SUFFIX,flipboard.com,蓝海加速' 388 | - 'DOMAIN-SUFFIX,g.co,蓝海加速' 389 | - 'DOMAIN-SUFFIX,gabia.net,蓝海加速' 390 | - 'DOMAIN-SUFFIX,geni.us,蓝海加速' 391 | - 'DOMAIN-SUFFIX,gfx.ms,蓝海加速' 392 | - 'DOMAIN-SUFFIX,ggpht.com,蓝海加速' 393 | - 'DOMAIN-SUFFIX,ghostnoteapp.com,蓝海加速' 394 | - 'DOMAIN-SUFFIX,git.io,蓝海加速' 395 | - 'DOMAIN-KEYWORD,github,蓝海加速' 396 | - 'DOMAIN-SUFFIX,globalsign.com,蓝海加速' 397 | - 'DOMAIN-SUFFIX,gmodules.com,蓝海加速' 398 | - 'DOMAIN-SUFFIX,godaddy.com,蓝海加速' 399 | - 'DOMAIN-SUFFIX,golang.org,蓝海加速' 400 | - 'DOMAIN-SUFFIX,gongm.in,蓝海加速' 401 | - 'DOMAIN-SUFFIX,goo.gl,蓝海加速' 402 | - 'DOMAIN-SUFFIX,goodreaders.com,蓝海加速' 403 | - 'DOMAIN-SUFFIX,goodreads.com,蓝海加速' 404 | - 'DOMAIN-SUFFIX,gravatar.com,蓝海加速' 405 | - 'DOMAIN-SUFFIX,gstatic.com,蓝海加速' 406 | - 'DOMAIN-SUFFIX,gvt0.com,蓝海加速' 407 | - 'DOMAIN-SUFFIX,hockeyapp.net,蓝海加速' 408 | - 'DOMAIN-SUFFIX,hotmail.com,蓝海加速' 409 | - 'DOMAIN-SUFFIX,icons8.com,蓝海加速' 410 | - 'DOMAIN-SUFFIX,ifixit.com,蓝海加速' 411 | - 'DOMAIN-SUFFIX,ift.tt,蓝海加速' 412 | - 'DOMAIN-SUFFIX,ifttt.com,蓝海加速' 413 | - 'DOMAIN-SUFFIX,iherb.com,蓝海加速' 414 | - 'DOMAIN-SUFFIX,imageshack.us,蓝海加速' 415 | - 'DOMAIN-SUFFIX,img.ly,蓝海加速' 416 | - 'DOMAIN-SUFFIX,imgur.com,蓝海加速' 417 | - 'DOMAIN-SUFFIX,imore.com,蓝海加速' 418 | - 'DOMAIN-SUFFIX,instapaper.com,蓝海加速' 419 | - 'DOMAIN-SUFFIX,ipn.li,蓝海加速' 420 | - 'DOMAIN-SUFFIX,is.gd,蓝海加速' 421 | - 'DOMAIN-SUFFIX,issuu.com,蓝海加速' 422 | - 'DOMAIN-SUFFIX,itgonglun.com,蓝海加速' 423 | - 'DOMAIN-SUFFIX,itun.es,蓝海加速' 424 | - 'DOMAIN-SUFFIX,ixquick.com,蓝海加速' 425 | - 'DOMAIN-SUFFIX,j.mp,蓝海加速' 426 | - 'DOMAIN-SUFFIX,js.revsci.net,蓝海加速' 427 | - 'DOMAIN-SUFFIX,jshint.com,蓝海加速' 428 | - 'DOMAIN-SUFFIX,jtvnw.net,蓝海加速' 429 | - 'DOMAIN-SUFFIX,justgetflux.com,蓝海加速' 430 | - 'DOMAIN-SUFFIX,kat.cr,蓝海加速' 431 | - 'DOMAIN-SUFFIX,klip.me,蓝海加速' 432 | - 'DOMAIN-SUFFIX,libsyn.com,蓝海加速' 433 | - 'DOMAIN-SUFFIX,linkedin.com,蓝海加速' 434 | - 'DOMAIN-SUFFIX,line-apps.com,蓝海加速' 435 | - 'DOMAIN-SUFFIX,linode.com,蓝海加速' 436 | - 'DOMAIN-SUFFIX,lithium.com,蓝海加速' 437 | - 'DOMAIN-SUFFIX,littlehj.com,蓝海加速' 438 | - 'DOMAIN-SUFFIX,live.com,蓝海加速' 439 | - 'DOMAIN-SUFFIX,live.net,蓝海加速' 440 | - 'DOMAIN-SUFFIX,livefilestore.com,蓝海加速' 441 | - 'DOMAIN-SUFFIX,llnwd.net,蓝海加速' 442 | - 'DOMAIN-SUFFIX,macid.co,蓝海加速' 443 | - 'DOMAIN-SUFFIX,macromedia.com,蓝海加速' 444 | - 'DOMAIN-SUFFIX,macrumors.com,蓝海加速' 445 | - 'DOMAIN-SUFFIX,mashable.com,蓝海加速' 446 | - 'DOMAIN-SUFFIX,mathjax.org,蓝海加速' 447 | - 'DOMAIN-SUFFIX,medium.com,蓝海加速' 448 | - 'DOMAIN-SUFFIX,mega.co.nz,蓝海加速' 449 | - 'DOMAIN-SUFFIX,mega.nz,蓝海加速' 450 | - 'DOMAIN-SUFFIX,megaupload.com,蓝海加速' 451 | - 'DOMAIN-SUFFIX,microsofttranslator.com,蓝海加速' 452 | - 'DOMAIN-SUFFIX,mindnode.com,蓝海加速' 453 | - 'DOMAIN-SUFFIX,mobile01.com,蓝海加速' 454 | - 'DOMAIN-SUFFIX,modmyi.com,蓝海加速' 455 | - 'DOMAIN-SUFFIX,msedge.net,蓝海加速' 456 | - 'DOMAIN-SUFFIX,myfontastic.com,蓝海加速' 457 | - 'DOMAIN-SUFFIX,name.com,蓝海加速' 458 | - 'DOMAIN-SUFFIX,nextmedia.com,蓝海加速' 459 | - 'DOMAIN-SUFFIX,nsstatic.net,蓝海加速' 460 | - 'DOMAIN-SUFFIX,nssurge.com,蓝海加速' 461 | - 'DOMAIN-SUFFIX,nyt.com,蓝海加速' 462 | - 'DOMAIN-SUFFIX,nytimes.com,蓝海加速' 463 | - 'DOMAIN-SUFFIX,omnigroup.com,蓝海加速' 464 | - 'DOMAIN-SUFFIX,onedrive.com,蓝海加速' 465 | - 'DOMAIN-SUFFIX,onenote.com,蓝海加速' 466 | - 'DOMAIN-SUFFIX,ooyala.com,蓝海加速' 467 | - 'DOMAIN-SUFFIX,openvpn.net,蓝海加速' 468 | - 'DOMAIN-SUFFIX,openwrt.org,蓝海加速' 469 | - 'DOMAIN-SUFFIX,orkut.com,蓝海加速' 470 | - 'DOMAIN-SUFFIX,osxdaily.com,蓝海加速' 471 | - 'DOMAIN-SUFFIX,outlook.com,蓝海加速' 472 | - 'DOMAIN-SUFFIX,ow.ly,蓝海加速' 473 | - 'DOMAIN-SUFFIX,paddleapi.com,蓝海加速' 474 | - 'DOMAIN-SUFFIX,parallels.com,蓝海加速' 475 | - 'DOMAIN-SUFFIX,parse.com,蓝海加速' 476 | - 'DOMAIN-SUFFIX,pdfexpert.com,蓝海加速' 477 | - 'DOMAIN-SUFFIX,periscope.tv,蓝海加速' 478 | - 'DOMAIN-SUFFIX,pinboard.in,蓝海加速' 479 | - 'DOMAIN-SUFFIX,pinterest.com,蓝海加速' 480 | - 'DOMAIN-SUFFIX,pixelmator.com,蓝海加速' 481 | - 'DOMAIN-SUFFIX,pixiv.net,蓝海加速' 482 | - 'DOMAIN-SUFFIX,playpcesor.com,蓝海加速' 483 | - 'DOMAIN-SUFFIX,playstation.com,蓝海加速' 484 | - 'DOMAIN-SUFFIX,playstation.com.hk,蓝海加速' 485 | - 'DOMAIN-SUFFIX,playstation.net,蓝海加速' 486 | - 'DOMAIN-SUFFIX,playstationnetwork.com,蓝海加速' 487 | - 'DOMAIN-SUFFIX,pushwoosh.com,蓝海加速' 488 | - 'DOMAIN-SUFFIX,rime.im,蓝海加速' 489 | - 'DOMAIN-SUFFIX,servebom.com,蓝海加速' 490 | - 'DOMAIN-SUFFIX,sfx.ms,蓝海加速' 491 | - 'DOMAIN-SUFFIX,shadowsocks.org,蓝海加速' 492 | - 'DOMAIN-SUFFIX,sharethis.com,蓝海加速' 493 | - 'DOMAIN-SUFFIX,shazam.com,蓝海加速' 494 | - 'DOMAIN-SUFFIX,skype.com,蓝海加速' 495 | - 'DOMAIN-SUFFIX,smartdns蓝海加速.com,蓝海加速' 496 | - 'DOMAIN-SUFFIX,smartmailcloud.com,蓝海加速' 497 | - 'DOMAIN-SUFFIX,sndcdn.com,蓝海加速' 498 | - 'DOMAIN-SUFFIX,sony.com,蓝海加速' 499 | - 'DOMAIN-SUFFIX,soundcloud.com,蓝海加速' 500 | - 'DOMAIN-SUFFIX,sourceforge.net,蓝海加速' 501 | - 'DOMAIN-SUFFIX,spotify.com,蓝海加速' 502 | - 'DOMAIN-SUFFIX,squarespace.com,蓝海加速' 503 | - 'DOMAIN-SUFFIX,sstatic.net,蓝海加速' 504 | - 'DOMAIN-SUFFIX,st.luluku.pw,蓝海加速' 505 | - 'DOMAIN-SUFFIX,stackoverflow.com,蓝海加速' 506 | - 'DOMAIN-SUFFIX,startpage.com,蓝海加速' 507 | - 'DOMAIN-SUFFIX,staticflickr.com,蓝海加速' 508 | - 'DOMAIN-SUFFIX,steamcommunity.com,蓝海加速' 509 | - 'DOMAIN-SUFFIX,symauth.com,蓝海加速' 510 | - 'DOMAIN-SUFFIX,symcb.com,蓝海加速' 511 | - 'DOMAIN-SUFFIX,symcd.com,蓝海加速' 512 | - 'DOMAIN-SUFFIX,tapbots.com,蓝海加速' 513 | - 'DOMAIN-SUFFIX,tapbots.net,蓝海加速' 514 | - 'DOMAIN-SUFFIX,tdesktop.com,蓝海加速' 515 | - 'DOMAIN-SUFFIX,techcrunch.com,蓝海加速' 516 | - 'DOMAIN-SUFFIX,techsmith.com,蓝海加速' 517 | - 'DOMAIN-SUFFIX,thepiratebay.org,蓝海加速' 518 | - 'DOMAIN-SUFFIX,theverge.com,蓝海加速' 519 | - 'DOMAIN-SUFFIX,time.com,蓝海加速' 520 | - 'DOMAIN-SUFFIX,timeinc.net,蓝海加速' 521 | - 'DOMAIN-SUFFIX,tiny.cc,蓝海加速' 522 | - 'DOMAIN-SUFFIX,tinypic.com,蓝海加速' 523 | - 'DOMAIN-SUFFIX,tmblr.co,蓝海加速' 524 | - 'DOMAIN-SUFFIX,todoist.com,蓝海加速' 525 | - 'DOMAIN-SUFFIX,trello.com,蓝海加速' 526 | - 'DOMAIN-SUFFIX,trustasiassl.com,蓝海加速' 527 | - 'DOMAIN-SUFFIX,tumblr.co,蓝海加速' 528 | - 'DOMAIN-SUFFIX,tumblr.com,蓝海加速' 529 | - 'DOMAIN-SUFFIX,tweetdeck.com,蓝海加速' 530 | - 'DOMAIN-SUFFIX,tweetmarker.net,蓝海加速' 531 | - 'DOMAIN-SUFFIX,twitch.tv,蓝海加速' 532 | - 'DOMAIN-SUFFIX,txmblr.com,蓝海加速' 533 | - 'DOMAIN-SUFFIX,typekit.net,蓝海加速' 534 | - 'DOMAIN-SUFFIX,ubertags.com,蓝海加速' 535 | - 'DOMAIN-SUFFIX,ublock.org,蓝海加速' 536 | - 'DOMAIN-SUFFIX,ubnt.com,蓝海加速' 537 | - 'DOMAIN-SUFFIX,ulyssesapp.com,蓝海加速' 538 | - 'DOMAIN-SUFFIX,urchin.com,蓝海加速' 539 | - 'DOMAIN-SUFFIX,usertrust.com,蓝海加速' 540 | - 'DOMAIN-SUFFIX,v.gd,蓝海加速' 541 | - 'DOMAIN-SUFFIX,v2ex.com,蓝海加速' 542 | - 'DOMAIN-SUFFIX,vimeo.com,蓝海加速' 543 | - 'DOMAIN-SUFFIX,vimeocdn.com,蓝海加速' 544 | - 'DOMAIN-SUFFIX,vine.co,蓝海加速' 545 | - 'DOMAIN-SUFFIX,vivaldi.com,蓝海加速' 546 | - 'DOMAIN-SUFFIX,vox-cdn.com,蓝海加速' 547 | - 'DOMAIN-SUFFIX,vsco.co,蓝海加速' 548 | - 'DOMAIN-SUFFIX,vultr.com,蓝海加速' 549 | - 'DOMAIN-SUFFIX,w.org,蓝海加速' 550 | - 'DOMAIN-SUFFIX,w3schools.com,蓝海加速' 551 | - 'DOMAIN-SUFFIX,webtype.com,蓝海加速' 552 | - 'DOMAIN-SUFFIX,wikiwand.com,蓝海加速' 553 | - 'DOMAIN-SUFFIX,wikileaks.org,蓝海加速' 554 | - 'DOMAIN-SUFFIX,wikimedia.org,蓝海加速' 555 | - 'DOMAIN-SUFFIX,wikipedia.com,蓝海加速' 556 | - 'DOMAIN-SUFFIX,wikipedia.org,蓝海加速' 557 | - 'DOMAIN-SUFFIX,windows.com,蓝海加速' 558 | - 'DOMAIN-SUFFIX,windows.net,蓝海加速' 559 | - 'DOMAIN-SUFFIX,wire.com,蓝海加速' 560 | - 'DOMAIN-SUFFIX,wordpress.com,蓝海加速' 561 | - 'DOMAIN-SUFFIX,workflowy.com,蓝海加速' 562 | - 'DOMAIN-SUFFIX,wp.com,蓝海加速' 563 | - 'DOMAIN-SUFFIX,wsj.com,蓝海加速' 564 | - 'DOMAIN-SUFFIX,wsj.net,蓝海加速' 565 | - 'DOMAIN-SUFFIX,xda-developers.com,蓝海加速' 566 | - 'DOMAIN-SUFFIX,xeeno.com,蓝海加速' 567 | - 'DOMAIN-SUFFIX,xiti.com,蓝海加速' 568 | - 'DOMAIN-SUFFIX,yahoo.com,蓝海加速' 569 | - 'DOMAIN-SUFFIX,yimg.com,蓝海加速' 570 | - 'DOMAIN-SUFFIX,ying.com,蓝海加速' 571 | - 'DOMAIN-SUFFIX,yoyo.org,蓝海加速' 572 | - 'DOMAIN-SUFFIX,ytimg.com,蓝海加速' 573 | - 'DOMAIN-SUFFIX,telegra.ph,蓝海加速' 574 | - 'DOMAIN-SUFFIX,telegram.org,蓝海加速' 575 | - 'IP-CIDR,91.108.4.0/22,蓝海加速,no-resolve' 576 | - 'IP-CIDR,91.108.8.0/21,蓝海加速,no-resolve' 577 | - 'IP-CIDR,91.108.16.0/22,蓝海加速,no-resolve' 578 | - 'IP-CIDR,91.108.56.0/22,蓝海加速,no-resolve' 579 | - 'IP-CIDR,149.154.160.0/20,蓝海加速,no-resolve' 580 | - 'IP-CIDR6,2001:67c:4e8::/48,蓝海加速,no-resolve' 581 | - 'IP-CIDR6,2001:b28:f23d::/48,蓝海加速,no-resolve' 582 | - 'IP-CIDR6,2001:b28:f23f::/48,蓝海加速,no-resolve' 583 | - 'IP-CIDR,120.232.181.162/32,蓝海加速,no-resolve' 584 | - 'IP-CIDR,120.241.147.226/32,蓝海加速,no-resolve' 585 | - 'IP-CIDR,120.253.253.226/32,蓝海加速,no-resolve' 586 | - 'IP-CIDR,120.253.255.162/32,蓝海加速,no-resolve' 587 | - 'IP-CIDR,120.253.255.34/32,蓝海加速,no-resolve' 588 | - 'IP-CIDR,120.253.255.98/32,蓝海加速,no-resolve' 589 | - 'IP-CIDR,180.163.150.162/32,蓝海加速,no-resolve' 590 | - 'IP-CIDR,180.163.150.34/32,蓝海加速,no-resolve' 591 | - 'IP-CIDR,180.163.151.162/32,蓝海加速,no-resolve' 592 | - 'IP-CIDR,180.163.151.34/32,蓝海加速,no-resolve' 593 | - 'IP-CIDR,203.208.39.0/24,蓝海加速,no-resolve' 594 | - 'IP-CIDR,203.208.40.0/24,蓝海加速,no-resolve' 595 | - 'IP-CIDR,203.208.41.0/24,蓝海加速,no-resolve' 596 | - 'IP-CIDR,203.208.43.0/24,蓝海加速,no-resolve' 597 | - 'IP-CIDR,203.208.50.0/24,蓝海加速,no-resolve' 598 | - 'IP-CIDR,220.181.174.162/32,蓝海加速,no-resolve' 599 | - 'IP-CIDR,220.181.174.226/32,蓝海加速,no-resolve' 600 | - 'IP-CIDR,220.181.174.34/32,蓝海加速,no-resolve' 601 | - 'DOMAIN,injections.adguard.org,DIRECT' 602 | - 'DOMAIN,local.adguard.org,DIRECT' 603 | - 'DOMAIN-SUFFIX,local,DIRECT' 604 | - 'IP-CIDR,127.0.0.0/8,DIRECT' 605 | - 'IP-CIDR,172.16.0.0/12,DIRECT' 606 | - 'IP-CIDR,192.168.0.0/16,DIRECT' 607 | - 'IP-CIDR,10.0.0.0/8,DIRECT' 608 | - 'IP-CIDR,17.0.0.0/8,DIRECT' 609 | - 'IP-CIDR,100.64.0.0/10,DIRECT' 610 | - 'IP-CIDR,224.0.0.0/4,DIRECT' 611 | - 'IP-CIDR6,fe80::/10,DIRECT' 612 | - 'DOMAIN-SUFFIX,cn,DIRECT' 613 | - 'DOMAIN-KEYWORD,-cn,DIRECT' 614 | - 'GEOIP,CN,DIRECT' 615 | - 'MATCH,蓝海加速' 616 | -------------------------------------------------------------------------------- /profiles.d-examples/aws-cli-completion.sh: -------------------------------------------------------------------------------- 1 | if [[ $SHELL == *zsh ]]; then 2 | source /usr/local/bin/aws_zsh_completer.sh 3 | fi 4 | -------------------------------------------------------------------------------- /profiles.d-examples/docker-machine-env.sh: -------------------------------------------------------------------------------- 1 | eval $(docker-machine env dockerhost) 2 | -------------------------------------------------------------------------------- /profiles.d-examples/go-path.sh: -------------------------------------------------------------------------------- 1 | export GOPATH=$HOME 2 | -------------------------------------------------------------------------------- /profiles.d-examples/ruby-env.sh: -------------------------------------------------------------------------------- 1 | # Try load ChefDK if installed, or else rbenv if installed 2 | if [[ -x /opt/chefdk/bin/chef ]]; then 3 | eval "$(/opt/chefdk/bin/chef shell-init bash)" 4 | elif which rbenv > /dev/null 2>&1; then 5 | eval "$(rbenv init -)" 6 | fi 7 | -------------------------------------------------------------------------------- /screen/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | rsync $SELF_DIR/screenrc ~/.screenrc 9 | -------------------------------------------------------------------------------- /screen/screenrc: -------------------------------------------------------------------------------- 1 | # Matthew Wang's screenrc 2 | # 3 | # Run this to set it up: 4 | # curl -fksSL https://github.com/ymattw/profiles/raw/master/screenrc > ~/.screenrc 5 | # 6 | startup_message off 7 | defscrollback 9000 8 | autodetach on 9 | altscreen off 10 | nonblock on 11 | vbell off 12 | 13 | # Enable scrollback with mouse wheel/trackpad, verified with iTerm (Rremember 14 | # to enable related profile preference: Terminal -> "Save lines to scrollback 15 | # when an app status bar is present") 16 | # 17 | termcapinfo xterm* ti@:te@ 18 | 19 | # %{WB} lightwhite on lightblue 20 | # %-w all window (number and title) up to current one 21 | # %{bW} blue on lightwhite 22 | # %n %t current window number and title 23 | # %f flags of the window 24 | # %{-} restore color attribute to just before last change 25 | # %+w all window (number and title) after current one 26 | # %-12= pad up to screen width - 12 27 | # %c time in 24h 28 | # %D short weekday name 29 | # %d day number 30 | # 31 | hardstatus alwayslastline '%{WB}%-w%{bW}%n %t%f%{-}%+w %-12=%c %D %d' 32 | 33 | # PgUp to scroll up 34 | bindkey -k kP copy 35 | bind s 36 | # bind | split -v 37 | bind j focus down 38 | bind k focus up 39 | bind x remove 40 | bind _ only 41 | 42 | # screen -t dev 0 zsh 43 | # screen -t dev 1 zsh 44 | -------------------------------------------------------------------------------- /squirrel/README.md: -------------------------------------------------------------------------------- 1 | # Squirrel (Rime) Config for macOS 2 | 3 | This is my personal [Squirrel](https://github.com/rime/squirrel) configuration, 4 | which a customized color scheme "solarized_light". 5 | -------------------------------------------------------------------------------- /squirrel/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | if [[ $(uname -s) == Darwin ]]; then 9 | mkdir -p $HOME/Library/Rime 10 | cp squirrel.custom.yaml $HOME/Library/Rime/ 11 | fi 12 | -------------------------------------------------------------------------------- /squirrel/squirrel.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | preset_color_schemes: 3 | solarized_light: 4 | back_color: 0xe3f6fd 5 | border_color: 0xe2e2e2 6 | candidate_text_color: 0x837b65 7 | comment_text_color: 0xeeeeee 8 | hilited_back_color: 0xe3f6fd 9 | hilited_candidate_back_color: 0xce7539 10 | hilited_candidate_text_color: 0xffffff 11 | hilited_comment_text_color: 0xd5e8ee 12 | hilited_text_color: 0x888888 13 | label_color: 0xa1a193 14 | name: "solarized_light" 15 | text_color: 0x666666 16 | style: 17 | border_width: 0 18 | border_height: 0 19 | font_point: 14 20 | horizontal: true 21 | font_face: PTSans-Caption 22 | corner_radius: 3 23 | color_scheme: solarized_light 24 | us_keyboard_layout: true 25 | app_options: 26 | org.vim.MacVim: &a 27 | ascii_mode: false 28 | com.googlecode.iterm2: *a 29 | com.runningwithcrayons.Alfred-2: *a 30 | com.blacktree.Quicksilver: *a 31 | -------------------------------------------------------------------------------- /ssh/config.sample: -------------------------------------------------------------------------------- 1 | # Example .ssh/config. See ssh_config(5) for see all options. 2 | # 3 | # Most common options: 4 | # 5 | # LocalForward 5601 localhost:5601 6 | # DynamicForward 7070 7 | # ProxyCommand /usr/bin/nc -X 5 -x localhost:1080 %h %p 8 | # IdentifyFile ~/.ssh/my.key 9 | 10 | Host cent7 11 | Hostname 10.1.1.2 12 | 13 | Host github.com bitbucket.org git 14 | ControlMaster auto 15 | ControlPath ~/.ssh-%h-%p.mux 16 | ControlPersist 1h 17 | 18 | Host jumpbox 19 | PreferredAuthentications publickey 20 | ForwardAgent yes 21 | 22 | Host far 23 | ProxyCommand ssh jumpbox -W %h:%p 24 | PreferredAuthentications publickey 25 | ForwardAgent yes 26 | 27 | # Now you can jump in a chain like: ssh jumpbox/far/remote 28 | # 29 | Host */* 30 | ProxyCommand ssh $(dirname %h) -W $(basename %h):%p 31 | PreferredAuthentications publickey 32 | ForwardAgent yes 33 | 34 | Host * 35 | User ymattw 36 | TCPKeepAlive yes 37 | ServerAliveInterval 30 38 | ServerAliveCountMax 5 39 | -------------------------------------------------------------------------------- /ssh/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | mkdir -m 700 -p ~/.ssh 9 | rsync $SELF_DIR/config.sample ~/.ssh/ 10 | -------------------------------------------------------------------------------- /tmux/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | 8 | rsync $SELF_DIR/tmux.conf ~/.tmux.conf 9 | -------------------------------------------------------------------------------- /tmux/tmux.conf: -------------------------------------------------------------------------------- 1 | # Prefix: default to C-a for remote servers, use S to switch between 2 | # C-a and S-F1 (F13) (I actually use Caps Lock). 3 | # 4 | # Install Karabiner [1], map caps Lock to F13 as the prefix key. Also note the 5 | # key binding for last-window. See also ../karabiner. 6 | # 7 | # [1] https://github.com/tekezo/Karabiner-Elements 8 | # 9 | set -g prefix C-a # S to switch between C-a & S-F1 (Caps lock) 10 | bind C-a last-window # Default to C-a but S will change it 11 | 12 | # Global options 13 | # 14 | set -g default-terminal screen-256color 15 | set -g escape-time 0 16 | set -g set-titles on 17 | set -g visual-activity off 18 | set -g display-panes-time 5000 19 | set -g history-limit 99999 20 | set -g mode-keys vi 21 | set -g mouse off 22 | 23 | # Status bar related options 24 | # 25 | set -g set-titles-string '#H #W [#P]' 26 | set -g status on 27 | set -g status-bg black 28 | set -g status-fg blue 29 | set -g status-interval 2 30 | set -g status-left-length 100 31 | set -g status-left '#[fg=green]@#h#[default] #[fg=red]#(tmux show -g prefix | cut -d" " -f2)#[default] ' 32 | set -g status-justify left 33 | set -g status-right-length 13 34 | set -g status-right "%H:%M %a %d" # Eg: 09:44 Wed 19 35 | 36 | # Window related options. Colors work best for iTerm with Solarized Dark theme, 37 | # also note a special setting 'hi Normal ctermbg=none' for vim is requierd to 38 | # work with below 'window-style' for inactive panes. 39 | # 40 | set -g window-style 'bg=colour237' # ~=gray 41 | set -g window-active-style 'bg=colour8' # Solarized base03 42 | set -g pane-border-bg 'colour10' # Solarized base01 43 | set -g pane-border-fg 'colour10' # Solarized base01 44 | set -g pane-active-border-fg green 45 | set -g pane-active-border-bg green 46 | set -g window-status-current-bg yellow 47 | set -g window-status-current-fg black 48 | set -g monitor-activity on 49 | set -g base-index 1 50 | set -g pane-base-index 1 51 | set -g window-status-activity-bg yellow 52 | set -g window-status-activity-fg black 53 | set -g window-status-format ' #I #W #F ' # Index, name, flag 54 | set -g window-status-current-format ' #I #W #F ' 55 | set -g alternate-screen off 56 | set -g automatic-rename on 57 | 58 | # NOTE! the 'b:' prefix below means 'basename', this feature is not released 59 | # yet (will be in tmux v2.2), build from master yourself or remove it for now 60 | # 61 | set -g automatic-rename-format \ 62 | '#{?pane_in_mode,[tmux],#{b:pane_current_path}:#{pane_current_command}}' 63 | 64 | set -g other-pane-width 80 65 | set -g other-pane-height 25 66 | 67 | # Key bindings 68 | # 69 | bind a send-prefix 70 | bind r source-file ~/.tmux.conf \; display '~/.tmux.conf reloaded' 71 | bind c new-window 72 | bind 0 new-window # better with Caps Lock 73 | bind i split-window -h -c '#{pane_current_path}' # Insert pane right 74 | bind o split-window -v -c '#{pane_current_path}' # Open pane below 75 | bind h select-pane -L # Left pane 76 | bind -r Left select-pane -L # Left pane 77 | bind j select-pane -D # Down pane 78 | bind -r Down select-pane -D # Down pane 79 | bind k select-pane -U # Up pane 80 | bind -r Up select-pane -U # Up pane 81 | bind l select-pane -R # Right pane 82 | bind -r Right select-pane -R # Right pane 83 | bind -r Tab select-pane -t :.+ # Cycle in panes 84 | bind Enter resize-pane -Z # Maximize pane 85 | bind = select-layout tiled 86 | bind - swapp -t 1 \; selectp -t 1 \; select-layout main-horizontal 87 | # Make me uppermost 88 | bind \ swapp -t 1 \; selectp -t 1 \; select-layout main-vertical 89 | # Make me leftmost 90 | bind C-b copy-mode -u # Scroll back 91 | bind b copy-mode -u # Scroll back 92 | bind / copy-mode \; send-keys -t :. '?' # Search up 93 | bind BSpace join-pane -t :- # Join to previous 94 | bind -r ^ swap-pane -U # Swap with previous 95 | bind -r v swap-pane -D # Swap with next 96 | bind > pipe-pane -o 'cat >> ~/tmux-#I-#P.log' \; display 'Logging on' 97 | bind < pipe-pane \; display 'Logging off' 98 | 99 | # Switch prefix key: S-F1 <-> C-a 100 | bind S run-shell "\ 101 | tmux show -g prefix | grep -q S-F1 && new_prefix=C-a || new_prefix=S-F1; \ 102 | tmux set -g prefix \$new_prefix; \ 103 | tmux unbind C-a; \ 104 | tmux unbind S-F1; \ 105 | tmux bind \$new_prefix last-window; \ 106 | tmux display \"prefix -> \$new_prefix\"" 107 | 108 | # Toggle synchronize-panes 109 | bind s run-shell "\ 110 | tmux show -w | grep -q synchronize-panes.*on && new_state=off || new_state=on; \ 111 | tmux setw synchronize-panes \$new_state >& /dev/null; \ 112 | tmux display \"synchronize-panes -> \$new_state\"" 113 | 114 | # Toggle mouse mode 115 | bind m run-shell "\ 116 | tmux show -g | grep -q 'mouse on' && new_state=off || new_state=on; \ 117 | tmux set -g mouse \$new_state >& /dev/null; \ 118 | tmux display \"mouse-> \$new_state\"" 119 | 120 | # vim:set ft=conf: 121 | -------------------------------------------------------------------------------- /vim/README.md: -------------------------------------------------------------------------------- 1 | # Vimrc 2 | 3 | You can manage your corp specific styles in a separate file. 4 | 5 | For example, your corporation uses 2-space indention for Python coding style, 6 | does that sound familiar? In this case put your customization in file 7 | `~/.vim/corp-styles.vim`. 8 | -------------------------------------------------------------------------------- /vim/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | readonly TARGET_PLUG_DIR=~/.vim/autoload/plug.vim 8 | 9 | cp -p $SELF_DIR/vimrc ~/.vimrc 10 | 11 | [[ -f $TARGET_PLUG_DIR ]] || { 12 | echo "Installing vim-plug to $TARGET_PLUG_DIR" 13 | curl -fksSLo $TARGET_PLUG_DIR --create-dirs \ 14 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 15 | } 16 | 17 | vim --version | grep -Fq "+lua" || { 18 | echo "*** Your vim doesn't support lua, highly recommended to" \ 19 | "install 'vim-nox' or rebuild to leverage neocomplete for" \ 20 | "auto completion, see https://github.com/Shougo/neocomplete.vim" >&2 21 | } 22 | 23 | type -P ag >& /dev/null || { 24 | echo "*** 'ag' is not installed, highly recommended to install for" \ 25 | "quick search, see https://github.com/ggreer/the_silver_searcher" >&2 26 | } 27 | 28 | readonly LOG_FILE="/tmp/vim-plug-install-$$.log" 29 | trap "rm -f $LOG_FILE" EXIT 30 | vim +PlugInstall +qall >& $LOG_FILE 31 | -------------------------------------------------------------------------------- /vim/vimrc: -------------------------------------------------------------------------------- 1 | " Matt Wang's vimrc, see more at https://github.com/ymattw/profiles 2 | 3 | " Plugins managed by https://github.com/junegunn/vim-plug 4 | " 5 | if empty(glob('~/.vim/autoload/plug.vim')) 6 | echomsg "*** vim-plug is missing, see https://github.com/junegunn/vim-plug" 7 | finish 8 | endif 9 | 10 | set nocompatible 11 | call plug#begin('~/.vim/plugged') 12 | 13 | " Put corp specific styles in separate private file 14 | if !filereadable(glob('~/.vim/corp-styles.vim')) 15 | Plug 'hynek/vim-python-pep8-indent', {'for': 'python'} 16 | endif 17 | 18 | " No vim-polyglot, which has poor performance 19 | Plug 'tpope/vim-markdown', {'for': 'markdown'} 20 | Plug 'godlygeek/tabular', {'for': 'markdown'} 21 | Plug 'digitaltoad/vim-jade', {'for': 'jade'} 22 | Plug 'moll/vim-node', {'for': 'javascript'} 23 | Plug 'fatih/vim-go', {'for': 'go'} 24 | Plug 'Valloric/MatchTagAlways', {'for': 'html'} 25 | Plug 'tpope/vim-commentary' " gcc, gc to toggle comments 26 | Plug 'tpope/vim-endwise' 27 | Plug 'ymattw/vim-fold-paragraph' " My own folding preference 28 | 29 | Plug 'elzr/vim-json', {'for': 'json'} 30 | let g:vim_json_syntax_conceal = 0 " Do not hide quotes 31 | 32 | Plug 'mileszs/ack.vim' 33 | let g:ackprg = 'ag --vimgrep --smart-case' 34 | let g:ackhighlight = 1 35 | cnoreabbrev Ag Ack! 36 | cnoreabbrev ag Ack! 37 | cnoreabbrev Af AckFile! 38 | cnoreabbrev af AckFile! 39 | 40 | " neocomplete can beat YouCompleteMe in both functionality and installation 41 | " friendly, it also replaces supertab and AutoComplPop. NOTE! to auto complete 42 | " in golang, install 'gocode' to work with 'vim-go'. For example run this from 43 | " command line: GOPATH=~ vim a.go +GoInstallBinaries +qall 44 | " 45 | if has('lua') 46 | Plug 'Shougo/neocomplete.vim' 47 | let g:neocomplete#enable_at_startup = 1 48 | let g:neocomplete#enable_smart_case = 1 49 | let g:neocomplete#min_keyword_length = 3 50 | let g:neocomplete#auto_completion_start_length = 1 51 | inoremap pumvisible() ? "\" : "\" " Tab completion 52 | else 53 | Plug 'ervandew/supertab' 54 | let g:SuperTabDefaultCompletionType = "context" 55 | let g:SuperTabContextDefaultCompletionType = "" 56 | let g:SuperTabNoCompleteAfter = 57 | \ ['^', '\s', '[^-]>', "'", '[~`!@#$%^&*()+={},= 7.3.541 only 102 | set wildmode=list:full " Misc: complete and list matched files 103 | set isfname-== " Misc: '=' is not part of filename 104 | set matchpairs+=<:> " Misc: '%' can match <> pair in html 105 | set smarttab shiftround shiftwidth=4 " Tab: default behaviour 106 | set expandtab softtabstop=4 tabstop=8 " Tab: default to 4-space soft tab 107 | set smartindent autoindent copyindent " Indenting 108 | set spelllang=en_us complete+=kspell " Spell completion, see imap 109 | set completeopt=menuone " Auto completion menu 110 | set synmaxcol=128 lazyredraw ttyfast " Performance 111 | syntax sync minlines=50 maxlines=200 " Performance 112 | silent! set nowildignorecase " Vim >= 7.3.072 only 113 | silent! set nofileignorecase " Vim >= 7.3.872 only 114 | silent! set nofoldenable " Default off, often n/a in containder 115 | silent! set foldmethod=manual " Work with ymattw/vim-fold-paragraph 116 | 117 | " Highlight invisible chars and trailing spaces, also displays extend and 118 | " precede chars for nowrap mode. Poor Windows users: switch to Mac/Linux or 119 | " use alternate chars such as >, _, . instead (:h dig to see more) 120 | " 121 | set list listchars=tab:▸\ ,trail:▌,extends:»,precedes:« 122 | 123 | " File type detect 124 | " 125 | autocmd! BufEnter *[Mm]akefile*,[Mm]ake.*,*.mak,*.make setlocal filetype=make 126 | autocmd! BufEnter *.md,*.markdown setlocal filetype=markdown spell 127 | autocmd! BufEnter Gemfile,Berksfile,Thorfile,Vagrantfile setlocal filetype=ruby 128 | 129 | " File type tab size 130 | " 131 | autocmd! FileType html,css,ruby,eruby,yaml,json,javascript,jade 132 | \ setlocal expandtab softtabstop=2 shiftwidth=2 133 | autocmd! FileType make setlocal noexpandtab shiftwidth=8 134 | autocmd! FileType go setlocal noexpandtab shiftwidth=8 nolist 135 | autocmd! FileType gitcommit setlocal textwidth=72 spell 136 | 137 | " Better color for matched parenthesis 138 | highlight! MatchParen cterm=underline ctermfg=7 ctermbg=0 139 | 140 | " Better color for folded text (treat as comment) 141 | highlight! Folded cterm=bold ctermfg=10 ctermbg=0 142 | 143 | " Better color for Solarized theme in diff mode 144 | " 145 | highlight! DiffDelete ctermfg=10 ctermbg=0 146 | highlight! DiffAdd cterm=bold ctermfg=70 ctermbg=0 147 | highlight! DiffChange cterm=bold ctermfg=142 ctermbg=0 148 | highlight! DiffText cterm=underline ctermfg=142 ctermbg=0 149 | 150 | " More colors suitable for Solarized dark background 151 | " 152 | highlight! link ColorColumn Search 153 | highlight! link CharAtCol80 WarningMsg 154 | highlight! link SpecialChars ErrorMsg 155 | match CharAtCol80 /\%80v/ " Mark char at column 80 in red 156 | 2match SpecialChars /\%xa0\|[“”‘’—]/ " nbsp & smartly replaced chars 157 | 158 | " Powerful statusline, underlined status line looks better with cursor line 159 | " 160 | set noruler laststatus=2 " Always show status line 161 | set stl= " Reset 162 | set stl+=\ %0*%n%* " Buffer number 163 | set stl+=\ %0*%f%* " Short pathname 164 | set stl+=\ %3*%m%* " Modified flag 165 | set stl+=\ %3*%r%* " Readonly flag 166 | set stl+=\ %1*[%{&ft}]%* " File type 167 | set stl+=\ %1*%{&enc}%* " File encoding 168 | set stl+=\ %3*%{&ff=='dos'?'dos':''}%* " Dos format flag 169 | set stl+=\ %3*%{&ic?'ic':'noic'}%* " Ignorecase flag 170 | set stl+=\ %3*%{&et?'et:'.&sts:'noet:'.&ts}%* " Expandtab and (soft)tabstop 171 | set stl+=\ %2*%{&hls?'hls':''}%* " Highlight search flag 172 | set stl+=\ %2*%{&list?'list':''}%* " List mode flag 173 | set stl+=\ %3*%{&paste?'paste':''}%* " Paste mode flag 174 | set stl+=\ %0*%=%* " Start to align right 175 | set stl+=\ %0*%4l,%-2v%* " Line and column info 176 | set stl+=\ %0*%3p%%%* " Line percentage 177 | highlight! User1 cterm=underline ctermfg=white 178 | \ gui=underline guibg=#ccc6b3 guifg=#fdf6e3 179 | highlight! User2 cterm=underline ctermfg=magenta 180 | \ gui=underline guibg=#ccc6b3 guifg=magenta 181 | highlight! User3 cterm=underline ctermfg=red ctermbg=0 182 | \ gui=underline guibg=#ccc6b3 guifg=red 183 | highlight! StatusLine cterm=underline ctermfg=blue 184 | \ gui=underline guibg=#ccc6b3 185 | highlight! StatusLineNC cterm=underline ctermfg=grey 186 | \ gui=underline guibg=#eee8d5 187 | 188 | " Global key maps. Make sure and are different in terminal setting! 189 | " 190 | let mapleader = ' ' 191 | 192 | " Maps for normal mode 193 | nnoremap :set spell!| " Toggle spell 194 | nnoremap :set ic!| " Toggle ignore case 195 | nnoremap | " Avoid accidental edit 196 | nnoremap :nohlsearch| " Stop highlight search temporarily 197 | nnoremap w| " Cycle to next window 198 | nnoremap :%s/[ \t]\+$//| " Remove trailing blank 199 | nnoremap :set nu!| " Ctrl-n to toggle :set number 200 | nnoremap :set paste!| " Ctrl-p to toggle paste mode 201 | nnoremap :vsp :exec("tag ".expand("")) 202 | " Ctrl-\ to open tag in vsplit 203 | nnoremap - :call ToggleFoldParagraph()| 204 | nnoremap _ :silent! set cursorline! 205 | nnoremap \| :silent! set cursorcolumn! 206 | nnoremap q: :q| " q: is boring 207 | nnoremap !! :q!| " Quit without saving 208 | nnoremap Q gqip| " Format current paragraph 209 | nnoremap qq :q| " Quickly close current window 210 | nnoremap qa :qa| " Quickly close all windows 211 | nnoremap \| :call ToggleColorColumn() 212 | nnoremap 2 :set et sts=2 sw=2| " Use 2-space indent 213 | nnoremap 4 :set et sts=4 sw=4| " Use 4-space indent 214 | nnoremap d :cd %:h:pwd| " Switch to dir of current file 215 | nnoremap - :cd -:pwd| " Switch back to previous dir 216 | nnoremap e :tabedit | " Quick tabedit new file 217 | nnoremap f gf| " Open file under cursor in new tab 218 | nnoremap h :tabprevious| " Preserved for tabs 219 | nnoremap l :tabnext| " Use to cycle in vsplits 220 | nnoremap p "+p| " Paste below from system clipboard 221 | nnoremap P "+P| " Paste above from system clipboard 222 | nnoremap q :qall| " Quickly quit vim 223 | nnoremap r :call RunMe()| " Run current file 224 | nnoremap s :Ack! -w | " Quick search word under cursor 225 | nnoremap t T| " Open tag in new tab 226 | nnoremap w :w| " Save 2 key strokes 227 | nnoremap :set wrap! 228 | nnoremap :set list! 229 | nnoremap :call ToggleTab() 230 | 231 | " Maps for insert mode 232 | inoremap kJA| " Join to prev line (undo auto wrap) 233 | inoremap I| " Emacs style Home 234 | inoremap A| " Emacs style End 235 | inoremap | " Complete filename 236 | inoremap | " Complete spell from words 237 | 238 | " Maps for visual mode 239 | vnoremap y "+y| " Yank (copy) to system clipboard 240 | vnoremap x "+d| " Cut (delete) to system clipboard 241 | 242 | " Maps for command mode 243 | cnoremap w!! w !sudo tee % > /dev/null 244 | 245 | " File type key mappings. (NOTE! Do not use autocmd! as it overwrites previous 246 | " definitions) 247 | " 248 | autocmd FileType markdown nnoremap T 249 | \ vip:Tabularize /\|| " Tabularize markdown tables 250 | autocmd Filetype html nnoremap % 251 | \ :MtaJumpToOtherTag| " See MatchTagAlways 252 | autocmd FileType go nnoremap t 253 | \ (go-def-tab) " Open definition in new tab 254 | 255 | " Mode key mappings 256 | " 257 | if exists('&diff') && &diff 258 | nnoremap qq :qa| " Close all windows 259 | nnoremap [c| " Previous change 260 | nnoremap ]c| " Next change 261 | nnoremap h| " Left window 262 | nnoremap l| " Right window 263 | nnoremap :diffupdate| " Refresh diff 264 | else 265 | nnoremap k| " Upper window 266 | nnoremap j| " Bottom window 267 | nnoremap :tabprevious| " Left & right preserved for tabs 268 | nnoremap :tabnext| " Use to cycle in vsplits 269 | endif 270 | 271 | " Misc 272 | " 273 | let python_highlight_all = 1 274 | 275 | autocmd VimResized * :wincmd = " Realign vim window size 276 | autocmd InsertLeave * set nopaste " Saves a 277 | 278 | " Remember last cursor postion, :h last-position-jump 279 | set viminfo='10,\"10,<50,s10,%,h,f10 280 | autocmd! BufReadPost * 281 | \ if line("'\"") > 0 && line("'\"") <= line("$") | 282 | \ exe "normal! g`\"" | 283 | \ endif 284 | 285 | if exists('&cursorline') 286 | set cursorline 287 | augroup ActiveBuffer 288 | autocmd! WinEnter * setlocal cursorline 289 | autocmd! WinLeave * setlocal nocursorline 290 | augroup END 291 | endif 292 | 293 | " 'R' to run a shell command and load output in a scratch buffer 294 | command! -nargs=* -complete=shellcmd R new 295 | \ | setlocal buftype=nofile bufhidden=hide 296 | \ | r ! 297 | 298 | " Helper functions 299 | " 300 | function! ToggleTab() 301 | let expr = &et == 1 ? "setl noet sw=8" : "setl et sw=".&sts 302 | exe expr 303 | endfunction 304 | 305 | function! ToggleColorColumn() 306 | let expr = &cc == "" ? "setl cc=+1" : "setl cc=" 307 | exe expr 308 | endfunction 309 | 310 | " Execute current file and pipe output to new scratch window below, window 311 | " height will be 1/3 of the vim window size 312 | " 313 | function! RunMe() 314 | let file = expand("%:p") 315 | let line = getline(1) 316 | 317 | exe "botright " . (&lines / 3) . " new" 318 | \ | setlocal buftype=nofile bufhidden=hide 319 | 320 | if line =~ "^#!" 321 | let intepreter = line[2:] 322 | elseif file =~ '\.sh\|\.bash' 323 | let intepreter = "bash" 324 | elseif file =~ '\.py' 325 | let intepreter = "python" 326 | elseif file =~ '\.rb' 327 | let intepreter = "ruby" 328 | elseif file =~ '\.js' 329 | let intepreter = "node" 330 | elseif file =~ '\.go' 331 | let intepreter = "go run" 332 | elseif file =~ '\.pl' 333 | let intepreter = "perl" 334 | else 335 | let intepreter = "" 336 | endif 337 | 338 | exe ".!" . intepreter . " " . file 339 | endfunction 340 | 341 | if filereadable(glob('~/.vim/corp-styles.vim')) 342 | source ~/.vim/corp-styles.vim 343 | endif 344 | 345 | " EOF 346 | -------------------------------------------------------------------------------- /zsh/README.md: -------------------------------------------------------------------------------- 1 | # Zsh Profile 2 | 3 | Just run `./install.sh` to install it as `~/.zshrc`. You can put your own 4 | customization under `~/.profiles.d` dir (shared by both my zsh profiles and 5 | bash profiles). See also `../profiles.d-examples`. 6 | -------------------------------------------------------------------------------- /zsh/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | readonly SELF_DIR=$(cd $(dirname $0) && pwd) 7 | readonly BACKUP_DIR=~/.zsh.backup 8 | readonly ZSH_FILES=(~/.zshenv ~/.zprofile ~/.zshrc ~/.zlogin) 9 | readonly ZSH_COMPLETION_DIR=~/.zsh-completions 10 | 11 | mkdir -p $BACKUP_DIR 12 | for x in ${ZSH_FILES[@]}; do 13 | [[ ! -f $x ]] || cp $x $BACKUP_DIR/ 14 | done 15 | 16 | rm -f ${ZSH_FILES[@]} 17 | 18 | cp $SELF_DIR/zshrc ~/.zshrc 19 | 20 | [[ -d $ZSH_COMPLETION_DIR ]] || { 21 | git clone https://github.com/zsh-users/zsh-completions.git $ZSH_COMPLETION_DIR 22 | } 23 | -------------------------------------------------------------------------------- /zsh/zshrc: -------------------------------------------------------------------------------- 1 | # Matt Wang's zsh profile for general Linux/Unix 2 | # 3 | # Implementation notes: 4 | # 5 | # - Functions with name starts with '__' are considered 'private' and will be 6 | # unset at the end. 7 | # - Functions with name starts with only one '_' are considered 'protected', 8 | # users can implement their own to override (via ~/.profiles.d). 9 | 10 | # Find a file which name matches given pattern (ERE, case insensitive) 11 | function f 12 | { 13 | local pat=${1?'Usage: f ERE-pattern [path...]'} 14 | shift 15 | find ${@:-.} \( -path '*/.svn' -o -path '*/.git' -o -path '*/.idea' \) \ 16 | -prune -o -print -follow | grep -iE "$pat" 17 | } 18 | 19 | # Load file list generated by f() in vim, type 'gf' to jump to the file 20 | function vif 21 | { 22 | local tmpf=/tmp/viftmpfile.$RANDOM$$ 23 | f "$@" > $tmpf && vi -c "/$1" $tmpf && rm -f $tmpf 24 | } 25 | 26 | # "Protected" helper to decorate CWD used to setup PROMPT 27 | function _source_control_cwd 28 | { 29 | [[ $PWD != ${HOME}* ]] || { echo ${PWD/$HOME/\~}; return 0; } 30 | echo $PWD 31 | } 32 | 33 | # "Protected" helper to decorate source control information used to setup 34 | # PROMPT, by default this only detect active git branch information. User can 35 | # extend this to detect other version control system. 36 | # 37 | function _source_control_info 38 | { 39 | if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) == true ]]; then 40 | _git_active_branch 41 | fi 42 | } 43 | 44 | function _git_active_branch 45 | { 46 | local branch info age track 47 | 48 | branch=$(git symbolic-ref HEAD 2>/dev/null) 49 | branch=${branch#refs/heads/} 50 | info=$(git status -s 2>/dev/null) 51 | age=$(git log --pretty=format:'%cr' -1 refs/heads/$branch 2>/dev/null) 52 | track=$(git status -sb 2>/dev/null | sed -n 's/^##.*\[\(.*\)\].*/, \1/p') 53 | 54 | # XXX: $_DR and $_DG won't expand here 55 | if [[ -z $info ]]; then 56 | print -nP "%{\e[32m%}" 57 | elif [[ -z $(echo "$info" | grep -v '^??') ]]; then 58 | print -nP "%{\e[35m%}" 59 | else 60 | print -nP "%{\e[31m%}" 61 | fi 62 | 63 | print -n " ($branch) " # No '-P' which does command expansion 64 | print -nP "%{\e[36m%}[${age}${track}]" 65 | } 66 | 67 | function __main 68 | { 69 | local fn 70 | 71 | for fn in \ 72 | __init_completion \ 73 | __setup_path \ 74 | __setup_shell_options \ 75 | __setup_environments \ 76 | __setup_aliases \ 77 | __setup_completions \ 78 | __setup_dir_colors \ 79 | __setup_ssh_agent \ 80 | __setup_prompt \ 81 | __setup_custom_profiles \ 82 | ; do 83 | $fn; unset -f $fn 84 | done 85 | } 86 | 87 | function __init_completion 88 | { 89 | [[ ! -d ~/.zsh-completions ]] || fpath=(~/.zsh-completions/src $fpath) 90 | autoload -U compinit && compinit 91 | } 92 | 93 | function __prepend_path 94 | { 95 | [[ :$PATH: == *:${1:?}:* ]] || PATH=$1:$PATH 96 | } 97 | 98 | function __setup_path 99 | { 100 | local x 101 | 102 | # prepend paths 103 | for x in /sbin /usr/sbin /bin /usr/bin /usr/local/bin; do 104 | __prepend_path $x 105 | done 106 | 107 | # ~/bin takes precedence 108 | __prepend_path ~/bin 109 | 110 | export PATH 111 | } 112 | 113 | function __setup_shell_options 114 | { 115 | set -o shwordsplit # ARG="foo bar"; $ARG => "foo" "bar" 116 | setopt prompt_subst 117 | setopt interactive_comments 118 | setopt nocase_glob 119 | setopt nocase_match 2>/dev/null # does not work for zsh < 4.3 120 | setopt extended_history 121 | setopt hist_expire_dups_first 122 | setopt hist_ignore_dups 123 | setopt hist_ignore_space 124 | setopt hist_find_no_dups 125 | setopt hist_verify 126 | setopt share_history 127 | setopt auto_pushd 128 | setopt pushd_ignore_dups 129 | unsetopt nomatch 130 | unsetopt correct 131 | bindkey -e # Reclaim C-a, C-e, C-r, M-., etc. 132 | ! test -t 0 || stty stop undef # Make 'C-s' to do fwd-i-search 133 | bindkey "^U" backward-kill-line # Keep the same behavior as in bash 134 | } 135 | 136 | function __setup_environments 137 | { 138 | export HISTFILE=~/.zhistory # Prevent from ~/.zsh completion 139 | export HISTSIZE=10000 140 | export SAVEHIST=10000 141 | export EDITOR=vim 142 | 143 | # Locale (LC_*) matters for ls and sort on Linux, see also 144 | # www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021 145 | # 146 | [[ $(uname -s) != Linux ]] || export LC_COLLATE=C 147 | } 148 | 149 | function __setup_completions 150 | { 151 | zstyle ':completion:*' menu yes select 152 | zstyle ':completion:*' users off 153 | zmodload zsh/complist 154 | bindkey -M menuselect '^M' .accept-line # only once to accept 155 | ZLE_REMOVE_SUFFIX_CHARS= # no space after, zshparam(1) 156 | 157 | # Fix default host completion 158 | __hosts=($(sed -ne 's/[, ].*//p' ~/.ssh/known_hosts* 2>/dev/null)) 159 | zstyle ':completion:*:hosts' hosts $__hosts 160 | } 161 | 162 | function __setup_aliases 163 | { 164 | local lsprog="/bin/ls" 165 | 166 | alias ..='cd ..' 167 | alias ...='cd ../..' 168 | alias ....='cd ../../..' 169 | alias .....='cd ../../../..' 170 | # Skip system wide vimrc to reduce startup time 171 | ! type vim >& /dev/null || alias vi='vim -Xn -u ~/.vimrc' 172 | ! type ag >& /dev/null || alias ag='command ag --nogroup' 173 | alias grep='grep --color=auto' 174 | 175 | case $(uname -s) in 176 | Linux) 177 | lsprog="/bin/ls --color=auto" 178 | alias ls="$lsprog -F" 179 | alias l="$lsprog -lF" 180 | alias lsps='ps -ef f | grep -vw grep | grep -i' 181 | ;; 182 | Darwin) 183 | type gls >& /dev/null && lsprog="gls --color=auto" 184 | alias ls="$lsprog -F" 185 | alias l="$lsprog -lF" 186 | alias lsps='ps -ax -o user,pid,ppid,stime,tty,time,command | grep -vw grep | grep -i' 187 | ;; 188 | *) 189 | alias ls="$lsprog -F" 190 | alias l="$lsprog -lF" 191 | alias lsps='ps -auf | grep -vw grep | grep -i' 192 | ;; 193 | esac 194 | } 195 | 196 | function __setup_dir_colors 197 | { 198 | local prog=dircolors 199 | 200 | [[ $(uname -s) != Darwin ]] || prog=gdircolors 201 | if type $prog >& /dev/null && [[ -f ~/.dircolors ]]; then 202 | eval $($prog -b ~/.dircolors) 203 | fi 204 | } 205 | 206 | function __has_ssh_key 207 | { 208 | [[ -f ~/.ssh/$USER.key ]] || ls ~/.ssh/id_?sa >& /dev/null 209 | } 210 | 211 | function __load_ssh_key 212 | { 213 | [[ ! -f "${1:?}" ]] || ssh-add -L | grep -qw "$1" || ssh-add "$1" 214 | } 215 | 216 | # ssh-add -l exits code 2 when unable to connect to the agent 217 | function __setup_ssh_agent 218 | { 219 | local rc=~/.ssh-agent.rc 220 | 221 | # Skip in typical corporation environment 222 | [[ -z $SK_SIGNING_PLUGIN ]] || return 0 223 | 224 | __has_ssh_key || return 0 225 | [[ ! -f $rc ]] || source $rc 226 | if [[ $(ssh-add -l >& /dev/null; echo $?) == 2 ]]; then 227 | print -P "%{\e[31m%}Starting a new ssh-agent process...%{\e[0m%}" >&2 228 | rm -f ~/.ssh-agent.sock 229 | ssh-agent -s -a ~/.ssh-agent.sock | sed '/^echo/d' > $rc 230 | source $rc 231 | fi 232 | 233 | __load_ssh_key ~/.ssh/$USER.key 234 | __load_ssh_key ~/.ssh/id_rsa 235 | __load_ssh_key ~/.ssh/id_dsa 236 | } 237 | 238 | # Fancy PROMPT, prompt exit status of last command, currenet time, hostname, 239 | # time, cwd, git status and branch, also prompt the '%' in reverse color when 240 | # we have background jobs. 241 | # 242 | function __setup_prompt 243 | { 244 | local _DR=$'%{\e[31m%}' # red 245 | local _DG=$'%{\e[32m%}' # green 246 | local _DY=$'%{\e[33m%}' # yellow 247 | local _DB=$'%{\e[34m%}' # blue 248 | local _DM=$'%{\e[35m%}' # magenta 249 | local _DC=$'%{\e[36m%}' # cyan 250 | local _RV=$'%{\e[7m%}' # reverse 251 | local _NC=$'%{\e[0m%}' # reset color 252 | 253 | PROMPT="\$([[ \$? == 0 ]] && echo '${_DG}✔' || echo '${_DR}✘') %* " 254 | 255 | # Detect whether this box has ssh keys, distinguish hostname color and setup 256 | # ssh-agent related environment accordingly 257 | # 258 | if __has_ssh_key; then 259 | # I am on my own machine, try load ssh-agent related environments 260 | PROMPT+="${_DB}" # blue hostname 261 | else 262 | # Otherwise assume I am on other's box, highlight hostname in magenta 263 | PROMPT+="${_DM}" # magenta hostname 264 | fi 265 | 266 | # Highlight hostname in reverse green if inside a container 267 | if [[ -n $container_uuid ]] || [[ -f /.dockerenv ]]; then 268 | PROMPT+="${_RV}${_DG}" 269 | fi 270 | PROMPT+="$(hostname -f | cut -d. -f1-2)" # 2 hostname components 271 | PROMPT+="${_NC}:${_DY}\$(_source_control_cwd)" # yellow cwd 272 | PROMPT+="${_NC}\$(_source_control_info)" # source control info 273 | PROMPT+=" ${_DC}"$'⤾\n' # cyan wrap char, NL 274 | PROMPT+="\$([[ -z \$(jobs) ]] || echo '${_RV}')" # reverse bg job 275 | PROMPT+="%#${_NC} " # % or # 276 | } 277 | 278 | # Load custom settings from ~/.profile.d/*.sh, typical settings are 279 | # docker-machine env, GOPATH, customized PATH etc. 280 | # 281 | function __setup_custom_profiles 282 | { 283 | local p 284 | 285 | ls ~/.profiles.d/*.sh >& /dev/null || return 0 286 | 287 | for p in ~/.profiles.d/*.sh; do 288 | source $p 289 | done 290 | } 291 | 292 | ######################################################################## 293 | # Setup everything and unset the rest "private" functions 294 | ######################################################################## 295 | 296 | __main 297 | unset -f __prepend_path __has_ssh_key __load_ssh_key __main 298 | 299 | # vim:set et sts=4 sw=4 ft=zsh: 300 | --------------------------------------------------------------------------------