├── local ├── colordiff │ ├── TODO │ ├── CHANGES │ ├── BUGS │ ├── cdiff.1 │ ├── colordiffrc │ ├── colordiffrc-lightbg │ ├── INSTALL │ ├── cdiff.xml │ ├── Makefile │ ├── cdiff.sh │ ├── README │ ├── colordiff.1 │ └── colordiff.xml ├── sendEmail │ ├── README-BR.txt │ ├── TODO │ └── README └── bin │ ├── svn-df.sh │ ├── ssh-git.sh │ ├── gen-rsa-pem.sh │ ├── url.php │ ├── find-ghost.sh │ ├── git-log-stat.sh │ ├── prog-jpg │ ├── json-decode │ ├── gitinfo.sh │ ├── curl-head.php │ ├── git.sh │ ├── delete-forever.sh │ ├── ip-query │ ├── clear-git-branch.sh │ ├── transform.sh │ ├── ipcn │ ├── php-fpm.sh │ ├── ssh-copy-id.sh │ ├── redisd │ ├── memcached.sh │ └── nginx.sh ├── .vim ├── ftplugin │ ├── go │ │ └── gocomplete.vim │ └── html_snip_helper.vim ├── template │ ├── phpconfig.php │ ├── shconfig.sh │ └── cconfig.c ├── snippets │ ├── snippet.snippets │ ├── _.snippets │ ├── sh.snippets │ ├── vim.snippets │ ├── cpp.snippets │ ├── mako.snippets │ ├── zsh.snippets │ ├── autoit.snippets │ ├── java.snippets │ ├── javascript.snippets │ ├── tcl.snippets │ ├── perl.snippets │ ├── python.snippets │ ├── tex.snippets │ ├── c.snippets │ ├── objc.snippets │ ├── php.snippets │ └── html.snippets ├── after │ ├── syntax │ │ └── sh │ │ │ └── awkembed.vim │ └── plugin │ │ └── snipMate.vim ├── syntax │ ├── snippet.vim │ ├── toml.vim │ ├── json.vim │ ├── nerdtree.vim │ ├── mkd.vim │ └── swift.vim ├── filetype.vim ├── nerdtree_plugin │ ├── exec_menuitem.vim │ └── fs_menu.vim ├── plugin │ ├── sudo.vim │ └── snipMate.vim ├── tools │ ├── css │ │ └── css.attr │ ├── python │ │ ├── python_pydiction.vim │ │ └── pydiction.py │ └── js │ │ └── javascript.dict └── autoload │ └── gocomplete.vim ├── .gitmodules ├── ssh-config ├── .inputrc ├── .bash_profile ├── op-tools ├── stat-nginx-log.sh ├── clear-redis.sh ├── nginx-logrotate.sh ├── rebuild-db.sh ├── install-prometheus-node_exporter.sh └── init-sys.sh ├── install.sh ├── share ├── gencert.sh └── IPTool.php ├── README.md ├── .gitignore ├── .gitconfig ├── .ctags ├── .vimrc └── .bashrc /local/colordiff/TODO: -------------------------------------------------------------------------------- 1 | See BUGS :-) 2 | -------------------------------------------------------------------------------- /.vim/ftplugin/go/gocomplete.vim: -------------------------------------------------------------------------------- 1 | setlocal omnifunc=gocomplete#Complete 2 | -------------------------------------------------------------------------------- /local/colordiff/CHANGES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hy0kl/profile/HEAD/local/colordiff/CHANGES -------------------------------------------------------------------------------- /local/sendEmail/README-BR.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hy0kl/profile/HEAD/local/sendEmail/README-BR.txt -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".vim/bundle/Vundle.vim"] 2 | path = .vim/bundle/Vundle.vim 3 | url = https://github.com/VundleVim/Vundle.vim.git 4 | -------------------------------------------------------------------------------- /ssh-config: -------------------------------------------------------------------------------- 1 | Host * 2 | #IdentityFile ~/.ssh/%r@%h 3 | ControlMaster auto 4 | ControlPath /tmp/%r@%h:%p 5 | ServerAliveInterval 60 6 | ConnectTimeout 4h 7 | -------------------------------------------------------------------------------- /.vim/template/phpconfig.php: -------------------------------------------------------------------------------- 1 | 0) { 24 | print $0; 25 | } 26 | }' | sort | uniq | grep --color=yes $args #| grep -v grep 27 | # vim:set ts=4 sw=4 et fdm=marker: 28 | 29 | -------------------------------------------------------------------------------- /.vim/snippets/sh.snippets: -------------------------------------------------------------------------------- 1 | # #!/bin/bash 2 | snippet #! 3 | #!/bin/bash 4 | 5 | snippet if 6 | if [[ ${1:condition} ]]; then 7 | ${2:#statements} 8 | fi 9 | snippet elif 10 | elif [[ ${1:condition} ]]; then 11 | ${2:#statements} 12 | snippet for 13 | for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do 14 | ${3:#statements} 15 | done 16 | snippet wh 17 | while [[ ${1:condition} ]]; do 18 | ${2:#statements} 19 | done 20 | snippet until 21 | until [[ ${1:condition} ]]; do 22 | ${2:#statements} 23 | done 24 | snippet case 25 | case ${1:word} in 26 | ${2:pattern}) 27 | ${3};; 28 | esac 29 | -------------------------------------------------------------------------------- /.vim/after/syntax/sh/awkembed.vim: -------------------------------------------------------------------------------- 1 | " AWK Embedding: {{{1 2 | " ============== 3 | " Shamelessly ripped from aspperl.vim by Aaron Hope. 4 | if exists("b:current_syntax") 5 | unlet b:current_syntax 6 | endif 7 | syn include @AWKScript syntax/awk.vim 8 | syn region AWKScriptCode matchgroup=AWKCommand start=+[=\\]\@+ skip=+\\$+ end=+[=\\]\@/dev/null; then 14 | top_num=$2 15 | fi 16 | 17 | jq -r '.request_time,.request_uri' $log_file | awk ' 18 | BEGIN{ 19 | iter = ""; 20 | } 21 | { 22 | if (NR % 2 == 0) { 23 | print iter"\t"$1; 24 | } else { 25 | iter = $1; 26 | } 27 | } 28 | ' | sort -k 1 -nr | head -n $top_num 29 | 30 | # vim:set ts=4 sw=4 et fdm=marker: 31 | 32 | -------------------------------------------------------------------------------- /local/bin/git-log-stat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # @describe: git log 常用语排行榜 3 | # @author: Jerry Yang(hy0kle@gmail.com) 4 | 5 | #set -x 6 | #set -eu 7 | num=10 8 | if [ $# -gt 0 ] && [ "$1" -gt 0 ] 2>/dev/null; then 9 | num=$1 10 | fi 11 | 12 | git log --oneline --color=never | awk '{ 13 | hash_len = length($1); 14 | log_str = substr($0, hash_len + 2); 15 | sp_str = "Merge branch" 16 | sp_len = length(sp_str); 17 | if (length(log_str) > 0 && sp_str != substr(log_str, 1, sp_len)) { 18 | print(log_str); 19 | } 20 | }' | sort | uniq -c | sort -nr -k1 | head -n $num 21 | # vim:set ts=4 sw=4 et fdm=marker: 22 | 23 | -------------------------------------------------------------------------------- /.vim/snippets/vim.snippets: -------------------------------------------------------------------------------- 1 | snippet header 2 | " File: ${1:`expand('%:t')`} 3 | " Author: ${2:`g:snips_author`} 4 | " Description: ${3} 5 | ${4:" Last Modified: `strftime("%B %d, %Y")`} 6 | snippet guard 7 | if exists('${1:did_`Filename()`}') || &cp${2: || version < 700} 8 | finish 9 | endif 10 | let $1 = 1${3} 11 | snippet f 12 | fun ${1:function_name}(${2}) 13 | ${3:" code} 14 | endf 15 | snippet for 16 | for ${1:needle} in ${2:haystack} 17 | ${3:" code} 18 | endfor 19 | snippet wh 20 | while ${1:condition} 21 | ${2:" code} 22 | endw 23 | snippet if 24 | if ${1:condition} 25 | ${2:" code} 26 | endif 27 | snippet ife 28 | if ${1:condition} 29 | ${2} 30 | else 31 | ${3} 32 | endif 33 | -------------------------------------------------------------------------------- /local/bin/prog-jpg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | v; 4 | if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { 5 | char buf[1024]; 6 | while (size_t len = fread(buf, 1, sizeof(buf), $2)) 7 | v.insert(v.end(), buf, buf + len); 8 | fclose($2); 9 | }${3} 10 | # std::map 11 | snippet map 12 | std::map<${1:key}, ${2:value}> map${3}; 13 | # std::vector 14 | snippet vector 15 | std::vector<${1:char}> v${2}; 16 | # Namespace 17 | snippet ns 18 | namespace ${1:`Filename('', 'my')`} { 19 | ${2} 20 | } /* $1 */ 21 | # Class 22 | snippet cl 23 | class ${1:`Filename('$1_t', 'name')`} { 24 | public: 25 | $1 (${2:arguments}); 26 | virtual ~$1 (); 27 | 28 | private: 29 | ${3:/* data */} 30 | }; 31 | -------------------------------------------------------------------------------- /local/bin/gitinfo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #pushd . >/dev/null 4 | 5 | # Find base of git directory 6 | while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done 7 | 8 | # Show various information about this git directory 9 | if [ -d .git ]; then 10 | echo "== Remote URL: " 11 | git remote -v 12 | 13 | echo "== Remote Branches: " 14 | git branch -r 15 | echo 16 | echo "== Local Branches:" 17 | git branch 18 | echo 19 | echo "== Configuration (.git/config)" 20 | cat .git/config 21 | echo 22 | echo "== Most Recent Commit" 23 | git --no-pager log --max-count=1 24 | echo 25 | #echo "Type 'git log' for more commits, or 'git show' for full commit details." 26 | else 27 | echo "Not a git repository." 28 | fi 29 | 30 | -------------------------------------------------------------------------------- /op-tools/clear-redis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # @describe: 清理redis指定的keys 3 | 4 | keys="" 5 | db_num=0 6 | 7 | if [ $# -lt 1 ]; then 8 | echo "usage: $0 rds-keys-name [database-number]" 9 | echo "example: $0 test:cache* 8" 10 | exit 1 11 | fi 12 | 13 | keys=$1 14 | 15 | if [ $# -gt 1 ] && [ "$2" -gt 0 ] 2>/dev/null; then 16 | db_num=$2 17 | if [ "$db_num" -gt 15 ]; then 18 | echo "redis database number is out of range" 19 | exit 2 20 | fi 21 | fi 22 | 23 | # clear redis 24 | redis-cli -n $db_num keys "$keys" | awk '{print "\""$0"\""}' | xargs redis-cli -n $db_num del 25 | 26 | echo -n "'reids-cli -n $db_num del $keys' exec result is: " 27 | if [ $? != 0 ]; then 28 | echo "fail" 29 | else 30 | echo "success" 31 | fi 32 | 33 | -------------------------------------------------------------------------------- /local/bin/curl-head.php: -------------------------------------------------------------------------------- 1 | #!/Users/hy0kl/php/bin/php 2 | 1)) 7 | { 8 | echo "no input URL.\nusage: curl-head 'http://example.org'\n"; 9 | exit; 10 | } 11 | 12 | $url = $argv[1]; 13 | $ch = curl_init(); 14 | if (!$ch) 15 | { 16 | die("Couldn't initialize a cURL handle"); 17 | } 18 | // set some cURL options 19 | curl_setopt($ch, CURLOPT_URL, $url); 20 | curl_setopt($ch, CURLOPT_HEADER, 1); // 设置显示返回的http头 21 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // 设置执行时将结果集放入缓冲区 22 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 超时设置 23 | curl_setopt($ch, CURLOPT_NOBODY, true); 24 | curl_exec($ch); 25 | 26 | $info = curl_getinfo($ch); // 获取http头 27 | curl_close($ch); // close cURL handler 28 | 29 | print_r($info); 30 | -------------------------------------------------------------------------------- /local/bin/git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # @describe: 3 | # @author: Jerry Yang(hy0kle@gmail.com) 4 | 5 | #set -x 6 | # The MIT License (MIT) 7 | # Copyright (c) 2013 Alvin Abad 8 | 9 | if [ $# -eq 0 ]; then 10 | echo "Git wrapper script that can specify an ssh-key file 11 | Usage: 12 | git.sh -i ssh-key-file git-command 13 | " 14 | exit 1 15 | fi 16 | 17 | # remove temporary file on exit 18 | trap 'rm -f /tmp/.git_ssh.$$' 0 19 | 20 | if [ "$1" = "-i" ]; then 21 | SSH_KEY=$2; shift; shift 22 | echo "ssh -i $SSH_KEY \$@" > /tmp/.git_ssh.$$ 23 | chmod +x /tmp/.git_ssh.$$ 24 | export GIT_SSH=/tmp/.git_ssh.$$ 25 | fi 26 | 27 | # in case the git command is repeated 28 | [ "$1" = "git" ] && shift 29 | 30 | # Run the git command 31 | git "$@" 32 | # vim:set ts=4 sw=4 et fdm=marker: 33 | 34 | -------------------------------------------------------------------------------- /.vim/syntax/snippet.vim: -------------------------------------------------------------------------------- 1 | " Syntax highlighting for snippet files (used for snipMate.vim) 2 | " Hopefully this should make snippets a bit nicer to write! 3 | syn match snipComment '^#.*' 4 | syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand 5 | syn match tabStop '\$\d\+' 6 | syn match snipCommand '`.\{-}`' 7 | syn match snippet '^snippet.*' transparent contains=multiSnipText,snipKeyword 8 | syn match multiSnipText '\S\+ \zs.*' contained 9 | syn match snipKeyword '^snippet'me=s+8 contained 10 | syn match snipError "^[^#s\t].*$" 11 | 12 | hi link snipComment Comment 13 | hi link multiSnipText String 14 | hi link snipKeyword Keyword 15 | hi link snipComment Comment 16 | hi link placeHolder Special 17 | hi link tabStop Special 18 | hi link snipCommand String 19 | hi link snipError Error 20 | -------------------------------------------------------------------------------- /.vim/template/cconfig.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @describe: 3 | * @author: Jerry Yang(hy0kle@gmail.com) 4 | * */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | int main(int argc, char *argv[]) 31 | { 32 | 33 | return 0; 34 | } 35 | 36 | /* vim:set ft=c ts=4 sw=4 et fdm=marker: */ 37 | -------------------------------------------------------------------------------- /local/colordiff/cdiff.1: -------------------------------------------------------------------------------- 1 | .\" Title: cdiff 2 | .\" Author: 3 | .\" Generator: DocBook XSL Stylesheets v1.73.2 4 | .\" Date: 01/25/2009 5 | .\" Manual: 6 | .\" Source: 7 | .\" 8 | .TH "CDIFF" "1" "01/25/2009" "" "" 9 | .\" disable hyphenation 10 | .nh 11 | .\" disable justification (adjust text to left margin only) 12 | .ad l 13 | .SH "NAME" 14 | cdiff \- a wrapper tool for colordiff 15 | .SH "SYNOPSIS" 16 | .HP 6 17 | \fBcdiff\fR {\fIURL\fR} 18 | .SH "DESCRIPTION" 19 | .PP 20 | cdiff 21 | is a wrapper for colordiff and will add colour to a diff given in a URL, e\&.g\&. 22 | .sp 23 | .RS 4 24 | .nf 25 | cdiff http://some\&.url\&.com/foo/thing\&.patch 26 | .fi 27 | .RE 28 | .SH "SEE ALSO" 29 | .PP 30 | cdiff 31 | is part of the colordiff package, which should be consulted for further reference\&. 32 | -------------------------------------------------------------------------------- /.vim/filetype.vim: -------------------------------------------------------------------------------- 1 | " nginx 配置文件高亮地持 2 | "au BufRead,BufNewFile *.com,site/*.com,vhost/*.com,servers/*.com set ft=nginx 3 | au BufRead,BufNewFile */nginx/conf/* set ft=nginx 4 | "au BufRead,BufNewFile nginx.conf set ft=nginx 5 | 6 | " Markdown 7 | " @see: http://stackoverflow.com/questions/10964681/enabling-markdown-highlighting-in-vim 8 | au BufRead,BufNewFile *.md set filetype=markdown 9 | "au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown 10 | 11 | " JSON 语法 12 | au BufRead,BufNewFile *.json set filetype=json 13 | 14 | " go 语法高亮 15 | au BufRead,BufNewFile *.go set filetype=go 16 | 17 | " rust 语法高亮 18 | au BufRead,BufNewFile *.rs set filetype=rust 19 | 20 | " rust 项目toml配置文件高亮 21 | au BufRead,BufNewFile *.toml set filetype=toml 22 | 23 | " vue 24 | au BufRead,BufNewFile *.vue set filetype=html 25 | 26 | " swift 27 | au BufRead,BufNewFile *.swift set filetype=swift 28 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 安装个性化,智能化工作环境 4 | 5 | ## 检查依赖 6 | dependence="tree ctags vim" 7 | for dp in $dependence 8 | do 9 | which $dp 2>&1 > /dev/null 10 | if [ 0 != $? ] 11 | then 12 | echo "Lost dependence: $dp, please install it at first. Maybe try:" 13 | echo "sudo apt-get install $dependence" 14 | exit 1 15 | fi 16 | done 17 | 18 | # 安装 19 | date_str=$(date +"%Y.%m.%d") 20 | base_path=`pwd` 21 | file_list=".bash_profile .bashrc .vimrc .ctags .gitconfig .inputrc .vim" 22 | echo "[NOTICE] If the [$file_list] already exists, just backup them: *.bak.$date_str" 23 | for f in $file_list 24 | do 25 | check="$HOME/$f" 26 | source_file="$base_path/$f" 27 | if [ -a $check ] 28 | then 29 | mv "$check" "$check.bak.$date_str" 30 | fi 31 | ln -s "$source_file" "$check" 32 | done 33 | 34 | echo "[INFO] install success, please relogin, or use command:" 35 | echo ". ~/.bashrc" 36 | -------------------------------------------------------------------------------- /local/colordiff/colordiffrc: -------------------------------------------------------------------------------- 1 | # Example colordiffrc file for dark backgrounds 2 | # 3 | # Set banner=no to suppress authorship info at top of 4 | # colordiff output 5 | banner=no 6 | # By default, when colordiff output is being redirected 7 | # to a file, it detects this and does not colour-highlight 8 | # To make the patch file *include* colours, change the option 9 | # below to 'yes' 10 | color_patches=no 11 | # 12 | # available colours are: white, yellow, green, blue, 13 | # cyan, red, magenta, black, 14 | # darkwhite, darkyellow, darkgreen, 15 | # darkblue, darkcyan, darkred, 16 | # darkmagenta, darkblack 17 | # 18 | # Can also specify 'none', 'normal' or 'off' which are all 19 | # aliases for the same thing, namely "don't colour highlight 20 | # this, use the default output colour" 21 | # 22 | plain=off 23 | newtext=blue 24 | oldtext=red 25 | diffstuff=magenta 26 | cvsstuff=green 27 | -------------------------------------------------------------------------------- /local/colordiff/colordiffrc-lightbg: -------------------------------------------------------------------------------- 1 | # Example colordiffrc file for light backgrounds 2 | # 3 | # Set banner=no to suppress authorship info at top of 4 | # colordiff output 5 | banner=no 6 | # By default, when colordiff output is being redirected 7 | # to a file, it detects this and does not colour-highlight 8 | # To make the patch file *include* colours, change the option 9 | # below to 'yes' 10 | color_patches=no 11 | # 12 | # available colours are: white, yellow, green, blue, 13 | # cyan, red, magenta, black, 14 | # darkwhite, darkyellow, darkgreen, 15 | # darkblue, darkcyan, darkred, 16 | # darkmagenta, darkblack 17 | # 18 | # Can also specify 'none', 'normal' or 'off' which are all 19 | # aliases for the same thing, namely "don't colour highlight 20 | # this, use the default output colour" 21 | # 22 | plain=off 23 | newtext=blue 24 | oldtext=red 25 | diffstuff=darkgreen 26 | cvsstuff=darkmagenta 27 | -------------------------------------------------------------------------------- /.vim/snippets/mako.snippets: -------------------------------------------------------------------------------- 1 | snippet def 2 | <%def name="${1:name}"> 3 | ${2:} 4 | 5 | snippet call 6 | <%call expr="${1:name}"> 7 | ${2:} 8 | 9 | snippet doc 10 | <%doc> 11 | ${1:} 12 | 13 | snippet text 14 | <%text> 15 | ${1:} 16 | 17 | snippet for 18 | % for ${1:i} in ${2:iter}: 19 | ${3:} 20 | % endfor 21 | snippet if if 22 | % if ${1:condition}: 23 | ${2:} 24 | % endif 25 | snippet if if/else 26 | % if ${1:condition}: 27 | ${2:} 28 | % else: 29 | ${3:} 30 | % endif 31 | snippet try 32 | % try: 33 | ${1:} 34 | % except${2:}: 35 | ${3:pass} 36 | % endtry 37 | snippet wh 38 | % while ${1:}: 39 | ${2:} 40 | % endwhile 41 | snippet $ 42 | ${ ${1:} } 43 | snippet <% 44 | <% ${1:} %> 45 | snippet 47 | snippet inherit 48 | <%inherit file="${1:filename}" /> 49 | snippet include 50 | <%include file="${1:filename}" /> 51 | snippet namespace 52 | <%namespace file="${1:name}" /> 53 | snippet page 54 | <%page args="${1:}" /> 55 | -------------------------------------------------------------------------------- /local/bin/delete-forever.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # @describe: 永久从仓库删除文件,包括日志清除,无法再次恢复 3 | # @author: Jerry Yang(hy0kle@gmail.com) 4 | 5 | #set -x 6 | 7 | # terminal color 8 | red=$'\e[1;31m' 9 | green=$'\e[1;32m' 10 | yellow=$'\e[1;33m' 11 | blue=$'\e[1;34m' 12 | magenta=$'\e[1;35m' 13 | cyan=$'\e[1;36m' 14 | white=$'\e[1;37m' 15 | normal=$'\e[m' 16 | 17 | function usage() { 18 | echo "${cyan}Usage: ${green}$0 ${yellow}file1 [file2 ...]${normal}" 19 | } 20 | 21 | if [ $# -lt 1 ];then 22 | usage 23 | exit 1 24 | fi 25 | 26 | shift 0 27 | args=$* 28 | 29 | git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $args" HEAD && \ 30 | rm -rf .git/refs/original/ && \ 31 | git reflog expire --all && \ 32 | git gc --aggressive --prune && \ 33 | git filter-branch --prune-empty && \ 34 | rm -rf .git/refs/original/ 35 | 36 | if [ 0 == $? ] 37 | then 38 | echo "${magenta}delete files forever success.${normal}" 39 | else 40 | echo "${red}delete files forever fail!${normal}" 41 | fi 42 | 43 | # vim:set ts=4 sw=4 et fdm=marker: 44 | 45 | -------------------------------------------------------------------------------- /local/bin/ip-query: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 1) 10 | { 11 | $ip = $argv[1]; 12 | } 13 | 14 | // http://api.map.baidu.com/location/ip?ak=E4805d16520de693a3fe707cdc962045&ip=202.198.16.3&coor=bd09ll 15 | $timeout = 20; 16 | $bd_ip_query_api = 'http://api.map.baidu.com/location/ip?ak=%s&ip=%s'; 17 | $bd_ak = 'D9c22d71b68dceb1b57109324a4c45f7'; 18 | 19 | 20 | $url = sprintf($bd_ip_query_api, $bd_ak, $ip); 21 | 22 | $ch = curl_init(); 23 | 24 | curl_setopt($ch, CURLOPT_URL, $url); 25 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 以流式返回,而不是直接输出 26 | 27 | 28 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 29 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout - 10); 30 | 31 | $res = curl_exec($ch); 32 | 33 | $errno = curl_errno($ch); 34 | $msg = curl_error($ch); 35 | 36 | if (0 == $errno) 37 | { 38 | print_r(json_decode($res, true)); 39 | } 40 | else 41 | { 42 | echo "[ERROR] {$errno}: {$msg}" . PHP_EOL; 43 | } 44 | 45 | curl_close($ch); 46 | /* vi:set ts=4 sw=4 et fdm=marker: */ 47 | 48 | -------------------------------------------------------------------------------- /share/gencert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # from: https://github.com/michaelliao/itranswarp.js/blob/master/conf/ssl/gencert.sh 4 | 5 | # create self-signed server certificate: 6 | 7 | read -p "Enter your domain [www.example.com]: " DOMAIN 8 | 9 | echo "Create server key..." 10 | 11 | openssl genrsa -des3 -out $DOMAIN.key 1024 12 | 13 | echo "Create server certificate signing request..." 14 | 15 | SUBJECT="/C=US/ST=Mars/L=Pyramid/O=vipclub/OU=iTranswarp/CN=$DOMAIN/emailAddress=hy0kle@gmail.com" 16 | 17 | openssl req -new -subj $SUBJECT -key $DOMAIN.key -out $DOMAIN.csr 18 | 19 | echo "Remove password..." 20 | 21 | mv $DOMAIN.key $DOMAIN.origin.key 22 | openssl rsa -in $DOMAIN.origin.key -out $DOMAIN.key 23 | 24 | echo "Sign SSL certificate..." 25 | 26 | openssl x509 -req -days 3650 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt 27 | 28 | echo "TODO:" 29 | echo "Copy $DOMAIN.crt to nginx/conf/ssl/$DOMAIN.crt" 30 | echo "Copy $DOMAIN.key to nginx/conf/ssl/$DOMAIN.key" 31 | echo "Add configuration in nginx:" 32 | echo "server {" 33 | echo " ..." 34 | echo " listen 443 ssl;" 35 | echo " ssl_certificate nginx/conf/ssl/$DOMAIN.crt;" 36 | echo " ssl_certificate_key nginx/conf/ssl/$DOMAIN.key;" 37 | echo "}" 38 | -------------------------------------------------------------------------------- /.vim/snippets/zsh.snippets: -------------------------------------------------------------------------------- 1 | # #!/bin/zsh 2 | snippet #! 3 | #!/bin/zsh 4 | 5 | snippet if 6 | if ${1:condition}; then 7 | ${2:# statements} 8 | fi 9 | snippet ife 10 | if ${1:condition}; then 11 | ${2:# statements} 12 | else 13 | ${3:# statements} 14 | fi 15 | snippet elif 16 | elif ${1:condition} ; then 17 | ${2:# statements} 18 | snippet for 19 | for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do 20 | ${3:# statements} 21 | done 22 | snippet fore 23 | for ${1:item} in ${2:list}; do 24 | ${3:# statements} 25 | done 26 | snippet wh 27 | while ${1:condition}; do 28 | ${2:# statements} 29 | done 30 | snippet until 31 | until ${1:condition}; do 32 | ${2:# statements} 33 | done 34 | snippet repeat 35 | repeat ${1:integer}; do 36 | ${2:# statements} 37 | done 38 | snippet case 39 | case ${1:word} in 40 | ${2:pattern}) 41 | ${3};; 42 | esac 43 | snippet select 44 | select ${1:answer} in ${2:choices}; do 45 | ${3:# statements} 46 | done 47 | snippet ( 48 | ( ${1:#statements} ) 49 | snippet { 50 | { ${1:#statements} } 51 | snippet [ 52 | [[ ${1:test} ]] 53 | snippet always 54 | { ${1:try} } always { ${2:always} } 55 | snippet fun 56 | function ${1:name} (${2:args}) { 57 | ${3:# body} 58 | } 59 | -------------------------------------------------------------------------------- /.vim/after/plugin/snipMate.vim: -------------------------------------------------------------------------------- 1 | " These are the mappings for snipMate.vim. Putting it here ensures that it 2 | " will be mapped after other plugins such as supertab.vim. 3 | if !exists('loaded_snips') || exists('s:did_snips_mappings') 4 | finish 5 | endif 6 | let s:did_snips_mappings = 1 7 | 8 | ino =TriggerSnippet() 9 | snor i=TriggerSnippet() 10 | ino =BackwardsSnippet() 11 | snor i=BackwardsSnippet() 12 | ino =ShowAvailableSnips() 13 | 14 | " The default mappings for these are annoying & sometimes break snipMate. 15 | " You can change them back if you want, I've put them here for convenience. 16 | snor b 17 | snor a 18 | snor bi 19 | snor ' b' 20 | snor ` b` 21 | snor % b% 22 | snor U bU 23 | snor ^ b^ 24 | snor \ b\ 25 | snor b 26 | 27 | " By default load snippets in snippets_dir 28 | if empty(snippets_dir) 29 | finish 30 | endif 31 | 32 | call GetSnippets(snippets_dir, '_') " Get global snippets 33 | 34 | au FileType * if &ft != 'help' | call GetSnippets(snippets_dir, &ft) | endif 35 | " vim:noet:sw=4:ts=4:ft=vim 36 | -------------------------------------------------------------------------------- /op-tools/nginx-logrotate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # @describe: 切割nginx日志,linux 3 | 4 | #set -x 5 | top_dir="/work" 6 | nginx_prefix="$top_dir/service/nginx" 7 | dest_base_path="$top_dir/logs/nginx" 8 | 9 | yesterday=`date -d "yesterday" "+%s"` 10 | day=`date -d @"$yesterday" "+%d"` 11 | year=`date -d @"$yesterday" "+%Y"` 12 | month=`date -d @"$yesterday" "+%m"` 13 | date_str="$year$month$day" 14 | #echo $date_str 15 | 16 | echo "[`date +"%Y-%m-%d %H:%M:%S %Z"`] start logrotate" 17 | 18 | # 创建目标目录,以 YYYY/MM 来分开 19 | dest_path="$dest_base_path/$year/$month" 20 | if [ ! -d "$dest_path" ]; then 21 | mkdir -p "$dest_path" 22 | fi 23 | 24 | all_logs=`find $nginx_prefix/logs/ -name "*.log"` 25 | for log in $all_logs; do 26 | log_name=`echo $log | awk -F "/" '{print $NF}'` 27 | #echo $log 28 | #echo $log_name 29 | rotate_name="$dest_path/$log_name.$date_str" 30 | mv "$log" "$rotate_name" 31 | done 32 | sudo $nginx_prefix/sbin/nginx -s reopen 33 | echo "[`date +"%Y-%m-%d %H:%M:%S %Z"`] rotate finish" 34 | 35 | keep_days=7 36 | cd $dest_base_path && find ./ -type f -mtime +$keep_days -exec rm {} \; 37 | echo "[`date +"%Y-%m-%d %H:%M:%S %Z"`] delete data older than $keep_days days" 38 | 39 | # vim:set ts=4 sw=4 et fdm=marker: 40 | 41 | -------------------------------------------------------------------------------- /local/sendEmail/TODO: -------------------------------------------------------------------------------- 1 | Reported Bugs: 2 | [ ] But it seems that I can't send more than 16 or 17 KB from the STDIN on Windows (2003) with the EXE version. 3 | Even with -o message-file=... and got the same 17 KB message limitation. 4 | 5 | Feature Ideas 6 | [ ] A preferences file with default settings? 7 | [ ] Deliver directly to MX server for domain? 8 | [ ] Command line option requesting read-receipt 9 | X-Confirm-Reading-To: 10 | Disposition-Notification-To: 11 | Return-Receipt-To: 12 | [ ] Add support for CRAM-MD5 authentication 13 | [ ] Add a pair of options to add receipt on delivery and on read of sent emails 14 | [ ] Support for unicode (european) characters in the subject 15 | 16 | More Ideas: 17 | [ ] What about an option to send the same message more than once? 18 | [ ] How about a delay before sending the message? 19 | [ ] What about an internal queue for messages that wern't sent? 20 | Next time it's invoked it could deliver those messages as well. 21 | [ ] Convert inline documentation to standard perldoc format? 22 | [ ] Support for pop before smtp? 23 | 24 | Crazy Ideas (not so sure about): 25 | [ ] Preferences registry settings for the Windows .exe version? 26 | (several people have said No! use a flat file) 27 | 28 | -------------------------------------------------------------------------------- /local/bin/clear-git-branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # @describe: 清除2个月未更新的腐败分支 3 | # @author: Jerry Yang(hy0kle@gmail.com) 4 | 5 | #set -x 6 | 7 | os=$(uname) 8 | 9 | two_months_ago=$((3600 * 24 * 30 * 2)) 10 | current_time=`date +%s` 11 | 12 | git fetch -p 13 | 14 | all_branch="./all_branch.txt" 15 | git branch --all | awk '{ 16 | count = split($1, cntr, "/"); 17 | if (3 == count && "origin" == cntr[2] && "HEAD" != cntr[3] && "master" != cntr[3]) { 18 | print cntr[2] "/" cntr[3]; 19 | } 20 | }' > "$all_branch" 21 | 22 | for branch in `cat $all_branch` 23 | do 24 | last_time=`git log --date=raw --pretty=format:"%cd" $branch -1 | awk '{print $1}'` 25 | last_date_str=`git log --date=iso --pretty=format:"%cd" $branch -1 | awk '{print $1 " " $2}'` 26 | #echo "last_time: "$last_time 27 | #echo "$branch last_date_str: "$last_date_str 28 | diff_time=$((current_time - last_time)) 29 | #echo "diff_time: "$diff_time 30 | if ((diff_time > two_months_ago)) 31 | then 32 | echo "$branch 最后一次提交时间:[$last_date_str], 已经腐烂了" 33 | del_branch=`echo $branch | awk '{split($1, cntr, "/"); print cntr[2];}'` 34 | #cmd="git push origin --delete $del_branch" 35 | #echo $cmd 36 | git push origin --delete $del_branch 37 | fi 38 | done 39 | 40 | # 删除临时文件 41 | rm "$all_branch" 42 | # vim:set ts=4 sw=4 et fdm=marker: 43 | 44 | -------------------------------------------------------------------------------- /local/bin/transform.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # @author: Jerry Yang(hy0kle@gmail.com) 3 | # @describe: 批量将源代码格式化 4 | # 1. 将文件转为 Unix 风格 5 | # 2. 将 tab 替换成 4 个空格 6 | # 3. 删除行尾的空格 7 | # 批量有风险,操作需谨慎 8 | 9 | # CTRL + v + TAB 10 | # tab 的输入方法 11 | 12 | # windows 换行符的输入 13 | # ctrl + v ctrl + m 14 | 15 | #set -x 16 | work_path="" 17 | 18 | if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then 19 | echo "Usage: $0 \"ABS_PATH\"" >&2 20 | echo "default transfer file in(php tpl js css)" 21 | exit 1 22 | else 23 | work_path="$1" 24 | fi 25 | 26 | if [ -d "$work_path" ]; then 27 | echo "start jobs..." 28 | else 29 | echo "$work_path does not exist, please check it out." 30 | exit 2 31 | fi 32 | 33 | date_str=$(date +"%Y-%m-%d") 34 | transfer_file="php tpl js css html phtml" 35 | 36 | cd $work_path 37 | mkdir -p tmp 38 | 39 | for file_type in $transfer_file 40 | do 41 | tmp_file="tmp/$file_type.$date_str" 42 | find ./ -name "*.$file_type" > $tmp_file 43 | 44 | need=$(cat $tmp_file) 45 | for trans in $need 46 | do 47 | # 将文件转为 Unix 风格,有误伤,需要默认文件为 doc 风格 48 | #sed -i "" 's/.$//' $trans 49 | 50 | # 将文件转为 Unix 风格 51 | sed -i "" 's/ //g' $trans 52 | # 将 tab 替换成 4 个空格 53 | sed -i "" 's/ / /g' $trans 54 | # 删除行尾的空格 55 | sed -i "" 's/[ ]*$//g' $trans 56 | done 57 | done 58 | 59 | rm -rf tmp 60 | echo "transfer file jobs done." 61 | 62 | -------------------------------------------------------------------------------- /local/colordiff/INSTALL: -------------------------------------------------------------------------------- 1 | PREREQUISITES 2 | 3 | To use colordiff, you need Perl and an ANSI-colour enabled terminal. To 4 | install as per the instructions below, you also need GNU Make. 5 | 6 | INSTALLATION (Debian) 7 | 8 | All branches of Debian now include the colordiff package, so the easiest 9 | way to install is simply by doing: 10 | 11 | apt-get install colordiff 12 | 13 | You should then setup your colour preferences (see below). 14 | 15 | INSTALLATION (Other systems) 16 | 17 | 1. (Optional) Edit the Makefile to change the preferred installation 18 | locations - default is /usr/local/bin for the script itself, and /etc 19 | for the central colour configuration file. 20 | 21 | 2. As root, type 'make install'. If 'make' is unavailable, simply copy 22 | colordiff.pl to /usr/local/bin and colordiffrc to /etc by hand. 23 | 24 | 3. The central colour configuration file, by default /etc/colordiffrc is 25 | read by each instance of the script. User-specific settings can be 26 | enabled by copying this file to ~/.colordiffrc and making the 27 | appropriate changes. 28 | 29 | Note that by default, colordiff is configured to work in an environment 30 | where the default background is generally 'dark'. If you are using a 31 | light-coloured background, the default colours in colordiffrc won't work 32 | very well - in that case, manually copy the file colordiffrc-lightbg to 33 | either /etc/colordiffrc or ~/.colordiffrc as appropriate. 34 | 35 | # vim: tw=72 36 | -------------------------------------------------------------------------------- /op-tools/rebuild-db.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # @describe: 开发环境自动重建本地环境 3 | 4 | #set -x 5 | 6 | workspace=$(cd $(dirname $0) && pwd) 7 | cd $workspace 8 | 9 | db_name="work_dev" 10 | db_user="work" 11 | db_pwd="work@dev" 12 | 13 | mkdir -p backup 14 | 15 | function initDB() { 16 | echo "初始化中 init..." 17 | git pull origin master 18 | mysql -u"$db_user" -p"$db_pwd" $db_name < db/db-schema.sql 19 | echo "完成 init db completed" 20 | } 21 | 22 | function exportData() { 23 | echo "备份数据..." 24 | mysqldump -u"$db_user" -p"$db_pwd" -c --skip-add-locks --skip-comments --skip-disable-keys --insert-ignore -t $db_name > backup/$db_name.sql 25 | echo "备份数据完成" 26 | } 27 | 28 | function importData() { 29 | echo "导入备份数据" 30 | mysql -u"$db_user" -p"$db_pwd" $db_name < backup/$db_name.sql 31 | echo "导入备份数据完成" 32 | } 33 | 34 | function rebuild() { 35 | exportData 36 | 37 | echo "重新建库表" 38 | initDB 39 | echo "重建库表完成" 40 | 41 | importData 42 | } 43 | 44 | argc=$# 45 | if ((argc < 1)) 46 | then 47 | echo "$0 init|export|import|rebuild" 48 | exit 0 49 | fi 50 | 51 | cmd=$1 52 | if [ "$cmd" == "init" ] 53 | then 54 | initDB 55 | elif [ "$cmd" == "export" ] 56 | then 57 | exportData 58 | elif [ "$cmd" == "rebuild" ] 59 | then 60 | rebuild 61 | elif [ "$cmd" == "import" ] 62 | then 63 | importData 64 | else 65 | echo "$cmd no surport..." 66 | fi 67 | 68 | # vim:set ts=4 sw=4 et fdm=marker: 69 | 70 | -------------------------------------------------------------------------------- /.vim/snippets/autoit.snippets: -------------------------------------------------------------------------------- 1 | snippet if 2 | If ${1:condition} Then 3 | ${2:; True code} 4 | EndIf 5 | snippet el 6 | Else 7 | ${1} 8 | snippet elif 9 | ElseIf ${1:condition} Then 10 | ${2:; True code} 11 | # If/Else block 12 | snippet ifel 13 | If ${1:condition} Then 14 | ${2:; True code} 15 | Else 16 | ${3:; Else code} 17 | EndIf 18 | # If/ElseIf/Else block 19 | snippet ifelif 20 | If ${1:condition 1} Then 21 | ${2:; True code} 22 | ElseIf ${3:condition 2} Then 23 | ${4:; True code} 24 | Else 25 | ${5:; Else code} 26 | EndIf 27 | # Switch block 28 | snippet switch 29 | Switch (${1:condition}) 30 | Case {$2:case1}: 31 | {$3:; Case 1 code} 32 | Case Else: 33 | {$4:; Else code} 34 | EndSwitch 35 | # Select block 36 | snippet select 37 | Select (${1:condition}) 38 | Case {$2:case1}: 39 | {$3:; Case 1 code} 40 | Case Else: 41 | {$4:; Else code} 42 | EndSelect 43 | # While loop 44 | snippet while 45 | While (${1:condition}) 46 | ${2:; code...} 47 | WEnd 48 | # For loop 49 | snippet for 50 | For ${1:n} = ${3:1} to ${2:count} 51 | ${4:; code...} 52 | Next 53 | # New Function 54 | snippet func 55 | Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}): 56 | ${4:Return} 57 | EndFunc 58 | # Message box 59 | snippet msg 60 | MsgBox(${3:MsgType}, ${1:"Title"}, ${2:"Message Text"}) 61 | # Debug Message 62 | snippet debug 63 | MsgBox(0, "Debug", ${1:"Debug Message"}) 64 | # Show Variable Debug Message 65 | snippet showvar 66 | MsgBox(0, "${1:VarName}", $1) 67 | -------------------------------------------------------------------------------- /local/bin/ipcn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 1)) 10 | { 11 | echo "no input IP.\nUsage: {$argv[0]} 'IP'\n"; 12 | exit; 13 | } 14 | 15 | $url = sprintf($api, $argv[1]); 16 | 17 | $ch = curl_init(); 18 | curl_setopt($ch, CURLOPT_URL, $url); 19 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 以流式返回,而不是直接输出 20 | 21 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 22 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout - 10); 23 | 24 | $html = curl_exec($ch); 25 | 26 | $errno = curl_errno($ch); 27 | $msg = curl_error($ch); 28 | 29 | if (0 == $errno) 30 | { 31 | $ip_info = 'NOT find'; 32 | //echo $html; 33 | $find = 'id="result">'; 34 | $pos = strpos($html, $find); 35 | if (false !== $pos) { 36 | $slice = substr($html, $pos + strlen($find), 1024); 37 | $sub_find = ' 1) { 40 | $des_html = substr($slice, 0, $sub_pos - 1); 41 | //echo $des_html, PHP_EOL; 42 | $des_html = str_replace( 43 | array("\r", "\n", ' ',), 44 | array('', '', ' ',), 45 | $des_html); 46 | $ip_info = strip_tags($des_html); 47 | } 48 | } 49 | echo $ip_info, PHP_EOL; 50 | } 51 | else 52 | { 53 | echo "[ERROR] {$errno}: {$msg}" . PHP_EOL; 54 | } 55 | 56 | curl_close($ch); 57 | 58 | -------------------------------------------------------------------------------- /local/bin/php-fpm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Startup script for the PHP-FPM server. 4 | # 5 | # description: PHP is an HTML-embedded scripting language 6 | # processname: php-fpm 7 | # config: /usr/local/php/etc/php.ini 8 | 9 | # Source function library. 10 | #. /etc/rc.d/init.d/functions 11 | 12 | PHP_PATH=$HOME 13 | DESC="php-fpm daemon" 14 | NAME=php-fpm 15 | # php-fpm路径 16 | DAEMON=$PHP_PATH/php/sbin/$NAME 17 | # 配置文件路径 18 | CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf 19 | # PID文件路径(在php-fpm.conf设置) 20 | PIDFILE=$PHP_PATH/php/var/run/$NAME.pid 21 | SCRIPTNAME=$HOME/local/bin/$NAME 22 | 23 | # Gracefully exit if the package has been removed. 24 | test -x $DAEMON || exit 0 25 | 26 | rh_start() { 27 | $DAEMON -y $CONFIGFILE || echo -n " already running" 28 | } 29 | 30 | rh_stop() { 31 | kill -QUIT `cat $PIDFILE` || echo -n " not running" 32 | } 33 | 34 | rh_reload() { 35 | kill -HUP `cat $PIDFILE` || echo -n " can't reload" 36 | } 37 | 38 | case "$1" in 39 | start) 40 | echo -n "Starting $DESC: $NAME" 41 | rh_start 42 | echo "." 43 | ;; 44 | stop) 45 | echo -n "Stopping $DESC: $NAME" 46 | rh_stop 47 | echo "." 48 | ;; 49 | reload) 50 | echo -n "Reloading $DESC configuration..." 51 | rh_reload 52 | echo "reloaded." 53 | ;; 54 | restart) 55 | echo -n "Restarting $DESC: $NAME" 56 | rh_stop 57 | sleep 1 58 | rh_start 59 | echo "." 60 | ;; 61 | *) 62 | echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2 63 | exit 3 64 | ;; 65 | esac 66 | exit 0 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | profile 2 | ======= 3 | 4 | 高级智能化工作环境 5 | 6 | # 功能介绍 7 | 8 | - 智能历史命令快速查找 9 | - 各种命令行自动补全功能 10 | - ctags全能支持 11 | - 超强vim配置 12 | - nginx配置文件高亮 13 | - c/c++海量API高亮 14 | - awk脚本语法高亮 15 | - php/js/css/python/c系统函数/sql关键词/golang/rust自动补全 16 | - 记忆文件最后编辑位置 17 | - VI(M)DE,将vim当做IDE工具 18 | - N多实用别名和参考脚本 19 | - 彩色的man手册 20 | - 自动识git分支 21 | - 个性化登陆欢迎界面(需要安装`fortune`,`cowsay`) 22 | 23 | # [Dependence] 24 | 25 | * [ctags](http://ctags.sourceforge.net/) 26 | * [tree](ftp://mama.indstate.edu/linux/tree/) ftp://mama.indstate.edu/linux/tree/ 27 | 28 | ## Ubuntu 29 | 30 | ``` 31 | $ sudo apt-get install ctags tree vim 32 | ``` 33 | 34 | ## BSD 35 | 36 | ``` 37 | # pkg install ctags tree vim 38 | ``` 39 | 40 | ## CentOS 41 | 42 | ``` 43 | # yum install ctags tree vim 44 | ``` 45 | 46 | # 安装方法 47 | 48 | ## 方法一: 分步初始化 49 | 50 | ``` 51 | $ cd ~ 52 | $ git clone https://github.com/hy0kl/profile.git # https协议,防止抛ssh-key无权限 53 | $ cd profile 54 | $ git submodule init 55 | $ git submodule update 56 | $ ./install.sh 57 | ``` 58 | 59 | ## 方法二: 使用递归命令初始化 60 | 61 | ``` 62 | $ cd ~ 63 | $ git clone --recursive https://github.com/hy0kl/profile.git # https协议,防止抛ssh-key无权限 64 | $ cd profile 65 | $ ./install.sh 66 | ``` 67 | 68 | 记得将`~/.gitconfig`中的`name`,`email`改成自己的,否则提交日志中会出现默认的 69 | 70 | # golangIDE依赖 71 | 72 | ``` 73 | gocode go get github.com/nsf/gocode 74 | goimports go get golang.org/x/tools/cmd/goimports 75 | gotags go get github.com/jstemmer/gotags 76 | godef go get github.com/rogpeppe/godef 77 | ... 78 | ``` 79 | 80 | ## 新环境的配置 81 | 82 | 执行以下命令 83 | 84 | ``` 85 | :PluginInstall 86 | :GoUpdateBinaries 87 | ``` 88 | 89 | -------------------------------------------------------------------------------- /.vim/snippets/java.snippets: -------------------------------------------------------------------------------- 1 | snippet main 2 | public static void main (String [] args) 3 | { 4 | ${1:/* code */} 5 | } 6 | snippet pu 7 | public 8 | snippet po 9 | protected 10 | snippet pr 11 | private 12 | snippet st 13 | static 14 | snippet fi 15 | final 16 | snippet ab 17 | abstract 18 | snippet re 19 | return 20 | snippet br 21 | break; 22 | snippet de 23 | default: 24 | ${1} 25 | snippet ca 26 | catch(${1:Exception} ${2:e}) ${3} 27 | snippet th 28 | throw 29 | snippet sy 30 | synchronized 31 | snippet im 32 | import 33 | snippet j.u 34 | java.util 35 | snippet j.i 36 | java.io. 37 | snippet j.b 38 | java.beans. 39 | snippet j.n 40 | java.net. 41 | snippet j.m 42 | java.math. 43 | snippet if 44 | if (${1}) ${2} 45 | snippet el 46 | else 47 | snippet elif 48 | else if (${1}) ${2} 49 | snippet wh 50 | while (${1}) ${2} 51 | snippet for 52 | for (${1}; ${2}; ${3}) ${4} 53 | snippet fore 54 | for (${1} : ${2}) ${3} 55 | snippet sw 56 | switch (${1}) ${2} 57 | snippet cs 58 | case ${1}: 59 | ${2} 60 | ${3} 61 | snippet tc 62 | public class ${1:`Filename()`} extends ${2:TestCase} 63 | snippet t 64 | public void test${1:Name}() throws Exception ${2} 65 | snippet cl 66 | class ${1:`Filename("", "untitled")`} ${2} 67 | snippet in 68 | interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3} 69 | snippet m 70 | ${1:void} ${2:method}(${3}) ${4:throws }${5} 71 | snippet v 72 | ${1:String} ${2:var}${3: = null}${4};${5} 73 | snippet co 74 | static public final ${1:String} ${2:var} = ${3};${4} 75 | snippet cos 76 | static public final String ${1:var} = "${2}";${3} 77 | snippet as 78 | assert ${1:test} : "${2:Failure message}";${3} 79 | -------------------------------------------------------------------------------- /local/bin/ssh-copy-id.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Shell script to install your public key on a remote machine 4 | # Takes the remote machine name as an argument. 5 | # Obviously, the remote machine must accept password authentication, 6 | # or one of the other keys in your ssh-agent, for this to work. 7 | 8 | if [[ ! -f "$HOME/.ssh/id_rsa" ]] 9 | then 10 | echo "Please run 'ssh-keygen -t rsa -C your_email@example.com' at first." 11 | exit 12 | fi 13 | 14 | ID_FILE="${HOME}/.ssh/id_rsa.pub" 15 | 16 | if [ "-i" = "$1" ]; then 17 | shift 18 | # check if we have 2 parameters left, if so the first is the new ID file 19 | if [ -n "$2" ]; then 20 | if expr "$1" : ".*\.pub" > /dev/null ; then 21 | ID_FILE="$1" 22 | else 23 | ID_FILE="$1.pub" 24 | fi 25 | shift # and this should leave $1 as the target name 26 | fi 27 | else 28 | if [ x$SSH_AUTH_SOCK != x ] && ssh-add -L >/dev/null 2>&1; then 29 | GET_ID="$GET_ID ssh-add -L" 30 | fi 31 | fi 32 | 33 | if [ -z "`eval $GET_ID`" ] && [ -r "${ID_FILE}" ] ; then 34 | GET_ID="cat ${ID_FILE}" 35 | fi 36 | 37 | if [ -z "`eval $GET_ID`" ]; then 38 | echo "$0: ERROR: No identities found" >&2 39 | exit 1 40 | fi 41 | 42 | if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then 43 | echo "Usage: $0 [-i [identity_file]] [user@]machine" >&2 44 | exit 1 45 | fi 46 | 47 | { eval "$GET_ID" ; } | ssh ${1%:} "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1 48 | 49 | cat <= 0; $2${3:--}) { 49 | ${4:$1[$2]} 50 | }; 51 | # while (...) {...} 52 | snippet wh 53 | while (${1:/* condition */}) { 54 | ${2:/* code */} 55 | } 56 | # do...while 57 | snippet do 58 | do { 59 | ${2:/* code */} 60 | } while (${1:/* condition */}); 61 | # Object Method 62 | snippet :f 63 | ${1:method_name}: function(${2:attribute}) { 64 | ${4} 65 | }${3:,} 66 | # setTimeout function 67 | snippet timeout 68 | setTimeout(function() {${3}}${2}, ${1:10}; 69 | # Get Elements 70 | snippet get 71 | getElementsBy${1:TagName}('${2}')${3} 72 | # Get Element 73 | snippet gett 74 | getElementBy${1:Id}('${2}')${3} 75 | -------------------------------------------------------------------------------- /local/colordiff/cdiff.xml: -------------------------------------------------------------------------------- 1 | 2 | diff"> 5 | cdiff"> 6 | ]> 7 | 8 | 10 | 11 | 12 | 13 | cdiff 14 | 1 15 | 16 | 17 | 18 | cdiff 19 | a wrapper tool for colordiff 20 | 21 | 22 | 23 | 24 | cdiff 25 | URL|FILE 26 | 27 | 28 | 29 | Description 30 | 31 | &cdiff; is a wrapper for colordiff and will add colour to a diff given 32 | in a URL or a file, e.g. 33 | 34 | 35 | cdiff http://some.url.com/foo/thing.patch 36 | 37 | 38 | It also adds support for reading gzip, bzip2 and lzma compressed diffs, 39 | and like colordiff, also supports reading diffs from standard input if URL 40 | or a filename is not specified. &cdiff; pipes colordiff's output through 41 | less -R. 42 | 43 | 44 | 45 | See Also 46 | 47 | &cdiff; is part of the colordiff package, which should be consulted for 48 | further reference. 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /op-tools/install-prometheus-node_exporter.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # @describe: ubuntu系统自动安装 prometheus node_exporter 3 | 4 | #set -x 5 | 6 | #pid=`ps aux | grep node_exporter | grep -v grep | awk '{print $2}'` 7 | #if [ ! -z "$pid" ]; then 8 | # echo "node_exporter already installed" 9 | # exit 0 10 | #fi 11 | 12 | if [ -x "/home/service/node_exporter/node_exporter" ]; then 13 | echo "node_exporter already installed" 14 | exit 0 15 | fi 16 | 17 | #### create user group ### 18 | sudo groupadd prometheus 19 | sudo useradd -g prometheus -s /sbin/nologin prometheus 20 | 21 | #### deploy node_exporter #### 22 | sudo mkdir -p /home/service 23 | mkdir -p /tmp/src && cd /tmp/src 24 | wget https://github.com/prometheus/node_exporter/releases/download/v1.1.1/node_exporter-1.1.1.linux-amd64.tar.gz 25 | tar -xvf node_exporter-1.1.1.linux-amd64.tar.gz -C /home/service 26 | sudo mv /home/service/node_exporter-1.1.1.linux-amd64 /home/service/node_exporter 27 | 28 | #### setup autostart #### 29 | service_tpl="/tmp/node_exporter-service.tpl" 30 | cat << EOF > "$service_tpl" 31 | [Unit] 32 | Description=node_exporter 33 | Documentation=https://prometheus.io/ 34 | After=network.target 35 | 36 | [Service] 37 | Type=simple 38 | User=prometheus 39 | ExecStart=/home/service/node_exporter/node_exporter 40 | Restart=on-failure 41 | 42 | [Install] 43 | WantedBy=multi-user.target 44 | EOF 45 | 46 | sudo mv "$service_tpl" /lib/systemd/system/node_exporter.service 47 | 48 | ### start node_exporter ### 49 | sudo systemctl daemon-reload && \ 50 | sudo systemctl start node_exporter && \ 51 | sudo systemctl enable node_exporter 52 | 53 | if [ $? -eq 0 ]; 54 | then 55 | echo "deploy success" 56 | else 57 | echo "deploy failed" 58 | fi 59 | 60 | # vim:set ts=4 sw=4 et fdm=marker: 61 | 62 | -------------------------------------------------------------------------------- /.vim/nerdtree_plugin/exec_menuitem.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: exec_menuitem.vim 3 | " Description: plugin for NERD Tree that provides an execute file menu item 4 | " Maintainer: Martin Grenfell 5 | " Last Change: 22 July, 2009 6 | " License: This program is free software. It comes without any warranty, 7 | " to the extent permitted by applicable law. You can redistribute 8 | " it and/or modify it under the terms of the Do What The Fuck You 9 | " Want To Public License, Version 2, as published by Sam Hocevar. 10 | " See http://sam.zoy.org/wtfpl/COPYING for more details. 11 | " 12 | " ============================================================================ 13 | if exists("g:loaded_nerdtree_exec_menuitem") 14 | finish 15 | endif 16 | let g:loaded_nerdtree_exec_menuitem = 1 17 | 18 | call NERDTreeAddMenuItem({ 19 | \ 'text': '(!)Execute file', 20 | \ 'shortcut': '!', 21 | \ 'callback': 'NERDTreeExecFile', 22 | \ 'isActiveCallback': 'NERDTreeExecFileActive' }) 23 | 24 | function! NERDTreeExecFileActive() 25 | let node = g:NERDTreeFileNode.GetSelected() 26 | return !node.path.isDirectory && node.path.isExecutable 27 | endfunction 28 | 29 | function! NERDTreeExecFile() 30 | let treenode = g:NERDTreeFileNode.GetSelected() 31 | echo "==========================================================\n" 32 | echo "Complete the command to execute (add arguments etc):\n" 33 | let cmd = treenode.path.str({'escape': 1}) 34 | let cmd = input(':!', cmd . ' ') 35 | 36 | if cmd != '' 37 | exec ':!' . cmd 38 | else 39 | echo "Aborted" 40 | endif 41 | endfunction 42 | -------------------------------------------------------------------------------- /.vim/snippets/tcl.snippets: -------------------------------------------------------------------------------- 1 | # #!/usr/bin/tclsh 2 | snippet #! 3 | #!/usr/bin/tclsh 4 | 5 | # Process 6 | snippet pro 7 | proc ${1:function_name} {${2:args}} { 8 | ${3:#body ...} 9 | } 10 | #xif 11 | snippet xif 12 | ${1:expr}? ${2:true} : ${3:false} 13 | # Conditional 14 | snippet if 15 | if {${1}} { 16 | ${2:# body...} 17 | } 18 | # Conditional if..else 19 | snippet ife 20 | if {${1}} { 21 | ${2:# body...} 22 | } else { 23 | ${3:# else...} 24 | } 25 | # Conditional if..elsif..else 26 | snippet ifee 27 | if {${1}} { 28 | ${2:# body...} 29 | } elseif {${3}} { 30 | ${4:# elsif...} 31 | } else { 32 | ${5:# else...} 33 | } 34 | # If catch then 35 | snippet ifc 36 | if { [catch {${1:#do something...}} ${2:err}] } { 37 | ${3:# handle failure...} 38 | } 39 | # Catch 40 | snippet catch 41 | catch {${1}} ${2:err} ${3:options} 42 | # While Loop 43 | snippet wh 44 | while {${1}} { 45 | ${2:# body...} 46 | } 47 | # For Loop 48 | snippet for 49 | for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} { 50 | ${4:# body...} 51 | } 52 | # Foreach Loop 53 | snippet fore 54 | foreach ${1:x} {${2:#list}} { 55 | ${3:# body...} 56 | } 57 | # after ms script... 58 | snippet af 59 | after ${1:ms} ${2:#do something} 60 | # after cancel id 61 | snippet afc 62 | after cancel ${1:id or script} 63 | # after idle 64 | snippet afi 65 | after idle ${1:script} 66 | # after info id 67 | snippet afin 68 | after info ${1:id} 69 | # Expr 70 | snippet exp 71 | expr {${1:#expression here}} 72 | # Switch 73 | snippet sw 74 | switch ${1:var} { 75 | ${3:pattern 1} { 76 | ${4:#do something} 77 | } 78 | default { 79 | ${2:#do something} 80 | } 81 | } 82 | # Case 83 | snippet ca 84 | ${1:pattern} { 85 | ${2:#do something} 86 | }${3} 87 | # Namespace eval 88 | snippet ns 89 | namespace eval ${1:path} {${2:#script...}} 90 | # Namespace current 91 | snippet nsc 92 | namespace current 93 | -------------------------------------------------------------------------------- /.vim/snippets/perl.snippets: -------------------------------------------------------------------------------- 1 | # #!/usr/bin/perl 2 | snippet #! 3 | #!/usr/bin/perl 4 | 5 | # Hash Pointer 6 | snippet . 7 | => 8 | # Function 9 | snippet sub 10 | sub ${1:function_name} { 11 | ${2:#body ...} 12 | } 13 | # Conditional 14 | snippet if 15 | if (${1}) { 16 | ${2:# body...} 17 | } 18 | # Conditional if..else 19 | snippet ife 20 | if (${1}) { 21 | ${2:# body...} 22 | } else { 23 | ${3:# else...} 24 | } 25 | # Conditional if..elsif..else 26 | snippet ifee 27 | if (${1}) { 28 | ${2:# body...} 29 | } elsif (${3}) { 30 | ${4:# elsif...} 31 | } else { 32 | ${5:# else...} 33 | } 34 | # Conditional One-line 35 | snippet xif 36 | ${1:expression} if ${2:condition};${3} 37 | # Unless conditional 38 | snippet unless 39 | unless (${1}) { 40 | ${2:# body...} 41 | } 42 | # Unless conditional One-line 43 | snippet xunless 44 | ${1:expression} unless ${2:condition};${3} 45 | # Try/Except 46 | snippet eval 47 | eval { 48 | ${1:# do something risky...} 49 | }; 50 | if ($@) { 51 | ${2:# handle failure...} 52 | } 53 | # While Loop 54 | snippet wh 55 | while (${1}) { 56 | ${2:# body...} 57 | } 58 | # While Loop One-line 59 | snippet xwh 60 | ${1:expression} while ${2:condition};${3} 61 | # For Loop 62 | snippet for 63 | for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) { 64 | ${4:# body...} 65 | } 66 | # Foreach Loop 67 | snippet fore 68 | foreach my $${1:x} (@${2:array}) { 69 | ${3:# body...} 70 | } 71 | # Foreach Loop One-line 72 | snippet xfore 73 | ${1:expression} foreach @${2:array};${3} 74 | # Package 75 | snippet cl 76 | package ${1:ClassName}; 77 | 78 | use base qw(${2:ParentClass}); 79 | 80 | sub new { 81 | my $class = shift; 82 | $class = ref $class if ref $class; 83 | my $self = bless {}, $class; 84 | $self; 85 | } 86 | 87 | 1;${3} 88 | # Read File 89 | snippet slurp 90 | my $${1:var}; 91 | { local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = ; close FILE }${3} 92 | -------------------------------------------------------------------------------- /.vim/snippets/python.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/python 3 | 4 | snippet imp 5 | import ${1:module} 6 | # Module Docstring 7 | snippet docs 8 | ''' 9 | File: ${1:`Filename('$1.py', 'foo.py')`} 10 | Author: ${2:`g:snips_author`} 11 | Description: ${3} 12 | ''' 13 | snippet wh 14 | while ${1:condition}: 15 | ${2:# code...} 16 | snippet for 17 | for ${1:needle} in ${2:haystack}: 18 | ${3:# code...} 19 | # New Class 20 | snippet cl 21 | class ${1:ClassName}(${2:object}): 22 | """${3:docstring for $1}""" 23 | def __init__(self, ${4:arg}): 24 | ${5:super($1, self).__init__()} 25 | self.$4 = $4 26 | ${6} 27 | # New Function 28 | snippet def 29 | def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): 30 | """${3:docstring for $1}""" 31 | ${4:pass} 32 | snippet deff 33 | def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): 34 | ${3} 35 | # New Method 36 | snippet defs 37 | def ${1:mname}(self, ${2:arg}): 38 | ${3:pass} 39 | # New Property 40 | snippet property 41 | def ${1:foo}(): 42 | doc = "${2:The $1 property.}" 43 | def fget(self): 44 | ${3:return self._$1} 45 | def fset(self, value): 46 | ${4:self._$1 = value} 47 | # Lambda 48 | snippet ld 49 | ${1:var} = lambda ${2:vars} : ${3:action} 50 | snippet . 51 | self. 52 | snippet try Try/Except 53 | try: 54 | ${1:pass} 55 | except ${2:Exception}, ${3:e}: 56 | ${4:raise $3} 57 | snippet try Try/Except/Else 58 | try: 59 | ${1:pass} 60 | except ${2:Exception}, ${3:e}: 61 | ${4:raise $3} 62 | else: 63 | ${5:pass} 64 | snippet try Try/Except/Finally 65 | try: 66 | ${1:pass} 67 | except ${2:Exception}, ${3:e}: 68 | ${4:raise $3} 69 | finally: 70 | ${5:pass} 71 | snippet try Try/Except/Else/Finally 72 | try: 73 | ${1:pass} 74 | except ${2:Exception}, ${3:e}: 75 | ${4:raise $3} 76 | else: 77 | ${5:pass} 78 | finally: 79 | ${6:pass} 80 | # if __name__ == '__main__': 81 | snippet ifmain 82 | if __name__ == '__main__': 83 | ${1:main()} 84 | # __magic__ 85 | snippet _ 86 | __${1:init}__${2} 87 | -------------------------------------------------------------------------------- /.vim/plugin/sudo.vim: -------------------------------------------------------------------------------- 1 | " 2 | " 3 | " sudo.vim: A vim plugin by Rich Paul (vim@rich-paul.net) 4 | " 5 | " This script eases use of vim with sudo by adding the ability to 6 | " edit one file with root privleges without running the whole 7 | " session that way. 8 | " 9 | " 10 | " Usage: put it in the plugin directory, and 11 | " (command line): vim sudo:/etc/passwd 12 | " (within vim): :e sudo:/etc/passwd 13 | " 14 | " sudo will ask for your password if need be. 15 | " Requires: 16 | " sudo package installed 17 | " decent OS (sorry, no windows, unless cygwin has sudo now?) 18 | " Provides: 19 | " URL handler, sudo: scheme 20 | " 2 autocommands 21 | " 22 | " Commands: 23 | " SudoRead 24 | " SudoWrite 25 | " ToDo: 26 | " Allow one to sudo to users other than root. 27 | " Quote the file name better. 28 | " 29 | 30 | 31 | if exists("s:seen") && !exists("s:debug") 32 | finish 33 | endif 34 | let s:seen=1 35 | "let s:debug=1 36 | function! SudoRead(url) 37 | if a:url=="" 38 | let file=expand(a:url) 39 | else 40 | let file=a:url 41 | endif 42 | let prot=matchstr(file,'^\(sudo\)\ze:') 43 | if '' != prot 44 | let file=strpart(file,strlen(prot)+1) 45 | endif 46 | :0,$d 47 | call setline(1,"foo") 48 | exec '1read !sudo cat "'.file.'" ' 49 | :1d 50 | set nomod 51 | :filetype detect 52 | endfunction 53 | function! SudoWrite (url) abort 54 | if a:url=="" 55 | let file=expand(a:url) 56 | else 57 | let file=a:url 58 | endif 59 | let prot=matchstr(file,'^\(sudo\)\ze:') 60 | if '' != prot 61 | let file=strpart(file,strlen(prot)+1) 62 | endif 63 | set nomod 64 | exec '%write !sudo tee >/dev/null "'.file.'"' 65 | endf 66 | command! -nargs=1 SudoRead call SudoRead() 67 | command! -nargs=1 SudoWrite call SudoWrite() 68 | augroup Sudo 69 | autocmd! 70 | au BufReadCmd sudo:*,sudo:*/* SudoRead 71 | au FileReadCmd sudo:*,sudo:*/* SudoRead 72 | au BufWriteCmd sudo:*,sudo:*/* SudoWrite 73 | au FileWriteCmd sudo:*,sudo:*/* SudoWrite 74 | augroup END 75 | -------------------------------------------------------------------------------- /.vim/syntax/toml.vim: -------------------------------------------------------------------------------- 1 | " Language: TOML 2 | " Maintainer: Caleb Spare 3 | " URL: https://github.com/cespare/vim-toml 4 | " LICENSE: MIT 5 | 6 | if exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | syn match tomlEscape /\\[btnfr"/\\]/ display contained 11 | syn match tomlEscape /\\u\x\{4}/ contained 12 | syn match tomlEscape /\\U\x\{8}/ contained 13 | hi def link tomlEscape SpecialChar 14 | 15 | syn match tomlLineEscape /\\$/ contained 16 | hi def link tomlLineEscape SpecialChar 17 | 18 | " Basic strings 19 | syn region tomlString oneline start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=tomlEscape 20 | " Multi-line basic strings 21 | syn region tomlString start=/"""/ end=/"""/ contains=tomlEscape,tomlLineEscape 22 | " Literal strings 23 | syn region tomlString oneline start=/'/ end=/'/ 24 | " Multi-line literal strings 25 | syn region tomlString start=/'''/ end=/'''/ 26 | hi def link tomlString String 27 | 28 | syn match tomlInteger /\<[+-]\=[0-9]\(_\=\d\)*\>/ display 29 | hi def link tomlInteger Number 30 | 31 | syn match tomlFloat /\<[+-]\=[0-9]\(_\=\d\)*\.\d\+\>/ display 32 | syn match tomlFloat /\<[+-]\=[0-9]\(_\=\d\)*\(\.[0-9]\(_\=\d\)*\)\=[eE][+-]\=[0-9]\(_\=\d\)*\>/ display 33 | hi def link tomlFloat Float 34 | 35 | syn match tomlBoolean /\<\%(true\|false\)\>/ display 36 | hi def link tomlBoolean Boolean 37 | 38 | " https://tools.ietf.org/html/rfc3339 39 | syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display 40 | hi def link tomlDate Constant 41 | 42 | syn match tomlTable /^\s*\[[^#\[\]]\+\]\s*\(#.*\)\?$/ contains=tomlComment 43 | hi def link tomlTable Identifier 44 | 45 | syn match tomlTableArray /^\s*\[\[[^#\[\]]\+\]\]\s*\(#.*\)\?$/ contains=tomlComment 46 | hi def link tomlTableArray Identifier 47 | 48 | syn keyword tomlTodo TODO FIXME XXX BUG contained 49 | hi def link tomlTodo Todo 50 | 51 | syn match tomlComment /#.*/ contains=@Spell,tomlTodo 52 | hi def link tomlComment Comment 53 | 54 | let b:current_syntax = "toml" 55 | -------------------------------------------------------------------------------- /local/bin/redisd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # @author: Jerry Yang(hy0kle@gmail.com) 3 | # @describe: 4 | 5 | #set -x 6 | 7 | # And add me to system start 8 | # chmod +x redisd 9 | # 10 | # description: Distributed redisd caching daemon 11 | # 12 | # processname: redis-server 13 | # config: /Users/hy0kl/redis/conf/redis_a.conf 14 | 15 | ### Read configuration 16 | #[ -r "$SYSCONFIG" ] && source "$SYSCONFIG" 17 | 18 | prog="/usr/local/bin/redis-server" 19 | desc="Distributed memory caching use redis" 20 | 21 | REDIS_CONF_FILE="/Users/hy0kl/redis/conf/redis_a.conf" 22 | lockfile=/Users/hy0kl/redis/log/redis 23 | 24 | # global functions { 25 | work_pids="" 26 | function get_work_pids() 27 | { 28 | work_pids=$(ps aux | grep "$prog"| grep -v grep | awk '{print $2}' | xargs) 29 | } 30 | 31 | start() { 32 | echo $"Starting $desc ($prog): " 33 | $prog $REDIS_CONF_FILE >> /Users/hy0kl/redis/log/redis_a.log 2>&1 & 34 | RETVAL=$? 35 | echo 36 | [ $RETVAL -eq 0 ] && touch $lockfile 37 | return $RETVAL 38 | } 39 | 40 | stop() { 41 | echo $"Shutting down $desc ($prog): " 42 | get_work_pids 43 | echo $work_pids 44 | #no process need to quit 45 | if [ "$work_pids" == "" ]; then 46 | echo "No process need to quit..." 47 | exit 0 48 | fi 49 | 50 | kill -9 $work_pids 51 | RETVAL=$? 52 | echo 53 | [ $RETVAL -eq 0 ] && rm -f $lockfile 54 | return $RETVAL 55 | } 56 | 57 | restart() { 58 | stop 59 | start 60 | } 61 | 62 | reload() { 63 | echo -n $"Reloading $desc ($prog): " 64 | kill -HUP $prog 65 | RETVAL=$? 66 | echo 67 | return $RETVAL 68 | } 69 | 70 | case "$1" in 71 | start) 72 | start 73 | ;; 74 | stop) 75 | stop 76 | ;; 77 | restart) 78 | restart 79 | ;; 80 | condrestart) 81 | [ -e $lockfile ] && restart 82 | RETVAL=$? 83 | ;; 84 | reload) 85 | reload 86 | ;; 87 | status) 88 | status $prog 89 | RETVAL=$? 90 | ;; 91 | *) 92 | echo $"Usage: $0 {start|stop|restart|condrestart|status}" 93 | RETVAL=1 94 | esac 95 | 96 | exit $RETVAL 97 | -------------------------------------------------------------------------------- /local/colordiff/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL_DIR=/usr/local/bin 2 | MAN_DIR=/usr/local/man/man1 3 | ETC_DIR=/etc 4 | VERSION=1.0.9 5 | DIST_FILES=COPYING INSTALL Makefile README \ 6 | colordiff.pl colordiffrc colordiffrc-lightbg cdiff.sh BUGS TODO CHANGES colordiff.1 \ 7 | colordiff.xml cdiff.xml cdiff.1 8 | TMPDIR=colordiff-${VERSION} 9 | TARBALL=${TMPDIR}.tar.gz 10 | 11 | 12 | doc: colordiff.xml cdiff.xml 13 | xmlto -vv man colordiff.xml 14 | xmlto -vv man cdiff.xml 15 | xmlto -vv txt colordiff.xml 16 | xmlto -vv html-nochunks colordiff.xml 17 | mv colordiff.txt README 18 | perl -p -i -e 's###' colordiff.html 19 | perl -p -i -e 's###' colordiff.html 20 | perl -p -i -e 's#
\ 26 | ${DESTDIR}${INSTALL_DIR}/colordiff 27 | chmod +x ${DESTDIR}${INSTALL_DIR}/colordiff 28 | if [ ! -f ${DESTDIR}${INSTALL_DIR}/cdiff ] ; then \ 29 | install cdiff.sh ${DESTDIR}${INSTALL_DIR}/cdiff; \ 30 | fi 31 | install -Dm 644 colordiff.1 ${DESTDIR}${MAN_DIR}/colordiff.1 32 | install -Dm 644 cdiff.1 ${DESTDIR}${MAN_DIR}/cdiff.1 33 | if [ -f ${DESTDIR}${ETC_DIR}/colordiffrc ]; then \ 34 | mv -f ${DESTDIR}${ETC_DIR}/colordiffrc \ 35 | ${DESTDIR}${ETC_DIR}/colordiffrc.old; \ 36 | else \ 37 | install -d ${DESTDIR}${ETC_DIR}; \ 38 | fi 39 | cp colordiffrc ${DESTDIR}${ETC_DIR}/colordiffrc 40 | -chown root.root ${DESTDIR}${ETC_DIR}/colordiffrc 41 | chmod 644 ${DESTDIR}${ETC_DIR}/colordiffrc 42 | 43 | uninstall: 44 | rm -f ${DESTDIR}${INSTALL_DIR}/colordiff 45 | rm -f ${DESTDIR}${ETC_DIR}/colordiffrc 46 | rm -f ${DESTDIR}${INSTALL_DIR}/cdiff 47 | rm -f ${DESTDIR}${MAN_DIR}/colordiff.1 48 | rm -f ${DESTDIR}${MAN_DIR}/cdiff.1 49 | 50 | dist: 51 | mkdir ${TMPDIR} 52 | cp -p ${DIST_FILES} ${TMPDIR} 53 | tar -zcvf ${TARBALL} ${TMPDIR} 54 | rm -fR ${TMPDIR} 55 | 56 | clean: 57 | rm -f README colordiff.1 colordiff.html cdiff.1 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Libraries 8 | *.lib 9 | *.a 10 | 11 | # Shared objects (inc. Windows DLLs) 12 | *.dll 13 | *.so 14 | *.so.* 15 | *.dylib 16 | 17 | # Executables 18 | *.exe 19 | *.out 20 | *.app 21 | *.i*86 22 | *.x86_64 23 | *.hex 24 | .DS_Store 25 | *~ 26 | *.swp 27 | *.swo 28 | *.dSYM 29 | *.bak 30 | 31 | # IDE project 32 | *.project 33 | *.buildpath 34 | 35 | # Other 36 | a.out 37 | tags 38 | favicon.ico 39 | .netrwhist 40 | *.bak 41 | 42 | # Xcode 43 | ## gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 44 | ## Build generated 45 | build/ 46 | DerivedData 47 | ## Various settings 48 | *.pbxuser 49 | !default.pbxuser 50 | *.mode1v3 51 | !default.mode1v3 52 | *.mode2v3 53 | !default.mode2v3 54 | *.perspectivev3 55 | !default.perspectivev3 56 | xcuserdata 57 | ## Other 58 | *.xccheckout 59 | *.moved-aside 60 | *.xcuserstate 61 | *.xcscmblueprint 62 | ## Obj-C/Swift specific 63 | *.hmap 64 | *.ipa 65 | ## Playgrounds 66 | timeline.xctimeline 67 | playground.xcworkspace 68 | 69 | # Swift Package Manager 70 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 71 | Packages/ 72 | .build/ 73 | 74 | # CocoaPods 75 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 76 | Pods/ 77 | Podfile.lock 78 | 79 | # Carthage 80 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 81 | Carthage/Checkouts 82 | Carthage/Build 83 | 84 | # spring-boot 85 | *# 86 | *.iml 87 | *.ipr 88 | *.iws 89 | *.jar 90 | *.sw? 91 | *~ 92 | .#* 93 | .*.md.html 94 | .classpath 95 | .factorypath 96 | .gradle 97 | .idea 98 | .mvn 99 | .metadata 100 | .project 101 | .recommenders 102 | .settings 103 | .springBeans 104 | /build 105 | /code 106 | MANIFEST.MF 107 | _site/ 108 | activemq-data 109 | bin 110 | build 111 | build.log 112 | dependency-reduced-pom.xml 113 | dump.rdb 114 | interpolated*.xml 115 | lib/ 116 | manifest.yml 117 | overridedb.* 118 | settings.xml 119 | target 120 | transaction-logs 121 | .flattened-pom.xml 122 | secrets.yml 123 | .gradletasknamecache 124 | .sts4-cache 125 | -------------------------------------------------------------------------------- /.vim/tools/css/css.attr: -------------------------------------------------------------------------------- 1 | :active 2 | :after 3 | :before 4 | :first-child 5 | :first-letter 6 | :first-line 7 | :focus 8 | :hover 9 | :lang 10 | :link 11 | :visited 12 | background 13 | background-attachment 14 | background-color 15 | background-image 16 | background-position 17 | background-repeat 18 | border 19 | border-bottom 20 | border-bottom-color 21 | border-bottom-style 22 | border-bottom-width 23 | border-collapse 24 | border-color 25 | border-left 26 | border-left-color 27 | border-left-style 28 | border-left-width 29 | border-right 30 | border-right-color 31 | border-right-style 32 | border-right-width 33 | border-spacing 34 | border-style 35 | border-top 36 | border-top-color 37 | border-top-style 38 | border-top-width 39 | border-width 40 | bottom 41 | caption-side 42 | clear 43 | clip 44 | color 45 | content 46 | counter-increment 47 | counter-reset 48 | crosshair 49 | cursor 50 | dashed 51 | direction 52 | display 53 | dotted 54 | double 55 | e-resize 56 | empty-cells 57 | float 58 | font 59 | font-family 60 | font-size 61 | font-size-adjust 62 | font-stretch 63 | font-style 64 | font-variant 65 | font-weight 66 | groove 67 | height 68 | help 69 | herit 70 | hidden 71 | inset 72 | inuto 73 | left 74 | letter-spacing 75 | line-height 76 | list-style 77 | list-style-image 78 | list-style-position 79 | list-style-type 80 | margin 81 | margin-bottom 82 | margin-left 83 | margin-right 84 | margin-top 85 | marker-offset 86 | max-height 87 | max-width 88 | min-height 89 | min-width 90 | move 91 | n-resize 92 | ne-resize 93 | none 94 | nw-resize 95 | opacity 96 | orphans 97 | outline 98 | outline-color 99 | outline-style 100 | outline-width 101 | outset 102 | overflow 103 | padding 104 | padding-bottom 105 | padding-left 106 | padding-right 107 | padding-top 108 | page-break-after 109 | page-break-before 110 | page-break-inside 111 | pointer 112 | position 113 | quotes 114 | ridge 115 | right 116 | s-resize 117 | se-resize 118 | solid 119 | sw-resize 120 | table-layout 121 | text 122 | text-align 123 | text-decoration 124 | text-indent 125 | text-shadow 126 | text-transform 127 | top 128 | unicode-bidi 129 | vertical-align 130 | visibility 131 | w-resize 132 | wait 133 | white-space 134 | widows 135 | width 136 | word-spacing 137 | z-index 138 | -------------------------------------------------------------------------------- /share/IPTool.php: -------------------------------------------------------------------------------- 1 | 255 || $exp_sub[$i] < 0) { 16 | $available = 0; 17 | break; 18 | } 19 | } 20 | if ($exp_sub[0] > 255 || $exp_sub[0] <= 0) { 21 | $available = 0; 22 | } 23 | } 24 | 25 | return $available; 26 | } 27 | 28 | public static function getIPRange($ip) 29 | { 30 | $range = false; 31 | 32 | $exp_ip = explode('/', $ip); 33 | do { 34 | // ip 段配置 35 | if (2 == count($exp_ip)) { 36 | if (! self::checkIPAvailable($exp_ip[0])) { 37 | break; 38 | } 39 | 40 | $mask = $exp_ip[1]; 41 | if ($mask <= 2 || $mask > 32) { 42 | break; 43 | } 44 | 45 | $ip_mask = str_repeat('1', $mask); 46 | $ip_mask = str_pad($ip_mask, 32, '0'); 47 | //var_dump($ip_mask); 48 | 49 | $exp_sub = explode('.', $exp_ip[0]); 50 | $ip_container = array(); 51 | foreach ($exp_sub as $k => $v) { 52 | echo substr($ip_mask, $k * 8, 8), PHP_EOL; 53 | $ip_container[$k] = $v & bindec(substr($ip_mask, $k * 8, 8)); 54 | } 55 | var_dump($ip_container); 56 | if ($exp_sub[0] != $ip_container[0]) { 57 | //echo 'IP 首段不相同', PHP_EOL; 58 | break; 59 | } 60 | 61 | } else { 62 | // 单 ip 63 | $exp_sub = explode('.', $ip); 64 | if (self::checkIPAvailable($ip)) { 65 | $range[] = $ip; 66 | } 67 | } 68 | } while(0); 69 | 70 | return $range; 71 | } 72 | } 73 | 74 | $range = IPTool::getIPRange('123.45.6.0/8'); 75 | //$range = IPTool::getIPRange('123.45.6.0'); 76 | var_dump($range); 77 | /* vim:set ts=4 sw=4 et fdm=marker: */ 78 | 79 | -------------------------------------------------------------------------------- /local/colordiff/cdiff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # cdiff.sh - Convenience wrapper for colordiff 4 | # 5 | # Copyright (C) 2003-2004 Ville Skyttä 6 | # Based on cdiff version 1.4 by eivind@FreeBSD.org 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License 10 | # as published by the Free Software Foundation; either version 2 11 | # of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | (if [ "$1" != "" ]; then 23 | while [ "$1" != "" ]; do 24 | file=`echo "$1" | perl -pe 's|^file:/+|/|i'` 25 | case "$file" in 26 | *.bz2) cat="bzip2 -dcf" ;; 27 | *.lzma) cat="lzma -dc" ;; 28 | *) cat="gzip -dcf" ;; 29 | esac 30 | case `echo "$file" | perl -ne 'print lc $_'` in 31 | http:*|https:*|ftp:*) 32 | if [ -z "$CDIFF_FETCH" ]; then 33 | if which curl >/dev/null 2>&1; then 34 | CDIFF_FETCH="curl -s" 35 | elif which wget >/dev/null 2>&1; then 36 | CDIFF_FETCH="wget -e timestamping=off -qO -" 37 | elif which lwp-request >/dev/null 2>&1; then 38 | CDIFF_FETCH="lwp-request -m GET" 39 | elif which lynx >/dev/null 2>&1; then 40 | CDIFF_FETCH="lynx -source" 41 | elif which elinks >/dev/null 2>&1; then 42 | CDIFF_FETCH="elinks -source" 43 | fi 44 | if [ -z "$CDIFF_FETCH" ]; then 45 | echo "Error: no program to fetch from URLs found." 46 | exit 1 47 | fi 48 | fi 49 | $CDIFF_FETCH "$file" | $cat 50 | ;; 51 | *) 52 | $cat "$file" 53 | ;; 54 | esac 55 | shift; 56 | done 57 | else 58 | cat 59 | fi) | colordiff | less -R 60 | -------------------------------------------------------------------------------- /local/bin/memcached.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # @author: Jerry Yang(hy0kle@gmail.com) 3 | # @describe: 4 | 5 | #set -x 6 | 7 | # Save me to /etc/init.d/memcached 8 | # And add me to system start 9 | # chmod +x memcached 10 | # chkconfig --add memcached 11 | # chkconfig --level 35 memcached on 12 | # 13 | # description: Distributed memory caching daemon 14 | # 15 | # processname: memcached 16 | # config: /usr/local/memcached/my.conf 17 | 18 | #source /etc/rc.d/init.d/functions 19 | 20 | ### Default variables 21 | PORT="11211" 22 | USER="hy0kl" 23 | MAXCONN="1024" 24 | # 开发环境,使用量小 25 | CACHESIZE="1" 26 | OPTIONS="" 27 | #SYSCONFIG="/usr/local/memcached/my.conf" 28 | 29 | ### Read configuration 30 | #[ -r "$SYSCONFIG" ] && source "$SYSCONFIG" 31 | 32 | RETVAL=0 33 | prog="/usr/local/bin/memcached" 34 | desc="Distributed memory caching" 35 | 36 | # global functions { 37 | work_pids="" 38 | function get_work_pids() 39 | { 40 | work_pids=$(ps aux | grep "$prog"| grep -v grep | awk '{print $2}' | xargs) 41 | } 42 | 43 | start() { 44 | echo $"Starting $desc ($prog): " 45 | $prog -d -p $PORT -u $USER -c $MAXCONN -m $CACHESIZE $OPTIONS 46 | RETVAL=$? 47 | echo 48 | [ $RETVAL -eq 0 ] && touch /var/tmp/lock-memcached 49 | return $RETVAL 50 | } 51 | 52 | stop() { 53 | echo $"Shutting down $desc ($prog): " 54 | get_work_pids 55 | echo $work_pids 56 | #no process need to quit 57 | if [ "$work_pids" == "" ]; then 58 | echo "No process need to quit..." 59 | exit 0 60 | fi 61 | 62 | kill -9 $work_pids 63 | RETVAL=$? 64 | echo 65 | [ $RETVAL -eq 0 ] && rm -f /var/tmp/lock-memcached 66 | return $RETVAL 67 | } 68 | 69 | restart() { 70 | stop 71 | start 72 | } 73 | 74 | reload() { 75 | echo -n $"Reloading $desc ($prog): " 76 | kill -HUP $prog 77 | RETVAL=$? 78 | echo 79 | return $RETVAL 80 | } 81 | 82 | case "$1" in 83 | start) 84 | start 85 | ;; 86 | stop) 87 | stop 88 | ;; 89 | restart) 90 | restart 91 | ;; 92 | condrestart) 93 | [ -e /var/tmp/lock-$prog ] && restart 94 | RETVAL=$? 95 | ;; 96 | reload) 97 | reload 98 | ;; 99 | status) 100 | status $prog 101 | RETVAL=$? 102 | ;; 103 | *) 104 | echo $"Usage: $0 {start|stop|restart|condrestart|status}" 105 | RETVAL=1 106 | esac 107 | 108 | exit $RETVAL 109 | -------------------------------------------------------------------------------- /.vim/syntax/json.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: JSON 3 | " Maintainer: Jeroen Ruigrok van der Werven 4 | " Last Change: 2009-06-16 5 | " Version: 0.4 6 | " {{{1 7 | 8 | " Syntax setup {{{2 9 | " For version 5.x: Clear all syntax items 10 | " For version 6.x: Quit when a syntax file was already loaded 11 | 12 | if !exists("main_syntax") 13 | if version < 600 14 | syntax clear 15 | elseif exists("b:current_syntax") 16 | finish 17 | endif 18 | let main_syntax = 'json' 19 | endif 20 | 21 | " Syntax: Strings {{{2 22 | syn region jsonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=jsonEscape 23 | " Syntax: JSON does not allow strings with single quotes, unlike JavaScript. 24 | syn region jsonStringSQ start=+'+ skip=+\\\\\|\\"+ end=+'+ 25 | 26 | " Syntax: Escape sequences {{{3 27 | syn match jsonEscape "\\["\\/bfnrt]" contained 28 | syn match jsonEscape "\\u\x\{4}" contained 29 | 30 | " Syntax: Strings should always be enclosed with quotes. 31 | syn match jsonNoQuotes "\<\a\+\>" 32 | 33 | " Syntax: Numbers {{{2 34 | syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" 35 | 36 | " Syntax: An integer part of 0 followed by other digits is not allowed. 37 | syn match jsonNumError "-\=\<0\d\.\d*\>" 38 | 39 | " Syntax: Boolean {{{2 40 | syn keyword jsonBoolean true false 41 | 42 | " Syntax: Null {{{2 43 | syn keyword jsonNull null 44 | 45 | " Syntax: Braces {{{2 46 | syn match jsonBraces "[{}\[\]]" 47 | 48 | " Define the default highlighting. {{{1 49 | " For version 5.7 and earlier: only when not done already 50 | " For version 5.8 and later: only when an item doesn't have highlighting yet 51 | if version >= 508 || !exists("did_json_syn_inits") 52 | if version < 508 53 | let did_json_syn_inits = 1 54 | command -nargs=+ HiLink hi link 55 | else 56 | command -nargs=+ HiLink hi def link 57 | endif 58 | HiLink jsonString String 59 | HiLink jsonEscape Special 60 | HiLink jsonNumber Number 61 | HiLink jsonBraces Operator 62 | HiLink jsonNull Function 63 | HiLink jsonBoolean Boolean 64 | 65 | HiLink jsonNumError Error 66 | HiLink jsonStringSQ Error 67 | HiLink jsonNoQuotes Error 68 | delcommand HiLink 69 | endif 70 | 71 | let b:current_syntax = "json" 72 | if main_syntax == 'json' 73 | unlet main_syntax 74 | endif 75 | 76 | " Vim settings {{{2 77 | " vim: ts=8 fdm=marker 78 | -------------------------------------------------------------------------------- /.vim/snippets/tex.snippets: -------------------------------------------------------------------------------- 1 | # \begin{}...\end{} 2 | snippet begin 3 | \begin{${1:env}} 4 | ${2} 5 | \end{$1} 6 | # Tabular 7 | snippet tab 8 | \begin{${1:tabular}}{${2:c}} 9 | ${3} 10 | \end{$1} 11 | # Align(ed) 12 | snippet ali 13 | \begin{align${1:ed}} 14 | ${2} 15 | \end{align$1} 16 | # Gather(ed) 17 | snippet gat 18 | \begin{gather${1:ed}} 19 | ${2} 20 | \end{gather$1} 21 | # Equation 22 | snippet eq 23 | \begin{equation} 24 | ${1} 25 | \end{equation} 26 | # Unnumbered Equation 27 | snippet \ 28 | \\[ 29 | ${1} 30 | \\] 31 | # Enumerate 32 | snippet enum 33 | \begin{enumerate} 34 | \item ${1} 35 | \end{enumerate} 36 | # Itemize 37 | snippet item 38 | \begin{itemize} 39 | \item ${1} 40 | \end{itemize} 41 | # Description 42 | snippet desc 43 | \begin{description} 44 | \item[${1}] ${2} 45 | \end{description} 46 | # Matrix 47 | snippet mat 48 | \begin{${1:p/b/v/V/B/small}matrix} 49 | ${2} 50 | \end{$1matrix} 51 | # Cases 52 | snippet cas 53 | \begin{cases} 54 | ${1:equation}, &\text{ if }${2:case}\\ 55 | ${3} 56 | \end{cases} 57 | # Split 58 | snippet spl 59 | \begin{split} 60 | ${1} 61 | \end{split} 62 | # Part 63 | snippet part 64 | \part{${1:part name}} % (fold) 65 | \label{prt:${2:$1}} 66 | ${3} 67 | % part $2 (end) 68 | # Chapter 69 | snippet cha 70 | \chapter{${1:chapter name}} % (fold) 71 | \label{cha:${2:$1}} 72 | ${3} 73 | % chapter $2 (end) 74 | # Section 75 | snippet sec 76 | \section{${1:section name}} % (fold) 77 | \label{sec:${2:$1}} 78 | ${3} 79 | % section $2 (end) 80 | # Sub Section 81 | snippet sub 82 | \subsection{${1:subsection name}} % (fold) 83 | \label{sub:${2:$1}} 84 | ${3} 85 | % subsection $2 (end) 86 | # Sub Sub Section 87 | snippet subs 88 | \subsubsection{${1:subsubsection name}} % (fold) 89 | \label{ssub:${2:$1}} 90 | ${3} 91 | % subsubsection $2 (end) 92 | # Paragraph 93 | snippet par 94 | \paragraph{${1:paragraph name}} % (fold) 95 | \label{par:${2:$1}} 96 | ${3} 97 | % paragraph $2 (end) 98 | # Sub Paragraph 99 | snippet subp 100 | \subparagraph{${1:subparagraph name}} % (fold) 101 | \label{subp:${2:$1}} 102 | ${3} 103 | % subparagraph $2 (end) 104 | snippet itd 105 | \item[${1:description}] ${2:item} 106 | snippet figure 107 | ${1:Figure}~\ref{${2:fig:}}${3} 108 | snippet table 109 | ${1:Table}~\ref{${2:tab:}}${3} 110 | snippet listing 111 | ${1:Listing}~\ref{${2:list}}${3} 112 | snippet section 113 | ${1:Section}~\ref{${2:sec:}}${3} 114 | snippet page 115 | ${1:page}~\pageref{${2}}${3} 116 | -------------------------------------------------------------------------------- /.vim/autoload/gocomplete.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_gocode') 2 | finish 3 | endif 4 | let g:loaded_gocode = 1 5 | 6 | fu! s:gocodeCurrentBuffer() 7 | let buf = getline(1, '$') 8 | if &encoding != 'utf-8' 9 | let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")') 10 | endif 11 | if &l:fileformat == 'dos' 12 | " XXX: line2byte() depend on 'fileformat' option. 13 | " so if fileformat is 'dos', 'buf' must include '\r'. 14 | let buf = map(buf, 'v:val."\r"') 15 | endif 16 | let file = tempname() 17 | call writefile(buf, file) 18 | return file 19 | endf 20 | 21 | let s:vim_system = get(g:, 'gocomplete#system_function', 'system') 22 | 23 | fu! s:system(str, ...) 24 | return call(s:vim_system, [a:str] + a:000) 25 | endf 26 | 27 | fu! s:gocodeShellescape(arg) 28 | try 29 | let ssl_save = &shellslash 30 | set noshellslash 31 | return shellescape(a:arg) 32 | finally 33 | let &shellslash = ssl_save 34 | endtry 35 | endf 36 | 37 | fu! s:gocodeCommand(cmd, preargs, args) 38 | for i in range(0, len(a:args) - 1) 39 | let a:args[i] = s:gocodeShellescape(a:args[i]) 40 | endfor 41 | for i in range(0, len(a:preargs) - 1) 42 | let a:preargs[i] = s:gocodeShellescape(a:preargs[i]) 43 | endfor 44 | let result = s:system(printf('gocode %s %s %s', join(a:preargs), a:cmd, join(a:args))) 45 | if v:shell_error != 0 46 | return "[\"0\", []]" 47 | else 48 | if &encoding != 'utf-8' 49 | let result = iconv(result, 'utf-8', &encoding) 50 | endif 51 | return result 52 | endif 53 | endf 54 | 55 | fu! s:gocodeCurrentBufferOpt(filename) 56 | return '-in=' . a:filename 57 | endf 58 | 59 | fu! s:gocodeCursor() 60 | if &encoding != 'utf-8' 61 | let c = col('.') 62 | let buf = line('.') == 1 ? "" : (join(getline(1, line('.')-1), "\n") . "\n") 63 | let buf .= c == 1 ? "" : getline('.')[:c-2] 64 | return printf('%d', len(iconv(buf, &encoding, "utf-8"))) 65 | endif 66 | return printf('%d', line2byte(line('.')) + (col('.')-2)) 67 | endf 68 | 69 | fu! s:gocodeAutocomplete() 70 | let filename = s:gocodeCurrentBuffer() 71 | let result = s:gocodeCommand('autocomplete', 72 | \ [s:gocodeCurrentBufferOpt(filename), '-f=vim'], 73 | \ [expand('%:p'), s:gocodeCursor()]) 74 | call delete(filename) 75 | return result 76 | endf 77 | 78 | fu! gocomplete#Complete(findstart, base) 79 | "findstart = 1 when we need to get the text length 80 | if a:findstart == 1 81 | execute "silent let g:gocomplete_completions = " . s:gocodeAutocomplete() 82 | return col('.') - g:gocomplete_completions[0] - 1 83 | "findstart = 0 when we need to return the list of completions 84 | else 85 | return g:gocomplete_completions[1] 86 | endif 87 | endf 88 | -------------------------------------------------------------------------------- /.vim/snippets/c.snippets: -------------------------------------------------------------------------------- 1 | # main() 2 | snippet main 3 | int main(int argc, const char *argv[]) 4 | { 5 | ${1} 6 | return 0; 7 | } 8 | # #include <...> 9 | snippet inc 10 | #include <${1:stdio}.h>${2} 11 | # #include "..." 12 | snippet Inc 13 | #include "${1:`Filename("$1.h")`}"${2} 14 | # #ifndef ... #define ... #endif 15 | snippet Def 16 | #ifndef $1 17 | #define ${1:SYMBOL} ${2:value} 18 | #endif${3} 19 | snippet def 20 | #define 21 | snippet ifdef 22 | #ifdef ${1:FOO} 23 | ${2:#define } 24 | #endif 25 | snippet #if 26 | #if ${1:FOO} 27 | ${2} 28 | #endif 29 | # Header Include-Guard 30 | # (the randomizer code is taken directly from TextMate; it could probably be 31 | # cleaner, I don't know how to do it in vim script) 32 | snippet once 33 | #ifndef ${1:`toupper(Filename('', 'UNTITLED').'_'.system("/usr/bin/ruby -e 'print (rand * 2821109907455).round.to_s(36)'"))`} 34 | 35 | #define $1 36 | 37 | ${2} 38 | 39 | #endif /* end of include guard: $1 */ 40 | # If Condition 41 | snippet if 42 | if (${1:/* condition */}) { 43 | ${2:/* code */} 44 | } 45 | snippet el 46 | else { 47 | ${1} 48 | } 49 | # Tertiary conditional 50 | snippet t 51 | ${1:/* condition */} ? ${2:a} : ${3:b} 52 | # Do While Loop 53 | snippet do 54 | do { 55 | ${2:/* code */} 56 | } while (${1:/* condition */}); 57 | # While Loop 58 | snippet wh 59 | while (${1:/* condition */}) { 60 | ${2:/* code */} 61 | } 62 | # For Loop 63 | snippet for 64 | for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { 65 | ${4:/* code */} 66 | } 67 | # Custom For Loop 68 | snippet forr 69 | for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { 70 | ${5:/* code */} 71 | } 72 | # Function 73 | snippet fun 74 | ${1:void} ${2:function_name}(${3}) 75 | { 76 | ${4:/* code */} 77 | } 78 | # Function Declaration 79 | snippet fund 80 | ${1:void} ${2:function_name}(${3});${4} 81 | # Typedef 82 | snippet td 83 | typedef ${1:int} ${2:MyCustomType};${3} 84 | # Struct 85 | snippet st 86 | struct ${1:`Filename('$1_t', 'name')`} { 87 | ${2:/* data */} 88 | }${3: /* optional variable list */};${4} 89 | # Typedef struct 90 | snippet tds 91 | typedef struct ${2:_$1 }{ 92 | ${3:/* data */} 93 | } ${1:`Filename('$1_t', 'name')`}; 94 | # Typdef enum 95 | snippet tde 96 | typedef enum { 97 | ${1:/* data */} 98 | } ${2:foo}; 99 | # printf 100 | # unfortunately version this isn't as nice as TextMates's, given the lack of a 101 | # dynamic `...` 102 | snippet pr 103 | printf("${1:%s}\n"${2});${3} 104 | # fprintf (again, this isn't as nice as TextMate's version, but it works) 105 | snippet fpr 106 | fprintf(${1:stderr}, "${2:%s}\n"${3});${4} 107 | snippet . 108 | [${1}]${2} 109 | snippet un 110 | unsigned 111 | -------------------------------------------------------------------------------- /local/bin/nginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Startup script for Nginx - this script starts and stops the nginx daemon 4 | # 5 | # description: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server 6 | # processname: nginx 7 | # config: /usr/local/nginx/conf/nginx.conf 8 | # pidfile: /usr/local/nginx/logs/nginx.pid 9 | 10 | # Source function library. 11 | #. /etc/rc.d/init.d/functions 12 | 13 | # Source networking configuration. 14 | #. /etc/sysconfig/network 15 | 16 | # Check that networking is up. 17 | [ "$NETWORKING" = "no" ] && exit 0 18 | 19 | nginx="$HOME/nginx/sbin/nginx" 20 | prog=$nginx 21 | 22 | NGINX_CONF_FILE="$HOME/nginx/conf/nginx.conf" 23 | 24 | #[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx 25 | 26 | # global functions { 27 | work_pids="" 28 | function get_work_pids() 29 | { 30 | work_pids=$(ps aux | grep "$prog"| grep -v grep | awk '{print $2}' | xargs) 31 | } 32 | 33 | start() { 34 | [ -x $nginx ] || exit 5 35 | [ -f $NGINX_CONF_FILE ] || exit 6 36 | 37 | get_work_pids 38 | if [ "$work_pids" == "" ]; then 39 | echo "It is no process working, so let it start to work." 40 | else 41 | echo "It has process working now, please stop it before start it." 42 | exit -1 43 | fi 44 | 45 | $nginx -c $NGINX_CONF_FILE 46 | retval=$? 47 | return $retval 48 | } 49 | 50 | stop() { 51 | get_work_pids 52 | kill_pids=$work_pids 53 | #no process need to quit 54 | if [ "$kill_pids" == "" ]; then 55 | echo "No process need to quit..." 56 | exit 0 57 | fi 58 | 59 | $nginx -s quit 60 | retval=$? 61 | echo 62 | [ $retval -eq 0 ] && rm -f $lockfile 63 | return $retval 64 | } 65 | 66 | restart() { 67 | configtest || return $? 68 | stop 69 | sleep 1 70 | start 71 | } 72 | 73 | reload() { 74 | configtest || return $? 75 | echo -n $"Reloading $prog: " 76 | $nginx -s reload 77 | RETVAL=$? 78 | echo 79 | } 80 | 81 | force_reload() { 82 | restart 83 | } 84 | 85 | configtest() { 86 | $nginx -t -c $NGINX_CONF_FILE 87 | } 88 | 89 | rh_status() { 90 | status $prog 91 | } 92 | 93 | rh_status_q() { 94 | rh_status >/dev/null 2>&1 95 | } 96 | 97 | case "$1" in 98 | start) 99 | rh_status_q && exit 0 100 | $1 101 | ;; 102 | stop) 103 | rh_status_q || exit 0 104 | $1 105 | ;; 106 | restart|configtest) 107 | $1 108 | ;; 109 | reload) 110 | rh_status_q || exit 7 111 | $1 112 | ;; 113 | force-reload) 114 | force_reload 115 | ;; 116 | status) 117 | rh_status 118 | ;; 119 | condrestart|try-restart) 120 | rh_status_q || exit 0 121 | ;; 122 | *) 123 | echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" 124 | exit 2 125 | esac 126 | -------------------------------------------------------------------------------- /local/colordiff/README: -------------------------------------------------------------------------------- 1 | Name 2 | 3 | colordiff — a tool to colorize diff output 4 | 5 | Synopsis 6 | 7 | colordiff [diff options] {file1} {file2} 8 | 9 | Description 10 | 11 | colordiff is a wrapper for diff and produces the same output as diff but with 12 | coloured syntax highlighting at the command line to improve readability. The 13 | output is similar to how a diff-generated patch might appear in Vim or Emacs 14 | with the appropriate syntax highlighting options enabled. The colour schemes 15 | can be read from a central configuration file or from a local user ~ 16 | /.colordiffrc file. 17 | 18 | colordiff makes use of ANSI colours and as such will only work when ANSI 19 | colours can be used - typical examples are xterms and Eterms, as well as 20 | console sessions. 21 | 22 | colordiff has been tested on various flavours of Linux and under OpenBSD, but 23 | should be broadly portable to other systems. 24 | 25 | Usage 26 | 27 | Use colordiff wherever you would normally use diff, or pipe output to 28 | colordiff: 29 | 30 | For example: 31 | 32 | $ colordiff file1 file2 33 | $ diff -u file1 file2 | colordiff 34 | 35 | You can pipe the output to 'less', using the '-R' option (some systems or 36 | terminal types may get better results using '-r' instead), which keeps the 37 | colour escape sequences, otherwise displayed incorrectly or discarded by 38 | 'less': 39 | 40 | $ diff -u file1 file2 | colordiff | less -R 41 | 42 | If you have wdiff installed, colordiff will correctly colourise the added and 43 | removed text, provided that the '-n' option is given to wdiff: 44 | 45 | $ wdiff -n file1 file2 | colordiff 46 | 47 | You may find it useful to make diff automatically call colordiff. Add the 48 | following line to ~/.bashrc (or equivalent): 49 | 50 | alias diff=colordiff 51 | 52 | Any options passed to colordiff are passed through to diff. 53 | 54 | Alternatively, a construct such as 'cvs diff SOMETHING | colordiff' can be 55 | included in ~/.bashrc as follows: 56 | 57 | function cvsdiff () { cvs diff $@ | colordiff; } 58 | 59 | Or, combining the idea above using 'less': 60 | 61 | function cvsdiff () { cvs diff $@ | colordiff |less -R; } 62 | 63 | Note that the function name, cvsdiff, can be customized. 64 | 65 | Any options passed to colordiff are passed through to diff except for 66 | the colordiff-specific option 'difftype', e.g. 67 | 68 | colordiff --difftype=debdiff file1 file2 69 | 70 | Valid values for 'difftype' are: diff, diffc, diffu, diffy, wdiff, debdiff; 71 | these correspond to plain diffs, context diffs, unified diffs, side-by-side 72 | diffs, wdiff output and debdiff output respectively. Use these overrides when 73 | colordiff is not able to determine the diff-type automatically. 74 | 75 | Files 76 | 77 | /etc/colordiffrc 78 | 79 | Central configuration file. User-specific settings can be enabled by 80 | copying this file to ~/.colordiffrc and making the appropriate changes. 81 | 82 | colordiffrc-lightbg 83 | 84 | Alternate configuration template for use with terminals having light 85 | backgrounds. Copy this to /etc/colordiffrc or ~/.colordiffrc and customize. 86 | 87 | Bugs 88 | 89 | Bug reports and suggestions/patches to please. 90 | 91 | Author 92 | 93 | colordiff is written and maintained by Dave Ewart . This 94 | manual page and the source XML was written by Graham Wilson 95 | for Debian and is maintained by the author. Dave Ewart maintains the Debian 96 | package. 97 | 98 | -------------------------------------------------------------------------------- /.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = "faker" 3 | email = "faker@game.com" 4 | 5 | [merge] 6 | summary = true 7 | tool = vimdiff 8 | 9 | [diff] 10 | renames = copy 11 | tool = vimdiff 12 | 13 | [difftool] 14 | prompt = no 15 | [diff "odf"] 16 | command = odt2txt 17 | [diff "jpg"] 18 | command = exiftool 19 | 20 | [color] 21 | diff = always 22 | branch = auto 23 | interactive = auto 24 | grep = auto 25 | status = true 26 | showbranch = auto 27 | ui = true 28 | 29 | [color "diff"] 30 | meta = magenta black bold 31 | whitespace = red reverse 32 | 33 | [color "branch"] 34 | current = bold green 35 | local = normal 36 | remote = bold red 37 | upstream = bold blue 38 | 39 | [status] 40 | submodulesummary = -1 41 | 42 | [format] 43 | numbered = auto 44 | 45 | [alias] 46 | sed = !git ls-files --stage | grep ^100 | awk '{print $4}' | xargs sed $@ 47 | 48 | # 日志操作简化,并将日志格式化 49 | who = shortlog -n -s --no-merges 50 | lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit 51 | lp = log --color --pretty=oneline --abbrev-commit --graph --decorate 52 | lns = log --color --name-status --date=iso 53 | lst = log --color --stat --date=iso 54 | ldi = log --color --date=iso 55 | ldp = log --color --date=iso -p 56 | ls = log --oneline 57 | # 最新一条 commit log 摘要 58 | l1 = !git --no-pager log --max-count=1 --date=iso 59 | # 最后一次提交的 hash 串 60 | lh = rev-parse HEAD 61 | 62 | gpc= grep -n --color -E 63 | ci = commit 64 | co = checkout 65 | st = status 66 | # 查看远程分支,远程分支会用红色表示出来 67 | ba = branch -a 68 | bv = branch -v 69 | bm = branch -m 70 | bd = branch -d 71 | bc = checkout -b 72 | cb = checkout -b 73 | rt = reset --hard 74 | cp = cherry-pick -x 75 | nb = checkout -b 76 | mg = merge 77 | df = diff 78 | rv = remote -v 79 | fa = fetch --all 80 | # 刻意地创造提交线图分叉 81 | mnf = merge --no-ff 82 | rso = remote show origin 83 | # 清除除在本地有但在远程库中已经不存在的分支 git fetch -p 84 | rpo = remote prune origin 85 | 86 | # 'git add -u' 只包含刪除的檔案,不包含新增檔案 87 | # 'git add .' 包含修改和新增的檔案,但是不包含刪除 88 | # 'git addall' 通通加到 staging 89 | au = add -u 90 | awd= add . 91 | aa = !sh -c 'git add . && git add -u' 92 | 93 | # To list untracked files 94 | ut = ls-files --other --exclude-standard 95 | # list tracked files 96 | tf = ls-files 97 | # show modified files 98 | lm = ls-files -m 99 | # show deleted files 100 | ld = ls-files -d 101 | # show unmerged files 102 | lu = ls-files -u 103 | 104 | unstage = reset HEAD 105 | uncommit = reset --soft HEAD^ 106 | amend = commit --amend 107 | 108 | # 使用 vimdiff 查看 diff 文件 109 | vdf = difftool 110 | 111 | # 临时保存 112 | ss = stash save 113 | sp = stash pop 114 | sl = stash list 115 | 116 | [core] 117 | # 对 0x80以上的字符不进行quote,以正常显示中文 118 | quotepath = false 119 | editor = vim 120 | 121 | [branch "master"] 122 | remote = origin 123 | merge = refs/heads/master 124 | 125 | [push] 126 | # nothing, matching, upstream, simple, current 127 | default = simple 128 | [filter "lfs"] 129 | clean = git-lfs clean -- %f 130 | smudge = git-lfs smudge -- %f 131 | process = git-lfs filter-process 132 | required = true 133 | -------------------------------------------------------------------------------- /.ctags: -------------------------------------------------------------------------------- 1 | --exclude=.git 2 | --exclude=.hg 3 | --exclude=log 4 | --exclude=tmp 5 | 6 | --regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+):([a-zA-Z0-9_]+).*$/\2/f,function/ 7 | --regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+).*$/\2/f,function/ 8 | --regex-LUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\s*\(.*$/\1/f,function/ 9 | --regex-LUA=/([a-zA-Z0-9_]+) = require[ (]"([^"]+)"/\1/r,require/ 10 | --regex-LUA=/[ \t]{1}([a-zA-Z0-9_]+)[ \t]*[=][^=]/\1/v,variable/ 11 | --regex-LUA=/[ \t]*([a-zA-Z0-9_]+)[ \t]*=[ \t]*module_define.*$/\1/m,module/ 12 | --regex-LUA=/func_table\[ msg\.([A-Z_]+) \].+/\1/ 13 | --regex-LUA=/\([ \t]*msg.([A-Z_]+)[ \t]*\)/\1/ 14 | 15 | --langdef=Rust 16 | --langmap=Rust:.rs 17 | --regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\6/f,functions,function definitions/ 18 | --regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/ 19 | --regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/ 20 | --regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/ 21 | --regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/ 22 | --regex-Rust=/^[ \t]*(pub[ \t]+)?(static|const)[ \t]+(mut[ \t]+)?([a-zA-Z0-9_]+)/\4/c,consts,static constants/ 23 | --regex-Rust=/^[ \t]*(pub[ \t]+)?(unsafe[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\3/t,traits,traits/ 24 | --regex-Rust=/^[ \t]*(pub[ \t]+)?(unsafe[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\5 \7 \8/i,impls,trait implementations/ 25 | --regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/ 26 | 27 | --regex-PHP=/abstract class ([^ ]*)/\1/c/ 28 | --regex-PHP=/interface ([^ ]*)/\1/c/ 29 | --regex-PHP=/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/ 30 | 31 | --langdef=golang 32 | --langmap=golang:.go 33 | --regex-golang=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/ 34 | --regex-golang=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/ 35 | --regex-golang=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/ 36 | 37 | --langdef=js 38 | --langmap=js:.js 39 | --langmap=js:+.jsx 40 | 41 | --regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/ 42 | 43 | --regex-js=/\.([A-Za-z0-9._$]+)[ \t]*=[ \t]*\{/\1/o,object/ 44 | --regex-js=/['"]*([A-Za-z0-9_$]+)['"]*[ \t]*:[ \t]*\{/\1/o,object/ 45 | --regex-js=/([A-Za-z0-9._$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*\{/\1\.\2/o,object/ 46 | 47 | --regex-js=/([A-Za-z0-9._$]+)[ \t]*=[ \t]*\(function\(\)/\1/c,class/ 48 | --regex-js=/['"]*([A-Za-z0-9_$]+)['"]*:[ \t]*\(function\(\)/\1/c,class/ 49 | --regex-js=/class[ \t]+([A-Za-z0-9._$]+)[ \t]*/\1/c,class/ 50 | --regex-js=/([A-Za-z$][A-Za-z0-9_$()]+)[ \t]*=[ \t]*[Rr]eact.createClass[ \t]*\(/\1/c,class/ 51 | --regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*=[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/ 52 | --regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*:[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/ 53 | 54 | --regex-js=/([A-Za-z$][A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\1/f,function/ 55 | 56 | --regex-js=/(function)*[ \t]*([A-Za-z$_][A-Za-z0-9_$]+)[ \t]*\([^)]*\)[ \t]*\{/\2/f,function/ 57 | --regex-js=/['"]*([A-Za-z$][A-Za-z0-9_$]+)['"]*:[ \t]*function[ \t]*\(/\1/m,method/ 58 | --regex-js=/([A-Za-z0-9_$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*function[ \t]*\(/\2/m,method/ 59 | 60 | --langdef=swift 61 | --langmap=swift:.swift 62 | --regex-swift=/[[:<:]]class[[:>:]][[:space:]]+([[:alnum:]_]+)/\1/c,class/ 63 | --regex-swift=/[[:<:]]enum[[:>:]][[:space:]]+([[:alnum:]_]+)/\1/e,enum/ 64 | --regex-swift=/[[:<:]]func[[:>:]][[:space:]]+([[:alnum:]_]+)/\1/f,function/ 65 | --regex-swift=/[[:<:]]protocol[[:>:]][[:space:]]+([[:alnum:]_]+)/\1/P,protocol/ 66 | --regex-swift=/[[:<:]]struct[[:>:]][[:space:]]+([[:alnum:]_]+)/\1/s,struct/ 67 | --regex-swift=/[[:<:]]extension[[:>:]][[:space:]]+([[:alnum:]_]+)/\1/E,extension/ 68 | --regex-swift=/[[:<:]]typealias[[:>:]][[:space:]]+([[:alnum:]_]+)/\1/t,typealias/ 69 | -------------------------------------------------------------------------------- /.vim/syntax/nerdtree.vim: -------------------------------------------------------------------------------- 1 | let s:tree_up_dir_line = '.. (up a dir)' 2 | "NERDTreeFlags are syntax items that should be invisible, but give clues as to 3 | "how things should be highlighted 4 | syn match NERDTreeFlag #\~# 5 | syn match NERDTreeFlag #\[RO\]# 6 | 7 | "highlighting for the .. (up dir) line at the top of the tree 8 | execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#" 9 | 10 | "highlighting for the ~/+ symbols for the directory nodes 11 | syn match NERDTreeClosable #\~\<# 12 | syn match NERDTreeClosable #\~\.# 13 | syn match NERDTreeOpenable #+\<# 14 | syn match NERDTreeOpenable #+\.#he=e-1 15 | 16 | "highlighting for the tree structural parts 17 | syn match NERDTreePart #|# 18 | syn match NERDTreePart #`# 19 | syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart 20 | 21 | "quickhelp syntax elements 22 | syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1 23 | syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1 24 | syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag 25 | syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey 26 | syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey 27 | syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3 28 | syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand 29 | 30 | "highlighting for readonly files 31 | syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile 32 | 33 | "highlighting for sym links 34 | syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash 35 | 36 | "highlighing for directory nodes and file nodes 37 | syn match NERDTreeDirSlash #/# 38 | syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable 39 | syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark 40 | syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile 41 | syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile 42 | syn match NERDTreeCWD #^[# 49 | syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader 50 | syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader 51 | syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader 52 | 53 | if exists("g:NERDChristmasTree") && g:NERDChristmasTree 54 | hi def link NERDTreePart Special 55 | hi def link NERDTreePartFile Type 56 | hi def link NERDTreeFile Normal 57 | hi def link NERDTreeExecFile Title 58 | hi def link NERDTreeDirSlash Identifier 59 | hi def link NERDTreeClosable Type 60 | else 61 | hi def link NERDTreePart Normal 62 | hi def link NERDTreePartFile Normal 63 | hi def link NERDTreeFile Normal 64 | hi def link NERDTreeClosable Title 65 | endif 66 | 67 | hi def link NERDTreeBookmarksHeader statement 68 | hi def link NERDTreeBookmarksLeader ignore 69 | hi def link NERDTreeBookmarkName Identifier 70 | hi def link NERDTreeBookmark normal 71 | 72 | hi def link NERDTreeHelp String 73 | hi def link NERDTreeHelpKey Identifier 74 | hi def link NERDTreeHelpCommand Identifier 75 | hi def link NERDTreeHelpTitle Macro 76 | hi def link NERDTreeToggleOn Question 77 | hi def link NERDTreeToggleOff WarningMsg 78 | 79 | hi def link NERDTreeDir Directory 80 | hi def link NERDTreeUp Directory 81 | hi def link NERDTreeCWD Statement 82 | hi def link NERDTreeLink Macro 83 | hi def link NERDTreeOpenable Title 84 | hi def link NERDTreeFlag ignore 85 | hi def link NERDTreeRO WarningMsg 86 | hi def link NERDTreeBookmark Statement 87 | 88 | hi def link NERDTreeCurrentNode Search 89 | -------------------------------------------------------------------------------- /.vim/snippets/objc.snippets: -------------------------------------------------------------------------------- 1 | # #import <...> 2 | snippet Imp 3 | #import <${1:Cocoa/Cocoa.h}>${2} 4 | # #import "..." 5 | snippet imp 6 | #import "${1:`Filename()`.h}"${2} 7 | # @selector(...) 8 | snippet sel 9 | @selector(${1:method}:)${3} 10 | # @"..." string 11 | snippet s 12 | @"${1}"${2} 13 | # Object 14 | snippet o 15 | ${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5} 16 | # NSLog(...) 17 | snippet log 18 | NSLog(@"${1:%@}"${2});${3} 19 | # Class 20 | snippet objc 21 | @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} 22 | { 23 | } 24 | @end 25 | 26 | @implementation $1 27 | ${3} 28 | @end 29 | # Class Interface 30 | snippet int 31 | @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} 32 | {${3} 33 | } 34 | ${4} 35 | @end 36 | # Class Implementation 37 | snippet impl 38 | @implementation ${1:`Filename('', 'someClass')`} 39 | ${2} 40 | @end 41 | snippet init 42 | - (id)init 43 | { 44 | [super init]; 45 | return self; 46 | } 47 | snippet ifself 48 | if (self = [super init]) { 49 | ${1:/* code */} 50 | } 51 | return self; 52 | snippet ibo 53 | IBOutlet ${1:NSSomeClass} *${2:$1};${3} 54 | # Category 55 | snippet cat 56 | @interface ${1:NSObject} (${2:Category}) 57 | @end 58 | 59 | @implementation $1 ($2) 60 | ${3} 61 | @end 62 | # Category Interface 63 | snippet cath 64 | @interface ${1:NSObject} (${2:Category}) 65 | ${3} 66 | @end 67 | # NSArray 68 | snippet array 69 | NSMutableArray *${1:array} = [NSMutable array];${2} 70 | # NSDictionary 71 | snippet dict 72 | NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2} 73 | # NSBezierPath 74 | snippet bez 75 | NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2} 76 | # Method 77 | snippet m 78 | - (${1:id})${2:method} 79 | { 80 | ${3} 81 | } 82 | # Method declaration 83 | snippet md 84 | - (${1:id})${2:method};${3} 85 | # IBAction declaration 86 | snippet ibad 87 | - (IBAction)${1:method}:(${2:id})sender;${3} 88 | # IBAction method 89 | snippet iba 90 | - (IBAction)${1:method}:(${2:id})sender 91 | { 92 | ${3} 93 | } 94 | # awakeFromNib method 95 | snippet wake 96 | - (void)awakeFromNib 97 | { 98 | ${1} 99 | } 100 | # Class Method 101 | snippet M 102 | + (${1:id})${2:method} 103 | {${3} 104 | return nil; 105 | } 106 | # Sub-method (Call super) 107 | snippet sm 108 | - (${1:id})${2:method} 109 | { 110 | [super $2];${3} 111 | return self; 112 | } 113 | # Method: Initialize 114 | snippet I 115 | + (void) initialize 116 | { 117 | [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys: 118 | ${1}@"value", @"key", 119 | nil]]; 120 | } 121 | # Accessor Methods For: 122 | # Object 123 | snippet objacc 124 | - (${1:id})${2:thing} 125 | { 126 | return $2; 127 | } 128 | 129 | - (void)set$2:($1)${3:new$2} 130 | { 131 | [$3 retain]; 132 | [$2 release]; 133 | $2 = $3; 134 | }${4} 135 | # for (object in array) 136 | snippet forin 137 | for (${1:Class} *${2:some$1} in ${3:array}) { 138 | ${4} 139 | } 140 | snippet forarray 141 | unsigned int ${1:object}Count = [${2:array} count]; 142 | 143 | for (unsigned int index = 0; index < $1Count; index++) { 144 | ${3:id} $1 = [$2 $1AtIndex:index]; 145 | ${4} 146 | } 147 | # IBOutlet 148 | # @property (Objective-C 2.0) 149 | snippet prop 150 | @property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4} 151 | # @synthesize (Objective-C 2.0) 152 | snippet syn 153 | @synthesize ${1:property};${2} 154 | # [[ alloc] init] 155 | snippet alloc 156 | [[${1:foo} alloc] init${2}];${3} 157 | # retain 158 | snippet ret 159 | [${1:foo} retain];${2} 160 | # release 161 | snippet rel 162 | [${1:foo} release]; 163 | ${2:$1 = nil;} 164 | # autorelease 165 | snippet arel 166 | [${1:foo} autorelease]; 167 | # autorelease pool 168 | snippet pool 169 | NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init]; 170 | ${2:/* code */} 171 | [$1 drain]; 172 | # Throw an exception 173 | snippet except 174 | NSException *${1:badness}; 175 | $1 = [NSException exceptionWithName:@"${2:$1Name}" 176 | reason:@"${3}" 177 | userInfo:nil]; 178 | [$1 raise]; 179 | snippet prag 180 | #pragma mark ${1:foo} 181 | snippet cl 182 | @class ${1:Foo};${2} 183 | snippet color 184 | [[NSColor ${1:blackColor}] set]; 185 | -------------------------------------------------------------------------------- /local/colordiff/colordiff.1: -------------------------------------------------------------------------------- 1 | .\" Title: colordiff 2 | .\" Author: 3 | .\" Generator: DocBook XSL Stylesheets v1.73.2 4 | .\" Date: 01/25/2009 5 | .\" Manual: 6 | .\" Source: 7 | .\" 8 | .TH "COLORDIFF" "1" "01/25/2009" "" "" 9 | .\" disable hyphenation 10 | .nh 11 | .\" disable justification (adjust text to left margin only) 12 | .ad l 13 | .SH "NAME" 14 | colordiff \- a tool to colorize diff output 15 | .SH "SYNOPSIS" 16 | .HP 10 17 | \fBcolordiff\fR [\fI\fBdiff\fR\fR\fI\ options\fR] [\fIcolordiff\fR\fI\ options\fR] {\fIfile1\fR} {\fIfile2\fR} 18 | .SH "DESCRIPTION" 19 | .PP 20 | colordiff 21 | is a wrapper for 22 | \fBdiff\fR 23 | and produces the same output as 24 | \fBdiff\fR 25 | but with coloured syntax highlighting at the command line to improve readability\&. The output is similar to how a 26 | \fBdiff\fR\-generated patch might appear in 27 | Vim 28 | or 29 | Emacs 30 | with the appropriate syntax highlighting options enabled\&. The colour schemes can be read from a central configuration file or from a local user 31 | \fI~/\&.colordiffrc\fR 32 | file\&. 33 | .PP 34 | colordiff 35 | makes use of ANSI colours and as such will only work when ANSI colours can be used \- typical examples are xterms and Eterms, as well as console sessions\&. 36 | .PP 37 | colordiff 38 | has been tested on various flavours of Linux and under OpenBSD, but should be broadly portable to other systems\&. 39 | .SH "USAGE" 40 | .PP 41 | Use 42 | colordiff 43 | wherever you would normally use 44 | \fBdiff\fR, or pipe output to 45 | colordiff: 46 | .PP 47 | For example: 48 | .sp 49 | .RS 4 50 | .nf 51 | $ colordiff file1 file2 52 | $ diff \-u file1 file2 | colordiff 53 | .fi 54 | .RE 55 | .PP 56 | You can pipe the output to \'less\', using the \'\-R\' option (some systems or terminal types may get better results using \'\-r\' instead), which keeps the colour escape sequences, otherwise displayed incorrectly or discarded by \'less\': 57 | .sp 58 | .RS 4 59 | .nf 60 | $ diff \-u file1 file2 | colordiff | less \-R 61 | .fi 62 | .RE 63 | .PP 64 | If you have 65 | \fBwdiff\fR 66 | installed, colordiff will correctly colourise the added and removed text, provided that the \'\-n\' option is given to 67 | \fBwdiff\fR: 68 | .sp 69 | .RS 4 70 | .nf 71 | $ wdiff \-n file1 file2 | colordiff 72 | .fi 73 | .RE 74 | .PP 75 | You may find it useful to make 76 | \fBdiff\fR 77 | automatically call 78 | \fBcolordiff\fR\&. Add the following line to 79 | \fI~/\&.bashrc\fR 80 | (or equivalent): 81 | .sp 82 | .RS 4 83 | .nf 84 | alias diff=colordiff 85 | .fi 86 | .RE 87 | .PP 88 | Any options passed to 89 | colordiff 90 | are passed through to 91 | \fBdiff\fR 92 | except for the colordiff\-specific option \'difftype\', e\&.g\&. 93 | .sp 94 | .RS 4 95 | .nf 96 | colordiff \-\-difftype=debdiff file1 file2 97 | .fi 98 | .RE 99 | .PP 100 | Valid values for \'difftype\' are: diff, diffc, diffu, diffy, wdiff, debdiff; these correspond to plain diffs, context diffs, unified diffs, side\-by\-side diffs, wdiff output and debdiff output respectively\&. Use these overrides when colordiff is not able to determine the diff\-type automatically\&. 101 | .PP 102 | Alternatively, a construct such as \'cvs diff SOMETHING | colordiff\' can be included in 103 | \fI~/\&.bashrc\fR 104 | as follows: 105 | .sp 106 | .RS 4 107 | .nf 108 | function cvsdiff () { cvs diff $@ | colordiff; } 109 | .fi 110 | .RE 111 | .PP 112 | Or, combining the idea above using \'less\': 113 | .sp 114 | .RS 4 115 | .nf 116 | function cvsdiff () { cvs diff $@ | colordiff |less \-R; } 117 | .fi 118 | .RE 119 | .PP 120 | Note that the function name, cvsdiff, can be customized\&. 121 | .SH "FILES" 122 | .PP 123 | \fI/etc/colordiffrc\fR 124 | .RS 4 125 | Central configuration file\&. User\-specific settings can be enabled by copying this file to 126 | \fI~/\&.colordiffrc\fR 127 | and making the appropriate changes\&. 128 | .RE 129 | .PP 130 | \fIcolordiffrc\-lightbg\fR 131 | .RS 4 132 | Alternate configuration template for use with terminals having light backgrounds\&. Copy this to /etc/colordiffrc or ~/\&.colordiffrc and customize\&. 133 | .RE 134 | .SH "BUGS" 135 | .PP 136 | Bug reports and suggestions/patches to 137 | 138 | please\&. 139 | .SH "AUTHOR" 140 | .PP 141 | colordiff 142 | is written and maintained by Dave Ewart 143 | \&. This manual page and the source XML was written by Graham Wilson 144 | 145 | for Debian and is maintained by the author\&. Dave Ewart maintains the Debian package, sponsored by Graham Wilson\&. 146 | -------------------------------------------------------------------------------- /.vim/snippets/php.snippets: -------------------------------------------------------------------------------- 1 | snippet php 2 | 5 | snippet ec 6 | echo "${1:string}"${2}; 7 | snippet inc 8 | include '${1:file}';${2} 9 | snippet inc1 10 | include_once '${1:file}';${2} 11 | snippet req 12 | require '${1:file}';${2} 13 | snippet req1 14 | require_once '${1:file}';${2} 15 | # $GLOBALS['...'] 16 | snippet globals 17 | $GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5} 18 | snippet $_ COOKIE['...'] 19 | $_COOKIE['${1:variable}']${2} 20 | snippet $_ ENV['...'] 21 | $_ENV['${1:variable}']${2} 22 | snippet $_ FILES['...'] 23 | $_FILES['${1:variable}']${2} 24 | snippet $_ Get['...'] 25 | $_GET['${1:variable}']${2} 26 | snippet $_ POST['...'] 27 | $_POST['${1:variable}']${2} 28 | snippet $_ REQUEST['...'] 29 | $_REQUEST['${1:variable}']${2} 30 | snippet $_ SERVER['...'] 31 | $_SERVER['${1:variable}']${2} 32 | snippet $_ SESSION['...'] 33 | $_SESSION['${1:variable}']${2} 34 | # Start Docblock 35 | snippet /* 36 | /** 37 | * ${1} 38 | **/ 39 | # Class - post doc 40 | snippet doc_cp 41 | /** 42 | * ${1:undocumented class} 43 | * 44 | * @package ${2:default} 45 | * @author ${3:`g:snips_author`} 46 | **/${4} 47 | # Class Variable - post doc 48 | snippet doc_vp 49 | /** 50 | * ${1:undocumented class variable} 51 | * 52 | * @var ${2:string} 53 | **/${3} 54 | # Class Variable 55 | snippet doc_v 56 | /** 57 | * ${3:undocumented class variable} 58 | * 59 | * @var ${4:string} 60 | **/ 61 | ${1:var} $${2};${5} 62 | # Class 63 | snippet doc_c 64 | /** 65 | * ${3:undocumented class} 66 | * 67 | * @packaged ${4:default} 68 | * @author ${5:`g:snips_author`} 69 | **/ 70 | ${1:}class ${2:} 71 | {${6} 72 | } // END $1class $2 73 | # Constant Definition - post doc 74 | snippet doc_dp 75 | /** 76 | * ${1:undocumented constant} 77 | **/${2} 78 | # Constant Definition 79 | snippet doc_d 80 | /** 81 | * ${3:undocumented constant} 82 | **/ 83 | define(${1}, ${2});${4} 84 | # Function - post doc 85 | snippet doc_fp 86 | /** 87 | * ${1:undocumented function} 88 | * 89 | * @return ${2:void} 90 | * @author ${3:`g:snips_author`} 91 | **/${4} 92 | # Function signature 93 | snippet doc_s 94 | /** 95 | * ${4:undocumented function} 96 | * 97 | * @return ${5:void} 98 | * @author ${6:`g:snips_author`} 99 | **/ 100 | ${1}function ${2}(${3});${7} 101 | # Function 102 | snippet doc_f 103 | /** 104 | * ${4:undocumented function} 105 | * 106 | * @return ${5:void} 107 | * @author ${6:`g:snips_author`} 108 | **/ 109 | ${1}function ${2}(${3}) 110 | {${7} 111 | } 112 | # Header 113 | snippet doc_h 114 | /** 115 | * ${1} 116 | * 117 | * @author ${2:`g:snips_author`} 118 | * @copyright ${4:$2}, `strftime('%Y-%m-%d %T')` 119 | * @package ${5:default} 120 | **/ 121 | 122 | # Interface 123 | snippet doc_i 124 | /** 125 | * ${2:undocumented class} 126 | * 127 | * @package ${3:default} 128 | * @author ${4:`g:snips_author`} 129 | **/ 130 | interface ${1:} 131 | {${5} 132 | } // END interface $1 133 | # class ... 134 | snippet class 135 | /** 136 | * ${1} 137 | **/ 138 | class ${2:ClassName} 139 | { 140 | ${3} 141 | function ${4:__construct}(${5:argument}) 142 | { 143 | ${6:// code...} 144 | } 145 | } 146 | # define(...) 147 | snippet def 148 | define('${1}'${2});${3} 149 | # defined(...) 150 | snippet def? 151 | ${1}defined('${2}')${3} 152 | snippet wh 153 | while (${1:/* condition */}) { 154 | ${2:// code...} 155 | } 156 | # do ... while 157 | snippet do 158 | do { 159 | ${2:// code... } 160 | } while (${1:/* condition */}); 161 | snippet if 162 | if (${1:/* condition */}) { 163 | ${2:// code...} 164 | } 165 | snippet ife 166 | if (${1:/* condition */}) { 167 | ${2:// code...} 168 | } else { 169 | ${3:// code...} 170 | } 171 | ${4} 172 | snippet else 173 | else { 174 | ${1:// code...} 175 | } 176 | snippet elseif 177 | elseif (${1:/* condition */}) { 178 | ${2:// code...} 179 | } 180 | # Tertiary conditional 181 | snippet t 182 | $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} 183 | snippet switch 184 | switch ($${1:variable}) { 185 | case '${2:value}': 186 | ${3:// code...} 187 | break; 188 | ${5} 189 | default: 190 | ${4:// code...} 191 | break; 192 | } 193 | snippet case 194 | case '${1:value}': 195 | ${2:// code...} 196 | break;${3} 197 | snippet for 198 | for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { 199 | ${4: // code...} 200 | } 201 | snippet foreach 202 | foreach ($${1:variable} as $${2:key}) { 203 | ${3:// code...} 204 | } 205 | snippet fun 206 | ${1:public }function ${2:FunctionName}(${3}) 207 | { 208 | ${4:// code...} 209 | } 210 | # $... = array (...) 211 | snippet array 212 | $${1:arrayName} = array('${2}' => ${3});${4} 213 | -------------------------------------------------------------------------------- /.vim/syntax/mkd.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Markdown 3 | " Maintainer: Ben Williams 4 | " URL: http://plasticboy.com/markdown-vim-mode/ 5 | " Version: 9 6 | " Last Change: 2009 May 18 7 | " Remark: Uses HTML syntax file 8 | " Remark: I don't do anything with angle brackets (<>) because that would too easily 9 | " easily conflict with HTML syntax 10 | " TODO: Handle stuff contained within stuff (e.g. headings within blockquotes) 11 | 12 | 13 | " Read the HTML syntax to start with 14 | if version < 600 15 | so :p:h/html.vim 16 | else 17 | runtime! syntax/html.vim 18 | unlet b:current_syntax 19 | endif 20 | 21 | if version < 600 22 | syntax clear 23 | elseif exists("b:current_syntax") 24 | finish 25 | endif 26 | 27 | " don't use standard HiLink, it will not work with included syntax files 28 | if version < 508 29 | command! -nargs=+ HtmlHiLink hi link 30 | else 31 | command! -nargs=+ HtmlHiLink hi def link 32 | endif 33 | 34 | syn spell toplevel 35 | syn case ignore 36 | syn sync linebreaks=1 37 | 38 | "additions to HTML groups 39 | syn region htmlBold start=/\\\@) 51 | syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite 52 | syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline 53 | syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained 54 | syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained 55 | syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained 56 | 57 | "define Markdown groups 58 | syn match mkdLineContinue ".$" contained 59 | syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/ 60 | syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/ 61 | syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/ 62 | syn match mkdRule /^\s*-\{3,}$/ 63 | syn match mkdRule /^\s*\*\{3,5}$/ 64 | syn match mkdListItem "^\s*[-*+]\s\+" 65 | syn match mkdListItem "^\s*\d\+\.\s\+" 66 | syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ 67 | syn match mkdLineBreak / \+$/ 68 | syn region mkdCode start=/\\\@/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell 71 | syn region mkdCode start="]*>" end="" 72 | syn region mkdCode start="]*>" end="" 73 | 74 | "HTML headings 75 | syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell 76 | syn region htmlH2 start="^\s*##" end="\($\|#\+\)" contains=@Spell 77 | syn region htmlH3 start="^\s*###" end="\($\|#\+\)" contains=@Spell 78 | syn region htmlH4 start="^\s*####" end="\($\|#\+\)" contains=@Spell 79 | syn region htmlH5 start="^\s*#####" end="\($\|#\+\)" contains=@Spell 80 | syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contains=@Spell 81 | syn match htmlH1 /^.\+\n=\+$/ contains=@Spell 82 | syn match htmlH2 /^.\+\n-\+$/ contains=@Spell 83 | 84 | "highlighting for Markdown groups 85 | HtmlHiLink mkdString String 86 | HtmlHiLink mkdCode String 87 | HtmlHiLink mkdBlockquote Comment 88 | HtmlHiLink mkdLineContinue Comment 89 | HtmlHiLink mkdListItem Identifier 90 | HtmlHiLink mkdRule Identifier 91 | HtmlHiLink mkdLineBreak Todo 92 | HtmlHiLink mkdLink htmlLink 93 | HtmlHiLink mkdURL htmlString 94 | HtmlHiLink mkdID Identifier 95 | HtmlHiLink mkdLinkDef mkdID 96 | HtmlHiLink mkdLinkDefTarget mkdURL 97 | HtmlHiLink mkdLinkTitle htmlString 98 | 99 | HtmlHiLink mkdDelimiter Delimiter 100 | 101 | let b:current_syntax = "mkd" 102 | 103 | delcommand HtmlHiLink 104 | " vim: ts=8 105 | -------------------------------------------------------------------------------- /op-tools/init-sys.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # @describe: ubuntu 单点服务初始化 3 | 4 | #set -x 5 | set -e 6 | 7 | function usage() { 8 | echo "$0 base|nginx|go|mysql|redis|all" 9 | echo "" 10 | echo "base: dependence,supervisor" 11 | exit 1 12 | } 13 | 14 | if [ $# -lt 1 ] 15 | then 16 | usage 17 | fi 18 | 19 | # 部署目录 20 | top_dir="/work" 21 | # nginx work group 22 | nginx_work="ubuntu" 23 | service=$1 24 | 25 | function init_base () { 26 | sudo apt update 27 | sudo apt upgrade 28 | sudo apt autoremove 29 | 30 | sudo apt install -y make gcc libpcre3-dev libssl-dev zlib1g-dev zlib1g-dev libxslt1-dev \ 31 | silversearcher-ag mercurial jq git \ 32 | tree ctags vim 33 | 34 | if [ $? != 0 ] 35 | then 36 | echo "安装依赖失败" 37 | exit 2 38 | fi 39 | 40 | cd "$top_dir" && \ 41 | mkdir -p var \ 42 | data/backup data/sql data/db-backup \ 43 | logs/crontab 44 | 45 | sudo apt -y install supervisor 46 | if [ $? != 0 ] 47 | then 48 | echo "supervisor 安装失败" 49 | exit 3 50 | else 51 | echo "supervisor 安装成功" 52 | fi 53 | } 54 | 55 | function init_src() { 56 | mkdir -p /tmp/src 57 | 58 | if [ $? != 0 ] 59 | then 60 | echo "初始化目录失败" 61 | exit 4 62 | fi 63 | } 64 | 65 | function init_nginx() { 66 | init_src 67 | 68 | mkdir -p "$top_dir/service/nginx" "$top_dir/logs/nginx-logs" 69 | cd /tmp/src 70 | if [ -d "$top_dir/service/nginx/sbin" ] 71 | then 72 | echo "nginx 已安装" 73 | else 74 | nginx_version="nginx-1.18.0" 75 | wget https://nginx.org/download/$nginx_version.tar.gz && \ 76 | tar xf $nginx_version.tar.gz && \ 77 | cd $nginx_version && \ 78 | ./configure --prefix=$top_dir/service/nginx \ 79 | --user=$nginx_work --group=$nginx_work \ 80 | --with-http_ssl_module \ 81 | --with-http_v2_module \ 82 | --with-http_realip_module \ 83 | --with-http_addition_module \ 84 | --with-http_xslt_module \ 85 | --with-http_sub_module \ 86 | --with-http_gunzip_module \ 87 | --with-http_gzip_static_module \ 88 | --with-http_auth_request_module \ 89 | --with-http_stub_status_module && \ 90 | make && make install 91 | 92 | if [ $? != 0 ] 93 | then 94 | echo "nginx 安装失败" 95 | exit 5 96 | else 97 | echo "nginx 安装成功" 98 | fi 99 | fi 100 | } 101 | 102 | function init_go() { 103 | init_src 104 | 105 | if [ -d "$top_dir/service/go/bin" ] 106 | then 107 | echo "golang 已经安装" 108 | else 109 | mkdir -p "$top_dir/service" 110 | cd /tmp/src && \ 111 | wget https://golang.org/dl/go1.15.7.linux-amd64.tar.gz -O go.tar.gz && \ 112 | tar xf go.tar.gz && \ 113 | mv go $top_dir/service 114 | 115 | if [ $? != 0 ] 116 | then 117 | echo "安装golang失败" 118 | exit 6 119 | else 120 | echo "export PATH=\$PATH:$top_dir/service/go/bin" >> ~/.bashrc 121 | echo "golang 安装成功" 122 | fi 123 | fi 124 | } 125 | 126 | function init_mysql() { 127 | sudo apt install -y mysql-server mysql-client 128 | if [ $? != 0 ] 129 | then 130 | echo "mysql 安装失败" 131 | exit 7 132 | else 133 | echo "mysql 安装成功" 134 | fi 135 | } 136 | 137 | function init_redis() { 138 | init_src 139 | 140 | cd "$top_dir" && mkdir -p service/redis/var/logs service/redis/var/run service/redis/conf 141 | cd /tmp/src 142 | 143 | if [ -d "$top_dir/service/redis/bin" ] 144 | then 145 | echo "redis 已安装" 146 | else 147 | redis_version="redis-6.0.10" 148 | prefix="$top_dir/service/redis" 149 | wget http://download.redis.io/releases/$redis_version.tar.gz && \ 150 | tar xf $redis_version.tar.gz && cd $redis_version && \ 151 | make PREFIX=$prefix && make PREFIX=$prefix install && \ 152 | cp redis.conf "$top_dir/service/redis/conf/redis.conf" 153 | if [ $? != 0 ] 154 | then 155 | echo "redis 安装失败" 156 | exit 8 157 | else 158 | echo "redis 安装成功" 159 | fi 160 | fi 161 | } 162 | 163 | if [ "$service" == "base" ] 164 | then 165 | init_base 166 | elif [ "$service" == "nginx" ] 167 | then 168 | init_nginx 169 | elif [ "$service" == "go" ] 170 | then 171 | init_go 172 | elif [ "$service" == "mysql" ] 173 | then 174 | init_mysql 175 | elif [ "$service" == "redis" ] 176 | then 177 | init_redis 178 | elif [ "$service" == "all" ] 179 | then 180 | init_base 181 | init_nginx 182 | init_go 183 | init_mysql 184 | init_redis 185 | else 186 | echo "指定服务不支持, service: $service" 187 | exit 9 188 | fi 189 | 190 | echo "系统 $service 服务安装完成" 191 | 192 | # vim:set ts=4 sw=4 et fdm=marker: 193 | 194 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | syntax on 2 | 3 | " 解决 vim 无法使用退格键删除 4 | set nocompatible 5 | set backspace=indent,eol,start 6 | 7 | set number 8 | set autoindent 9 | "set smartindent 10 | set expandtab 11 | set ts=4 12 | set shiftwidth=4 13 | " 高亮当前行 14 | set cursorline 15 | "hi cursorline cterm=NONE ctermbg=lightgray ctermfg=NONE 16 | hi cursorline cterm=NONE ctermbg=234 ctermfg=NONE 17 | " 保存文件时不要生成备份文件 18 | set nobackup 19 | " just for encode 20 | set fileencodings=utf-8,gb2312,gbk,gb18030 21 | set termencoding=utf-8 22 | set fileformats=unix 23 | set encoding=utf-8 24 | " 高亮搜索词 25 | set hlsearch 26 | set incsearch 27 | " set foldmethod 28 | set fdm=indent 29 | "set completeopt=longest 30 | 31 | " 设置粘贴模式 32 | "set paste 33 | 34 | " 显示当前行,总行数 35 | set ruler 36 | set rulerformat=%25(%5l,%-6(%c%V%)\ %5*%L\ %P%)%* 37 | 38 | 39 | " map tags list 40 | map :TlistToggle 41 | 42 | "hi CursorLine cterm=NONE ctermbg=gray ctermfg=NONE 43 | "hi CursorColumn cterm=NONE ctermbg=NONE ctermfg=NONE 44 | 45 | " 自动补全菜单控制 46 | set completeopt=longest,menu 47 | 48 | " 打开文件时检测文件类型,自动匹配 49 | filetype on 50 | filetype plugin on 51 | filetype indent on 52 | 53 | " 和 neocomplcache_omni 不冲突,可以共存 54 | " php 函数补全 55 | function AddPHPFuncList() 56 | set dictionary-=~/.vim/tools/php/functions.txt dictionary+=~/.vim/tools/php/functions.txt 57 | set complete-=k complete+=k 58 | endfunction 59 | au FileType php call AddPHPFuncList() 60 | 61 | " python api 补全 62 | function AddPythonFuncList() 63 | set dictionary-=~/.vim/tools/python/complete-dict dictionary+=~/.vim/tools/python/complete-dict 64 | set complete-=k complete+=k 65 | endfunction 66 | au FileType python call AddPythonFuncList() 67 | 68 | " css 属性补全 69 | function AddCssAttrList() 70 | set dictionary-=~/.vim/tools/css/css.attr dictionary+=~/.vim/tools/css/css.attr 71 | set complete-=k complete+=k 72 | endfunction 73 | au FileType css call AddCssAttrList() 74 | 75 | " js 函数自动补全 76 | function AddJsFuncList() 77 | set dictionary-=~/.vim/tools/js/javascript.dict dictionary+=~/.vim/tools/js/javascript.dict 78 | set complete-=k complete+=k 79 | endfunction 80 | autocmd FileType javascript call AddJsFuncList() 81 | 82 | " sql 关键词补全 83 | function AddSqlKeyword() 84 | set dictionary-=~/.vim/tools/sql.dict dictionary+=~/.vim/tools/sql.dict 85 | set complete-=k complete+=k 86 | endfunction 87 | autocmd FileType sql call AddSqlKeyword() 88 | 89 | "colorscheme darkblue 90 | 91 | " 记住上次编辑的位置 92 | autocmd BufReadPost * 93 | \ if line("'\"") > 1 && line("'\"") <= line("$") | 94 | \ exe "normal! g'\"" | 95 | \ endif 96 | 97 | " 自定义文件模版 98 | autocmd BufNewFile *.c 0r ~/.vim/template/cconfig.c 99 | autocmd BufNewFile *.php 0r ~/.vim/template/phpconfig.php 100 | autocmd BufNewFile *.sh 0r ~/.vim/template/shconfig.sh 101 | 102 | " 高亮自定义 103 | hi Comment ctermfg=blue 104 | 105 | " 状态栏 106 | "set laststatus=2 " 总是显示状态栏 107 | "highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue 108 | 109 | "" 获取当前路径,将$HOME转化为~ 110 | "function! CurDir() 111 | " let curdir = substitute(getcwd(), $HOME, "~", "g") 112 | " return curdir 113 | "endfunction 114 | "set statusline=[%n]\ %f%m%r%h\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ ascii=%b,hex=%b%{((&fenc==\"\")?\"\":\"\ \|\ \".&fenc)}\ \|\ %{$USER}\@\%{hostname()} 115 | 116 | " 设置自动补全弹出层背景色为粉红 117 | highlight Pmenu ctermbg=magenta 118 | 119 | " 实现 show print margin 的方法 120 | "set colorcolumn=80 121 | "hi ColorColumn ctermbg=lightgrey guibg=lightgrey 122 | 123 | "highlight OverLength ctermbg=red ctermfg=white guibg=#592929 124 | "match OverLength /\%81v.\+/ 125 | 126 | " 仅检测PHP语法 127 | autocmd FileType php map :!/usr/bin/env php -l % 128 | 129 | " 友好注释助手 130 | let g:DoxygenToolkit_paramTag_pre="@param: " 131 | let g:DoxygenToolkit_returnTag ="@return: " 132 | let g:DoxygenToolkit_authorName="hy0kle@gmail.com" 133 | let g:DoxygenToolkit_licenseTag="\Copyright (C) Technology LimitedCompany" 134 | let g:DoxygenToolkit_briefTag_funcName="yes" 135 | let g:doxygen_enhanced_color=1 136 | 137 | "自定义快捷键 138 | vmap dO#endifPO#if 0 139 | " 函数注释 140 | map :Dox 141 | " 文件版权声明 142 | map :DoxAuthor 143 | " Copyright 144 | map :DoxLic 145 | 146 | " vim tabs conf 147 | map :tabp 148 | map :tabn 149 | " 改变浏览的启动目录 150 | set browsedir=current 151 | 152 | " 分割窗口时保持相等的宽/高 153 | set equalalways 154 | 155 | " The NERD tree : A tree explorer plugin for navigating the filesystem 156 | map :NERDTreeToggle 157 | imap :NERDTreeToggle 158 | "启动Vim时自动打开nerdtree 159 | "autocmd VimEnter * NERDTree 160 | let NERDTreeIgnore=['^cscope', '^tags$'] 161 | 162 | " golang 结构体补齐 163 | "imap 164 | 165 | " go import 自动导入 166 | let g:go_fmt_command = "goimports" 167 | 168 | " 通过C-X,C-U打开匹配列表 169 | "let g:SuerTabDefaultCompletionType = '' 170 | 171 | " vim 插件管理器 172 | set nocompatible " be iMproved, required 173 | filetype off " required 174 | " set the runtime path to include Vundle and initialize 175 | set rtp+=~/.vim/bundle/Vundle.vim 176 | call vundle#begin() 177 | " let Vundle manage Vundle, required 178 | Plugin 'VundleVim/Vundle.vim' 179 | Plugin 'fatih/vim-go' 180 | " All of your Plugins must be added before the following line 181 | call vundle#end() " required 182 | filetype plugin indent on " required 183 | filetype plugin on 184 | 185 | " yaml 186 | Plugin 'stephpy/vim-yaml' 187 | 188 | Bundle 'Blackrush/vim-gocode' 189 | -------------------------------------------------------------------------------- /local/colordiff/colordiff.xml: -------------------------------------------------------------------------------- 1 | 2 | diff"> 5 | colordiff"> 6 | ]> 7 | 8 | 10 | 11 | 12 | 13 | colordiff 14 | 1 15 | 16 | 17 | 18 | colordiff 19 | a tool to colorize &diff; output 20 | 21 | 22 | 23 | 24 | colordiff 25 | &diff; options 26 | &colordiff; options 27 | file1 28 | file2 29 | 30 | 31 | 32 | Description 33 | 34 | &colordiff; is a wrapper for &diff; and produces the same output as 35 | &diff; but with coloured syntax highlighting at the command line to improve 36 | readability. The output is similar to how a &diff;-generated patch might appear 37 | in Vim or Emacs with the 38 | appropriate syntax highlighting options enabled. The colour schemes can be 39 | read from a central configuration file or from a local user 40 | ~/.colordiffrc file. 41 | 42 | &colordiff; makes use of ANSI colours and as such will only work when 43 | ANSI colours can be used - typical examples are xterms and Eterms, as well as 44 | console sessions. 45 | 46 | &colordiff; has been tested on various flavours of Linux and under 47 | OpenBSD, but should be broadly portable to other systems. 48 | 49 | 50 | 51 | Usage 52 | 53 | Use &colordiff; wherever you would normally use &diff;, or pipe output 54 | to &colordiff;: 55 | 56 | For example: 57 | 58 | 59 | $ colordiff file1 file2 60 | $ diff -u file1 file2 | colordiff 61 | 62 | 63 | 64 | 65 | You can pipe the output to 'less', using the '-R' option (some systems or 66 | terminal types may get better results using '-r' instead), which keeps 67 | the colour escape sequences, otherwise displayed incorrectly or discarded by 68 | 'less': 69 | 70 | 71 | $ diff -u file1 file2 | colordiff | less -R 72 | 73 | 74 | 75 | 76 | If you have wdiff installed, colordiff will correctly 77 | colourise the added and removed text, provided that the '-n' option is given to 78 | wdiff: 79 | 80 | 81 | $ wdiff -n file1 file2 | colordiff 82 | 83 | 84 | 85 | 86 | You may find it useful to make &diff; automatically call 87 | colordiff. Add the following line to 88 | ~/.bashrc (or equivalent): 89 | 90 | 91 | alias diff=colordiff 92 | 93 | 94 | 95 | 96 | Any options passed to &colordiff; are passed through to &diff; except for 97 | the colordiff-specific option 'difftype', e.g. 98 | 99 | 100 | colordiff --difftype=debdiff file1 file2 101 | 102 | 103 | Valid values for 'difftype' are: diff, diffc, diffu, diffy, wdiff, debdiff; 104 | these correspond to plain diffs, context diffs, unified diffs, side-by-side 105 | diffs, wdiff output and debdiff output respectively. Use these overrides when 106 | colordiff is not able to determine the diff-type automatically. 107 | 108 | Alternatively, a construct such as 'cvs diff SOMETHING | colordiff' can be 109 | included in ~/.bashrc as follows: 110 | 111 | 112 | function cvsdiff () { cvs diff $@ | colordiff; } 113 | 114 | 115 | 116 | 117 | Or, combining the idea above using 'less': 118 | 119 | 120 | function cvsdiff () { cvs diff $@ | colordiff |less -R; } 121 | 122 | 123 | 124 | 125 | Note that the function name, cvsdiff, can be customized. 126 | 127 | 128 | 129 | Files 130 | 131 | 132 | /etc/colordiffrc 133 | Central configuration file. User-specific settings can be 134 | enabled by copying this file to ~/.colordiffrc and 135 | making the appropriate changes. 136 | colordiffrc-lightbg 137 | Alternate configuration template for use with terminals having 138 | light backgrounds. Copy this to /etc/colordiffrc or ~/.colordiffrc and 139 | customize. 140 | 141 | 142 | 143 | 144 | Bugs 145 | 146 | Bug reports and suggestions/patches to davee@sungate.co.uk 147 | please. 148 | 149 | 150 | 151 | Author 152 | 153 | &colordiff; is written and maintained by Dave Ewart 154 | davee@sungate.co.uk. This manual page and the 155 | source XML was written by Graham Wilson graham@mknod.org for 156 | Debian and is maintained by the author. Dave Ewart maintains the Debian 157 | package, sponsored by Graham Wilson. 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /.vim/snippets/html.snippets: -------------------------------------------------------------------------------- 1 | # Some useful Unicode entities 2 | # Non-Breaking Space 3 | snippet nbs 4 |   5 | # ← 6 | snippet left 7 | ← 8 | # → 9 | snippet right 10 | → 11 | # ↑ 12 | snippet up 13 | ↑ 14 | # ↓ 15 | snippet down 16 | ↓ 17 | # ↩ 18 | snippet return 19 | ↩ 20 | # ⇤ 21 | snippet backtab 22 | ⇤ 23 | # ⇥ 24 | snippet tab 25 | ⇥ 26 | # ⇧ 27 | snippet shift 28 | ⇧ 29 | # ⌃ 30 | snippet control 31 | ⌃ 32 | # ⌅ 33 | snippet enter 34 | ⌅ 35 | # ⌘ 36 | snippet command 37 | ⌘ 38 | # ⌥ 39 | snippet option 40 | ⌥ 41 | # ⌦ 42 | snippet delete 43 | ⌦ 44 | # ⌫ 45 | snippet backspace 46 | ⌫ 47 | # ⎋ 48 | snippet escape 49 | ⎋ 50 | # Generic Doctype 51 | snippet doctype 52 | 53 | snippet doctype HTML 4.01 Strict 54 | 56 | snippet doctype HTML 4.01 Transitional 57 | 59 | snippet doctype HTML 5 60 | 61 | snippet doctype XHTML 1.0 Frameset 62 | 64 | snippet doctype XHTML 1.0 Strict 65 | 67 | snippet doctype XHTML 1.0 Transitional 68 | 70 | snippet doctype XHTML 1.1 71 | 73 | # HTML Doctype 4.01 Strict 74 | snippet docts 75 | 77 | # HTML Doctype 4.01 Transitional 78 | snippet doct 79 | 81 | # HTML Doctype 5 82 | snippet doct5 83 | 84 | # XHTML Doctype 1.0 Frameset 85 | snippet docxf 86 | 88 | # XHTML Doctype 1.0 Strict 89 | snippet docxs 90 | 92 | # XHTML Doctype 1.0 Transitional 93 | snippet docxt 94 | 96 | # XHTML Doctype 1.1 97 | snippet docx 98 | 100 | snippet html 101 | 102 | ${1} 103 | 104 | snippet xhtml 105 | 106 | ${1} 107 | 108 | snippet body 109 | 110 | ${1} 111 | 112 | snippet head 113 | 114 | 115 | 116 | ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} 117 | ${2} 118 | 119 | snippet title 120 | ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}${2} 121 | snippet script 122 | ${2} 125 | snippet scriptsrc 126 | ${2} 127 | snippet style 128 | ${3} 131 | snippet base 132 | 133 | snippet r 134 | 135 | snippet div 136 |
137 | ${2} 138 |
139 | # Embed QT Movie 140 | snippet movie 141 | 143 | 144 | 145 | 146 | 152 | ${6} 153 | snippet fieldset 154 |
155 | ${1:name} 156 | 157 | ${3} 158 |
159 | snippet form 160 |
161 | ${3} 162 | 163 | 164 |

165 |
166 | snippet h1 167 |

${2:$1}

168 | snippet input 169 | ${4} 170 | snippet label 171 | ${7} 172 | snippet link 173 | ${4} 174 | snippet mailto 175 | ${3:email me} 176 | snippet meta 177 | ${3} 178 | snippet opt 179 | ${3} 180 | snippet optt 181 | ${2} 182 | snippet select 183 | ${5} 186 | snippet table 187 | 188 | 189 | 190 |
${2:Header}
${3:Data}
${4} 191 | snippet textarea 192 | ${5} 193 | -------------------------------------------------------------------------------- /.vim/tools/python/python_pydiction.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " python_pydiction.vim - Module and Keyword completion for Python 3 | " ============================================================================ 4 | " 5 | " Author: Ryan Kulla (rkulla AT gmail DOT com) 6 | " Version: 1.2, for Vim 7 7 | " URL: http://www.vim.org/scripts/script.php?script_id=850 8 | " Last Modified: July 22th, 2009 9 | " Installation: On Linux, put this file in ~/.vim/after/ftplugin/ 10 | " On Windows, put this file in C:\vim\vimfiles\ftplugin\ 11 | " (assuming you installed vim in C:\vim\). 12 | " You may install the other files anywhere. 13 | " In .vimrc, add the following: 14 | " filetype plugin on 15 | " let g:pydiction_location = 'path/to/complete-dict' 16 | " Optionally, you set the completion menu height like: 17 | " let g:pydiction_menu_height = 20 18 | " The default menu height is 15 19 | " To do case-sensitive searches, set noignorecase (:set noic). 20 | " Usage: Type part of a Python keyword, module name, attribute or method, 21 | " then hit the TAB key and it will auto-complete (as long as it 22 | " exists in the complete-dict file. 23 | " You can also use Shift-Tab to Tab backwards. 24 | " License: BSD 25 | " Copyright: Copyright (c) 2003-2009 Ryan Kulla 26 | " All rights reserved. 27 | " 28 | " Redistribution and use in source and binary forms, with or without 29 | " modification, are permitted provided that the following conditions 30 | " are met: 31 | " 1. Redistributions of source code must retain the above copyright 32 | " notice, this list of conditions and the following disclaimer. 33 | " 2. Redistributions in binary form must reproduce the above 34 | " copyright notice, this list of conditions and the following 35 | " disclaimer in the documentation and/or other materials provided 36 | " with the distribution. 37 | " 3. The name of the author may not be used to endorse or promote 38 | " products derived from this software without specific prior 39 | " written permission. 40 | " 41 | " THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 42 | " OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 43 | " WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | " ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 45 | " DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | " DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 47 | " GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 48 | " INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 49 | " WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 50 | " NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 51 | " THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 52 | " 53 | " 54 | 55 | if v:version < 700 56 | echoerr "Pydiction requires vim version 7 or greater." 57 | finish 58 | endif 59 | 60 | 61 | " Make the Tab key do python code completion: 62 | inoremap 63 | \=SetVals() 64 | \=TabComplete('down') 65 | \=RestoreVals() 66 | 67 | " Make Shift+Tab do python code completion in the reverse direction: 68 | inoremap 69 | \=SetVals() 70 | \=TabComplete('up') 71 | \=RestoreVals() 72 | 73 | 74 | if !exists("*s:TabComplete") 75 | function! s:TabComplete(direction) 76 | " Check if the char before the char under the cursor is an 77 | " underscore, letter, number, dot or opening parentheses. 78 | " If it is, and if the popup menu is not visible, use 79 | " I_CTRL-X_CTRL-K ('dictionary' only completion)--otherwise, 80 | " use I_CTRL-N to scroll downward through the popup menu or 81 | " use I_CTRL-P to scroll upward through the popup menu, 82 | " depending on the value of a:direction. 83 | " If the char is some other character, insert a normal Tab: 84 | if searchpos('[_a-zA-Z0-9.(]\%#', 'nb') != [0, 0] 85 | if !pumvisible() 86 | return "\\" 87 | else 88 | if a:direction == 'down' 89 | return "\" 90 | else 91 | return "\" 92 | endif 93 | endif 94 | else 95 | return "\" 96 | endif 97 | endfunction 98 | endif 99 | 100 | 101 | if !exists("*s:SetVals") 102 | function! s:SetVals() 103 | " Save and change any config values we need. 104 | 105 | " Temporarily change isk to treat periods and opening 106 | " parenthesis as part of a keyword -- so we can complete 107 | " python modules and functions: 108 | let s:pydiction_save_isk = &iskeyword 109 | setlocal iskeyword +=.,( 110 | 111 | " Save any current dictionaries the user has set: 112 | let s:pydiction_save_dictions = &dictionary 113 | " Temporarily use only pydiction's dictionary: 114 | let &dictionary = g:pydiction_location 115 | 116 | " Save the ins-completion options the user has set: 117 | let s:pydiction_save_cot = &completeopt 118 | " Have the completion menu show up for one or more matches: 119 | let &completeopt = "menu,menuone" 120 | 121 | " Set the popup menu height: 122 | let s:pydiction_save_pumheight = &pumheight 123 | if !exists('g:pydiction_menu_height') 124 | let g:pydiction_menu_height = 15 125 | endif 126 | let &pumheight = g:pydiction_menu_height 127 | 128 | return '' 129 | endfunction 130 | endif 131 | 132 | 133 | if !exists("*s:RestoreVals") 134 | function! s:RestoreVals() 135 | " Restore the user's initial values. 136 | 137 | let &dictionary = s:pydiction_save_dictions 138 | let &completeopt = s:pydiction_save_cot 139 | let &pumheight = s:pydiction_save_pumheight 140 | let &iskeyword = s:pydiction_save_isk 141 | 142 | return '' 143 | endfunction 144 | endif 145 | 146 | -------------------------------------------------------------------------------- /.vim/plugin/snipMate.vim: -------------------------------------------------------------------------------- 1 | " File: snipMate.vim 2 | " Author: Michael Sanders 3 | " Last Updated: July 13, 2009 4 | " Version: 0.83 5 | " Description: snipMate.vim implements some of TextMate's snippets features in 6 | " Vim. A snippet is a piece of often-typed text that you can 7 | " insert into your document using a trigger word followed by a "". 8 | " 9 | " For more help see snipMate.txt; you can do this by using: 10 | " :helptags ~/.vim/doc 11 | " :h snipMate.txt 12 | 13 | " add by hy0kl 14 | let g:snips_author = 'Jerry Yang' 15 | 16 | if exists('loaded_snips') || &cp || version < 700 17 | finish 18 | endif 19 | let loaded_snips = 1 20 | if !exists('snips_author') | let snips_author = 'Me' | endif 21 | 22 | au BufRead,BufNewFile *.snippets\= set ft=snippet 23 | au FileType snippet setl noet fdm=indent 24 | 25 | let s:snippets = {} | let s:multi_snips = {} 26 | 27 | if !exists('snippets_dir') 28 | let snippets_dir = substitute(globpath(&rtp, 'snippets/'), "\n", ',', 'g') 29 | endif 30 | 31 | fun! MakeSnip(scope, trigger, content, ...) 32 | let multisnip = a:0 && a:1 != '' 33 | let var = multisnip ? 's:multi_snips' : 's:snippets' 34 | if !has_key({var}, a:scope) | let {var}[a:scope] = {} | endif 35 | if !has_key({var}[a:scope], a:trigger) 36 | let {var}[a:scope][a:trigger] = multisnip ? [[a:1, a:content]] : a:content 37 | elseif multisnip | let {var}[a:scope][a:trigger] += [[a:1, a:content]] 38 | else 39 | echom 'Warning in snipMate.vim: Snippet '.a:trigger.' is already defined.' 40 | \ .' See :h multi_snip for help on snippets with multiple matches.' 41 | endif 42 | endf 43 | 44 | fun! ExtractSnips(dir, ft) 45 | for path in split(globpath(a:dir, '*'), "\n") 46 | if isdirectory(path) 47 | let pathname = fnamemodify(path, ':t') 48 | for snipFile in split(globpath(path, '*.snippet'), "\n") 49 | call s:ProcessFile(snipFile, a:ft, pathname) 50 | endfor 51 | elseif fnamemodify(path, ':e') == 'snippet' 52 | call s:ProcessFile(path, a:ft) 53 | endif 54 | endfor 55 | endf 56 | 57 | " Processes a single-snippet file; optionally add the name of the parent 58 | " directory for a snippet with multiple matches. 59 | fun s:ProcessFile(file, ft, ...) 60 | let keyword = fnamemodify(a:file, ':t:r') 61 | if keyword == '' | return | endif 62 | try 63 | let text = join(readfile(a:file), "\n") 64 | catch /E484/ 65 | echom "Error in snipMate.vim: couldn't read file: ".a:file 66 | endtry 67 | return a:0 ? MakeSnip(a:ft, a:1, text, keyword) 68 | \ : MakeSnip(a:ft, keyword, text) 69 | endf 70 | 71 | fun! ExtractSnipsFile(file, ft) 72 | if !filereadable(a:file) | return | endif 73 | let text = readfile(a:file) 74 | let inSnip = 0 75 | for line in text + ["\n"] 76 | if inSnip && (line[0] == "\t" || line == '') 77 | let content .= strpart(line, 1)."\n" 78 | continue 79 | elseif inSnip 80 | call MakeSnip(a:ft, trigger, content[:-2], name) 81 | let inSnip = 0 82 | endif 83 | 84 | if line[:6] == 'snippet' 85 | let inSnip = 1 86 | let trigger = strpart(line, 8) 87 | let name = '' 88 | let space = stridx(trigger, ' ') + 1 89 | if space " Process multi snip 90 | let name = strpart(trigger, space) 91 | let trigger = strpart(trigger, 0, space - 1) 92 | endif 93 | let content = '' 94 | endif 95 | endfor 96 | endf 97 | 98 | fun! ResetSnippets() 99 | let s:snippets = {} | let s:multi_snips = {} | let g:did_ft = {} 100 | endf 101 | 102 | let g:did_ft = {} 103 | fun! GetSnippets(dir, filetypes) 104 | for ft in split(a:filetypes, '\.') 105 | if has_key(g:did_ft, ft) | continue | endif 106 | call s:DefineSnips(a:dir, ft, ft) 107 | if ft == 'objc' || ft == 'cpp' || ft == 'cs' 108 | call s:DefineSnips(a:dir, 'c', ft) 109 | elseif ft == 'xhtml' 110 | call s:DefineSnips(a:dir, 'html', 'xhtml') 111 | endif 112 | let g:did_ft[ft] = 1 113 | endfor 114 | endf 115 | 116 | " Define "aliasft" snippets for the filetype "realft". 117 | fun s:DefineSnips(dir, aliasft, realft) 118 | for path in split(globpath(a:dir, a:aliasft.'/')."\n". 119 | \ globpath(a:dir, a:aliasft.'-*/'), "\n") 120 | call ExtractSnips(path, a:realft) 121 | endfor 122 | for path in split(globpath(a:dir, a:aliasft.'.snippets')."\n". 123 | \ globpath(a:dir, a:aliasft.'-*.snippets'), "\n") 124 | call ExtractSnipsFile(path, a:realft) 125 | endfor 126 | endf 127 | 128 | fun! TriggerSnippet() 129 | if exists('g:SuperTabMappingForward') 130 | if g:SuperTabMappingForward == "" 131 | let SuperTabKey = "\" 132 | elseif g:SuperTabMappingBackward == "" 133 | let SuperTabKey = "\" 134 | endif 135 | endif 136 | 137 | if pumvisible() " Update snippet if completion is used, or deal with supertab 138 | if exists('SuperTabKey') 139 | call feedkeys(SuperTabKey) | return '' 140 | endif 141 | call feedkeys("\a", 'n') " Close completion menu 142 | call feedkeys("\") | return '' 143 | endif 144 | 145 | if exists('g:snipPos') | return snipMate#jumpTabStop(0) | endif 146 | 147 | let word = matchstr(getline('.'), '\S\+\%'.col('.').'c') 148 | for scope in [bufnr('%')] + split(&ft, '\.') + ['_'] 149 | let [trigger, snippet] = s:GetSnippet(word, scope) 150 | " If word is a trigger for a snippet, delete the trigger & expand 151 | " the snippet. 152 | if snippet != '' 153 | let col = col('.') - len(trigger) 154 | sil exe 's/\V'.escape(trigger, '/.').'\%#//' 155 | return snipMate#expandSnip(snippet, col) 156 | endif 157 | endfor 158 | 159 | if exists('SuperTabKey') 160 | call feedkeys(SuperTabKey) 161 | return '' 162 | endif 163 | return "\" 164 | endf 165 | 166 | fun! BackwardsSnippet() 167 | if exists('g:snipPos') | return snipMate#jumpTabStop(1) | endif 168 | 169 | if exists('g:SuperTabMappingForward') 170 | if g:SuperTabMappingBackward == "" 171 | let SuperTabKey = "\" 172 | elseif g:SuperTabMappingForward == "" 173 | let SuperTabKey = "\" 174 | endif 175 | endif 176 | if exists('SuperTabKey') 177 | call feedkeys(SuperTabKey) 178 | return '' 179 | endif 180 | return "\" 181 | endf 182 | 183 | " Check if word under cursor is snippet trigger; if it isn't, try checking if 184 | " the text after non-word characters is (e.g. check for "foo" in "bar.foo") 185 | fun s:GetSnippet(word, scope) 186 | let word = a:word | let snippet = '' 187 | while snippet == '' 188 | if exists('s:snippets["'.a:scope.'"]["'.escape(word, '\"').'"]') 189 | let snippet = s:snippets[a:scope][word] 190 | elseif exists('s:multi_snips["'.a:scope.'"]["'.escape(word, '\"').'"]') 191 | let snippet = s:ChooseSnippet(a:scope, word) 192 | if snippet == '' | break | endif 193 | else 194 | if match(word, '\W') == -1 | break | endif 195 | let word = substitute(word, '.\{-}\W', '', '') 196 | endif 197 | endw 198 | if word == '' && a:word != '.' && stridx(a:word, '.') != -1 199 | let [word, snippet] = s:GetSnippet('.', a:scope) 200 | endif 201 | return [word, snippet] 202 | endf 203 | 204 | fun s:ChooseSnippet(scope, trigger) 205 | let snippet = [] 206 | let i = 1 207 | for snip in s:multi_snips[a:scope][a:trigger] 208 | let snippet += [i.'. '.snip[0]] 209 | let i += 1 210 | endfor 211 | if i == 2 | return s:multi_snips[a:scope][a:trigger][0][1] | endif 212 | let num = inputlist(snippet) - 1 213 | return num == -1 ? '' : s:multi_snips[a:scope][a:trigger][num][1] 214 | endf 215 | 216 | fun! ShowAvailableSnips() 217 | let line = getline('.') 218 | let col = col('.') 219 | let word = matchstr(getline('.'), '\S\+\%'.col.'c') 220 | let words = [word] 221 | if stridx(word, '.') 222 | let words += split(word, '\.', 1) 223 | endif 224 | let matchlen = 0 225 | let matches = [] 226 | for scope in [bufnr('%')] + split(&ft, '\.') + ['_'] 227 | let triggers = has_key(s:snippets, scope) ? keys(s:snippets[scope]) : [] 228 | if has_key(s:multi_snips, scope) 229 | let triggers += keys(s:multi_snips[scope]) 230 | endif 231 | for trigger in triggers 232 | for word in words 233 | if word == '' 234 | let matches += [trigger] " Show all matches if word is empty 235 | elseif trigger =~ '^'.word 236 | let matches += [trigger] 237 | let len = len(word) 238 | if len > matchlen | let matchlen = len | endif 239 | endif 240 | endfor 241 | endfor 242 | endfor 243 | 244 | " This is to avoid a bug with Vim when using complete(col - matchlen, matches) 245 | " (Issue#46 on the Google Code snipMate issue tracker). 246 | call setline(line('.'), substitute(line, repeat('.', matchlen).'\%'.col.'c', '', '')) 247 | call complete(col, matches) 248 | return '' 249 | endf 250 | " vim:noet:sw=4:ts=4:ft=vim 251 | -------------------------------------------------------------------------------- /local/sendEmail/README: -------------------------------------------------------------------------------- 1 | sendEmail - Send email from a console near you! 2 | Written by: Brandon Zehm 3 | http://caspian.dotconf.net/ 4 | http://www.tsheets.com/ 5 | 6 | 7 | 8 | ------------------ 9 | What is sendEmail? 10 | ------------------ 11 | 12 | SendEmail is a lightweight, completly command line based, SMTP email agent. 13 | If you have the need to send email from the command line, this tool is perfect. 14 | It was designed to be used in bash scripts, Perl programs, and web sites, but 15 | it is also quite useful in many other contexts. SendEmail is written in Perl 16 | and is unique in that it requires NO SPECIAL MODULES. It has an intuitive and 17 | flexible set of command-line options, making it very easy to learn and use. 18 | 19 | 20 | 21 | 22 | ------------------ 23 | Installation 24 | ------------------ 25 | 26 | SendEmail is a perl script/program, and only needs to be copied to a directory 27 | in your path to make it accessible. Most likely the following steps will 28 | be sufficient: 29 | 30 | 1) Extract the package 31 | tar -zxvf sendEmail-v1.XX.tar.gz 32 | 33 | 2) Copy the sendEmail script to /usr/local/bin 34 | cp -a sendEmail-v1.XX/sendEmail /usr/local/bin 35 | 36 | 3) Make sure its executable 37 | chmod +x /usr/local/bin/sendEmail 38 | 39 | 4) Run it 40 | sendEmail 41 | or 42 | /usr/local/bin/sendEmail 43 | 44 | NOTES: 45 | * Running sendEmail without any arguments will produce a usage summary. 46 | * SendEmail is written in Perl, so no compilation is needed. 47 | * On a Unix/Linux OS if your perl binary is not installed at /usr/bin/perl 48 | you may need to edit the first line of the script accordingly. 49 | 50 | 51 | 52 | 53 | 54 | 55 | --------------- 56 | Usage Overview 57 | --------------- 58 | 59 | sendEmail-1.56 by Brandon Zehm 60 | 61 | Synopsis: sendEmail -f ADDRESS [options] 62 | 63 | Required: 64 | -f ADDRESS from (sender) email address 65 | * At least one recipient required via -t, -cc, or -bcc 66 | * Message body required via -m, STDIN, or -o message-file=FILE 67 | 68 | Common: 69 | -t ADDRESS [ADDR ...] to email address(es) 70 | -u SUBJECT message subject 71 | -m MESSAGE message body 72 | -s SERVER[:PORT] smtp mail relay, default is localhost:25 73 | 74 | Optional: 75 | -a FILE [FILE ...] file attachment(s) 76 | -cc ADDRESS [ADDR ...] cc email address(es) 77 | -bcc ADDRESS [ADDR ...] bcc email address(es) 78 | -xu USERNAME username for SMTP authentication 79 | -xp PASSWORD password for SMTP authentication 80 | 81 | Paranormal: 82 | -b BINDADDR[:PORT] local host bind address 83 | -l LOGFILE log to the specified file 84 | -v verbosity, use multiple times for greater effect 85 | -q be quiet (i.e. no STDOUT output) 86 | -o NAME=VALUE advanced options, for details try: --help misc 87 | -o message-content-type= 88 | -o message-file=FILE -o message-format=raw 89 | -o message-header=HEADER -o message-charset=CHARSET 90 | -o reply-to=ADDRESS -o timeout=SECONDS 91 | -o username=USERNAME -o password=PASSWORD 92 | -o tls= -o fqdn=FQDN 93 | 94 | Help: 95 | --help the helpful overview you're reading now 96 | --help addressing explain addressing and related options 97 | --help message explain message body input and related options 98 | --help networking explain -s, -b, etc 99 | --help output explain logging and other output options 100 | --help misc explain -o options, TLS, SMTP auth, and more 101 | 102 | 103 | 104 | --------------- 105 | Examples 106 | --------------- 107 | 108 | Simple Email: 109 | sendEmail -f me@gmail.com \ 110 | -t friend@yahoo.com \ 111 | -s smtp.gmail.com:587 \ 112 | -xu me@gmail.com \ 113 | -xp MY-PASSWORD \ 114 | -u "Test email" \ 115 | -m "Hi buddy, this is a test email." 116 | 117 | Sending to mutiple people: 118 | sendEmail -f myaddress@isp.net \ 119 | -t "Scott Thomas " jason@isp.net renee@isp.net \ 120 | -s relay.isp.net \ 121 | -u "Test email" \ 122 | -m "Hi guys, this is a test email." 123 | 124 | Sending to multiple people using cc and bcc recipients: 125 | (notice the different way I specified multiple To recipients, you can do this for cc and bcc as well) 126 | sendEmail -f myaddress@isp.net \ 127 | -t scott@isp.net;jason@isp.net;renee@isp.net \ 128 | -cc jennifer@isp.net paul@isp.net jeremiah@isp.net \ 129 | -bcc troy@isp.net miranda@isp.net jay@isp.net \ 130 | -s relay.isp.net \ 131 | -u "Test email with cc and bcc recipients" \ 132 | -m "Hi guys, this is a test email." 133 | 134 | 135 | Sending to multiple people with multiple attachments: 136 | sendEmail -f myaddress@isp.net \ 137 | -t jason@isp.net \ 138 | -cc jennifer@isp.net paul@isp.net jeremiah@isp.net \ 139 | -s relay.isp.net \ 140 | -u "Test email with cc and bcc recipients" \ 141 | -m "Hi guys, this is a test email." \ 142 | -a /mnt/storage/document.sxw "/root/My Documents/Work Schedule.kwd" 143 | 144 | 145 | Sending an email with the contents of a file as the message body: 146 | cat /tmp/file.txt | sendEmail -f myaddress@isp.net \ 147 | -t jason@isp.net \ 148 | -s relay.isp.net \ 149 | -u "Test email with contents of file" 150 | 151 | 152 | Sending an email with the contents of a file as the message body (method 2): 153 | sendEmail -f myaddress@isp.net \ 154 | -t jason@isp.net \ 155 | -s relay.isp.net \ 156 | -o message-file=/tmp/file.txt \ 157 | -u "Test email with contents of file" 158 | 159 | 160 | Sending an html email: (make sure your html file has at the beginning) 161 | cat /tmp/file.html | sendEmail -f myaddress@isp.net \ 162 | -t jason@isp.net \ 163 | -s relay.isp.net \ 164 | -u "Test email with html content" 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | ------------ 175 | Contributors 176 | ------------ 177 | 178 | Many thanks go to the people who have submitted ideas and patches. 179 | I know I've forgotten to mention everyone who's helped with sendEmail, 180 | but here is a small list. Please let me know if you feel your name 181 | should be here! 182 | 183 | v1.56 184 | - Several people submitted fixes for the authentication bug. 185 | Thanks to all of you for nagging me to get this release out! 186 | 187 | Simon Matter (v1.55) 188 | - Local bind address patch 189 | 190 | CBL Team and Chris Peay (v1.55) 191 | - Bug reports about sendEmail causing people get blacklisted. 192 | 193 | Jared Cheney (v1.42) 194 | - More bare LF bug fixes and bare period encoding. 195 | - Mime encoding patch 196 | 197 | Buddy Nahay (v1.41) 198 | - Bare LF bug report 199 | 200 | John Rouillard (v1.41) 201 | - html detection bug report 202 | 203 | Reidar Johansen (v1.40) 204 | - Added support for HTML email 205 | - Created a function called tz_offset that determines the local timezone 206 | - Many other fixes and suggestions 207 | 208 | Paul Kreiner (v1.40) 209 | - Submitted a patch that forces the timestamp string to always follow 210 | the HH:MM:SS convention required by the RFCs. 211 | 212 | Al Danial 213 | - Found and reported a logging/typo/attachment issue in v1.32 214 | 215 | Svante Gerhard 216 | - Found and reported the file attachment/padding issue in v1.31 217 | 218 | Charles Leeds 219 | - Put together all the original file attachment code and got me 220 | on the path to v1.3x 221 | - Provided the compiled Windows executable version of sendEmail 222 | for a LONG time. I really appreciate your help! 223 | 224 | Nick Pasich 225 | - Passing the email message via STDIN 226 | - Multiple recpients 227 | - Log file option 228 | - Quiet option 229 | - Cc option 230 | - Lots of other suggestions and code 231 | 232 | Richard Duim 233 | - For mime/content-type/attachment suggestions 234 | 235 | Ulisses Montenegro 236 | - First one to report problems with bare LF's on qmail servers 237 | 238 | Michael Santy 239 | - Reported problems with various SMTP servers and helped me fix a few 240 | fairly serious problems. 241 | 242 | Many other people have submitted bug reports and helped to make sendEmail 243 | what it is today, and my best regards go out to all those .. complainers ;-) 244 | 245 | -------------------------------------------------------------------------------- /.vim/nerdtree_plugin/fs_menu.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: fs_menu.vim 3 | " Description: plugin for the NERD Tree that provides a file system menu 4 | " Maintainer: Martin Grenfell 5 | " Last Change: 17 July, 2009 6 | " License: This program is free software. It comes without any warranty, 7 | " to the extent permitted by applicable law. You can redistribute 8 | " it and/or modify it under the terms of the Do What The Fuck You 9 | " Want To Public License, Version 2, as published by Sam Hocevar. 10 | " See http://sam.zoy.org/wtfpl/COPYING for more details. 11 | " 12 | " ============================================================================ 13 | if exists("g:loaded_nerdtree_fs_menu") 14 | finish 15 | endif 16 | let g:loaded_nerdtree_fs_menu = 1 17 | 18 | call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'}) 19 | call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'}) 20 | call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'}) 21 | 22 | if has("gui_mac") || has("gui_macvim") 23 | call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'}) 24 | call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'}) 25 | call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'}) 26 | endif 27 | 28 | if g:NERDTreePath.CopyingSupported() 29 | call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) 30 | endif 31 | 32 | "FUNCTION: s:echo(msg){{{1 33 | function! s:echo(msg) 34 | redraw 35 | echomsg "NERDTree: " . a:msg 36 | endfunction 37 | 38 | "FUNCTION: s:echoWarning(msg){{{1 39 | function! s:echoWarning(msg) 40 | echohl warningmsg 41 | call s:echo(a:msg) 42 | echohl normal 43 | endfunction 44 | 45 | "FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1 46 | "prints out the given msg and, if the user responds by pushing 'y' then the 47 | "buffer with the given bufnum is deleted 48 | " 49 | "Args: 50 | "bufnum: the buffer that may be deleted 51 | "msg: a message that will be echoed to the user asking them if they wish to 52 | " del the buffer 53 | function! s:promptToDelBuffer(bufnum, msg) 54 | echo a:msg 55 | if nr2char(getchar()) ==# 'y' 56 | exec "silent bdelete! " . a:bufnum 57 | endif 58 | endfunction 59 | 60 | "FUNCTION: NERDTreeAddNode(){{{1 61 | function! NERDTreeAddNode() 62 | let curDirNode = g:NERDTreeDirNode.GetSelected() 63 | 64 | let newNodeName = input("Add a childnode\n". 65 | \ "==========================================================\n". 66 | \ "Enter the dir/file name to be created. Dirs end with a '/'\n" . 67 | \ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file") 68 | 69 | if newNodeName ==# '' 70 | call s:echo("Node Creation Aborted.") 71 | return 72 | endif 73 | 74 | try 75 | let newPath = g:NERDTreePath.Create(newNodeName) 76 | let parentNode = b:NERDTreeRoot.findNode(newPath.getParent()) 77 | 78 | let newTreeNode = g:NERDTreeFileNode.New(newPath) 79 | if parentNode.isOpen || !empty(parentNode.children) 80 | call parentNode.addChild(newTreeNode, 1) 81 | call NERDTreeRender() 82 | call newTreeNode.putCursorHere(1, 0) 83 | endif 84 | catch /^NERDTree/ 85 | call s:echoWarning("Node Not Created.") 86 | endtry 87 | endfunction 88 | 89 | "FUNCTION: NERDTreeMoveNode(){{{1 90 | function! NERDTreeMoveNode() 91 | let curNode = g:NERDTreeFileNode.GetSelected() 92 | let newNodePath = input("Rename the current node\n" . 93 | \ "==========================================================\n" . 94 | \ "Enter the new path for the node: \n" . 95 | \ "", curNode.path.str(), "file") 96 | 97 | if newNodePath ==# '' 98 | call s:echo("Node Renaming Aborted.") 99 | return 100 | endif 101 | 102 | try 103 | let bufnum = bufnr(curNode.path.str()) 104 | 105 | call curNode.rename(newNodePath) 106 | call NERDTreeRender() 107 | 108 | "if the node is open in a buffer, ask the user if they want to 109 | "close that buffer 110 | if bufnum != -1 111 | let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)" 112 | call s:promptToDelBuffer(bufnum, prompt) 113 | endif 114 | 115 | call curNode.putCursorHere(1, 0) 116 | 117 | redraw 118 | catch /^NERDTree/ 119 | call s:echoWarning("Node Not Renamed.") 120 | endtry 121 | endfunction 122 | 123 | " FUNCTION: NERDTreeDeleteNode() {{{1 124 | function! NERDTreeDeleteNode() 125 | let currentNode = g:NERDTreeFileNode.GetSelected() 126 | let confirmed = 0 127 | 128 | if currentNode.path.isDirectory 129 | let choice =input("Delete the current node\n" . 130 | \ "==========================================================\n" . 131 | \ "STOP! To delete this entire directory, type 'yes'\n" . 132 | \ "" . currentNode.path.str() . ": ") 133 | let confirmed = choice ==# 'yes' 134 | else 135 | echo "Delete the current node\n" . 136 | \ "==========================================================\n". 137 | \ "Are you sure you wish to delete the node:\n" . 138 | \ "" . currentNode.path.str() . " (yN):" 139 | let choice = nr2char(getchar()) 140 | let confirmed = choice ==# 'y' 141 | endif 142 | 143 | 144 | if confirmed 145 | try 146 | call currentNode.delete() 147 | call NERDTreeRender() 148 | 149 | "if the node is open in a buffer, ask the user if they want to 150 | "close that buffer 151 | let bufnum = bufnr(currentNode.path.str()) 152 | if buflisted(bufnum) 153 | let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)" 154 | call s:promptToDelBuffer(bufnum, prompt) 155 | endif 156 | 157 | redraw 158 | catch /^NERDTree/ 159 | call s:echoWarning("Could not remove node") 160 | endtry 161 | else 162 | call s:echo("delete aborted") 163 | endif 164 | 165 | endfunction 166 | 167 | " FUNCTION: NERDTreeCopyNode() {{{1 168 | function! NERDTreeCopyNode() 169 | let currentNode = g:NERDTreeFileNode.GetSelected() 170 | let newNodePath = input("Copy the current node\n" . 171 | \ "==========================================================\n" . 172 | \ "Enter the new path to copy the node to: \n" . 173 | \ "", currentNode.path.str(), "file") 174 | 175 | if newNodePath != "" 176 | "strip trailing slash 177 | let newNodePath = substitute(newNodePath, '\/$', '', '') 178 | 179 | let confirmed = 1 180 | if currentNode.path.copyingWillOverwrite(newNodePath) 181 | call s:echo("Warning: copying may overwrite files! Continue? (yN)") 182 | let choice = nr2char(getchar()) 183 | let confirmed = choice ==# 'y' 184 | endif 185 | 186 | if confirmed 187 | try 188 | let newNode = currentNode.copy(newNodePath) 189 | if !empty(newNode) 190 | call NERDTreeRender() 191 | call newNode.putCursorHere(0, 0) 192 | endif 193 | catch /^NERDTree/ 194 | call s:echoWarning("Could not copy node") 195 | endtry 196 | endif 197 | else 198 | call s:echo("Copy aborted.") 199 | endif 200 | redraw 201 | endfunction 202 | 203 | function! NERDTreeQuickLook() 204 | let treenode = g:NERDTreeFileNode.GetSelected() 205 | if treenode != {} 206 | call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'") 207 | endif 208 | endfunction 209 | 210 | function! NERDTreeRevealInFinder() 211 | let treenode = g:NERDTreeFileNode.GetSelected() 212 | if treenode != {} 213 | let x = system("open -R '" . treenode.path.str() . "'") 214 | endif 215 | endfunction 216 | 217 | function! NERDTreeExecuteFile() 218 | let treenode = g:NERDTreeFileNode.GetSelected() 219 | if treenode != {} 220 | let x = system("open '" . treenode.path.str() . "'") 221 | endif 222 | endfunction 223 | 224 | " vim: set sw=4 sts=4 et fdm=marker: 225 | -------------------------------------------------------------------------------- /.vim/syntax/swift.vim: -------------------------------------------------------------------------------- 1 | " File: swift.vim 2 | " Author: Keith Smiley 3 | " Description: Runtime files for Swift 4 | " Last Modified: June 15, 2014 5 | 6 | if exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | " Comments 11 | " Shebang 12 | syntax match swiftShebang "\v#!.*$" 13 | 14 | " Comment contained keywords 15 | syntax keyword swiftTodos contained TODO XXX FIXME NOTE 16 | syntax keyword swiftMarker contained MARK 17 | 18 | " In comment identifiers 19 | function! s:CommentKeywordMatch(keyword) 20 | execute "syntax match swiftDocString \"\\v^\\s*-\\s*". a:keyword . "\\W\"hs=s+1,he=e-1 contained" 21 | endfunction 22 | 23 | syntax case ignore 24 | 25 | call s:CommentKeywordMatch("attention") 26 | call s:CommentKeywordMatch("author") 27 | call s:CommentKeywordMatch("authors") 28 | call s:CommentKeywordMatch("bug") 29 | call s:CommentKeywordMatch("complexity") 30 | call s:CommentKeywordMatch("copyright") 31 | call s:CommentKeywordMatch("date") 32 | call s:CommentKeywordMatch("experiment") 33 | call s:CommentKeywordMatch("important") 34 | call s:CommentKeywordMatch("invariant") 35 | call s:CommentKeywordMatch("note") 36 | call s:CommentKeywordMatch("parameter") 37 | call s:CommentKeywordMatch("postcondition") 38 | call s:CommentKeywordMatch("precondition") 39 | call s:CommentKeywordMatch("remark") 40 | call s:CommentKeywordMatch("remarks") 41 | call s:CommentKeywordMatch("requires") 42 | call s:CommentKeywordMatch("returns") 43 | call s:CommentKeywordMatch("see") 44 | call s:CommentKeywordMatch("since") 45 | call s:CommentKeywordMatch("throws") 46 | call s:CommentKeywordMatch("todo") 47 | call s:CommentKeywordMatch("version") 48 | call s:CommentKeywordMatch("warning") 49 | 50 | syntax case match 51 | delfunction s:CommentKeywordMatch 52 | 53 | 54 | " Literals 55 | " Strings 56 | syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper oneline 57 | syntax region swiftInterpolatedWrapper start="\v[^\\]\zs\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString oneline 58 | syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper oneline 59 | 60 | " Numbers 61 | syntax match swiftNumber "\v<\d+>" 62 | syntax match swiftNumber "\v<(\d+_+)+\d+(\.\d+(_+\d+)*)?>" 63 | syntax match swiftNumber "\v<\d+\.\d+>" 64 | syntax match swiftNumber "\v<\d*\.?\d+([Ee]-?)?\d+>" 65 | syntax match swiftNumber "\v<0x[[:xdigit:]_]+([Pp]-?)?\x+>" 66 | syntax match swiftNumber "\v<0b[01_]+>" 67 | syntax match swiftNumber "\v<0o[0-7_]+>" 68 | 69 | " BOOLs 70 | syntax keyword swiftBoolean 71 | \ true 72 | \ false 73 | 74 | 75 | " Operators 76 | syntax match swiftOperator "\v\~" 77 | syntax match swiftOperator "\v\s+!" 78 | syntax match swiftOperator "\v\%" 79 | syntax match swiftOperator "\v\^" 80 | syntax match swiftOperator "\v\&" 81 | syntax match swiftOperator "\v\*" 82 | syntax match swiftOperator "\v-" 83 | syntax match swiftOperator "\v\+" 84 | syntax match swiftOperator "\v\=" 85 | syntax match swiftOperator "\v\|" 86 | syntax match swiftOperator "\v\/" 87 | syntax match swiftOperator "\v\." 88 | syntax match swiftOperator "\v\<" 89 | syntax match swiftOperator "\v\>" 90 | syntax match swiftOperator "\v\?\?" 91 | 92 | " Methods/Functions/Properties 93 | syntax match swiftMethod "\(\.\)\@<=\w\+\((\)\@=" 94 | syntax match swiftProperty "\(\.\)\@<=\<\w\+\>(\@!" 95 | 96 | " Swift closure arguments 97 | syntax match swiftClosureArgument "\$\d\+\(\.\d\+\)\?" 98 | 99 | syntax match swiftAvailability "\v((\*(\s*,\s*[a-zA-Z="0-9.]+)*)|(\w+\s+\d+(\.\d+(.\d+)?)?\s*,\s*)+\*)" contains=swiftString 100 | syntax keyword swiftPlatforms OSX iOS watchOS OSXApplicationExtension iOSApplicationExtension contained containedin=swiftAvailability 101 | syntax keyword swiftAvailabilityArg renamed unavailable introduced deprecated obsoleted message contained containedin=swiftAvailability 102 | 103 | " Keywords {{{ 104 | syntax keyword swiftKeywords 105 | \ associatedtype 106 | \ associativity 107 | \ atexit 108 | \ break 109 | \ case 110 | \ catch 111 | \ class 112 | \ continue 113 | \ convenience 114 | \ default 115 | \ defer 116 | \ deinit 117 | \ didSet 118 | \ do 119 | \ dynamic 120 | \ else 121 | \ extension 122 | \ fallthrough 123 | \ fileprivate 124 | \ final 125 | \ for 126 | \ func 127 | \ get 128 | \ guard 129 | \ if 130 | \ import 131 | \ in 132 | \ infix 133 | \ init 134 | \ inout 135 | \ internal 136 | \ lazy 137 | \ let 138 | \ mutating 139 | \ nil 140 | \ nonmutating 141 | \ operator 142 | \ optional 143 | \ override 144 | \ postfix 145 | \ precedence 146 | \ precedencegroup 147 | \ prefix 148 | \ private 149 | \ protocol 150 | \ public 151 | \ repeat 152 | \ required 153 | \ rethrows 154 | \ return 155 | \ self 156 | \ set 157 | \ static 158 | \ subscript 159 | \ super 160 | \ switch 161 | \ throw 162 | \ throws 163 | \ try 164 | \ typealias 165 | \ unowned 166 | \ var 167 | \ weak 168 | \ where 169 | \ while 170 | \ willSet 171 | 172 | syntax match swiftMultiwordKeywords "indirect case" 173 | " }}} 174 | 175 | " Names surrounded by backticks. This aren't limited to keywords because 1) 176 | " Swift doesn't limit them to keywords and 2) I couldn't make the keywords not 177 | " highlight at the same time 178 | syntax region swiftEscapedReservedWord start="`" end="`" oneline 179 | 180 | syntax keyword swiftAttributes 181 | \ @assignment 182 | \ @autoclosure 183 | \ @available 184 | \ @convention 185 | \ @discardableResult 186 | \ @exported 187 | \ @IBAction 188 | \ @IBDesignable 189 | \ @IBInspectable 190 | \ @IBOutlet 191 | \ @noescape 192 | \ @nonobjc 193 | \ @noreturn 194 | \ @NSApplicationMain 195 | \ @NSCopying 196 | \ @NSManaged 197 | \ @objc 198 | \ @testable 199 | \ @UIApplicationMain 200 | \ @warn_unused_result 201 | 202 | syntax keyword swiftConditionStatement #available 203 | 204 | syntax keyword swiftStructure 205 | \ struct 206 | \ enum 207 | 208 | syntax keyword swiftDebugIdentifier 209 | \ #column 210 | \ #file 211 | \ #function 212 | \ #line 213 | \ __COLUMN__ 214 | \ __FILE__ 215 | \ __FUNCTION__ 216 | \ __LINE__ 217 | 218 | syntax keyword swiftLineDirective #setline 219 | 220 | syntax region swiftTypeWrapper start="\v:\s*" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALLBUT,swiftInterpolatedWrapper transparent 221 | syntax region swiftTypeCastWrapper start="\(as\|is\)\(!\|?\)\=\s\+" end="\v(\s|$|\{)" contains=swiftType,swiftCastKeyword keepend transparent oneline 222 | syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline 223 | syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline 224 | syntax region swiftReturnWrapper start="\v-\>\s*" end="\v(\{|$)" contains=swiftType transparent oneline 225 | syntax match swiftType "\v<\u\w*" contained containedin=swiftTypeWrapper,swiftLiteralWrapper,swiftGenericsWrapper,swiftTypeCastWrapper 226 | 227 | syntax keyword swiftImports import 228 | syntax keyword swiftCastKeyword is as contained 229 | 230 | " 'preprocesor' stuff 231 | syntax keyword swiftPreprocessor 232 | \ #if 233 | \ #elseif 234 | \ #else 235 | \ #endif 236 | \ #selector 237 | 238 | 239 | " Comment patterns 240 | syntax match swiftComment "\v\/\/.*$" 241 | \ contains=swiftTodos,swiftDocString,swiftMarker,@Spell oneline 242 | syntax region swiftComment start="/\*" end="\*/" 243 | \ contains=swiftTodos,swiftDocString,swiftMarker,swiftComment,@Spell fold 244 | 245 | 246 | " Set highlights 247 | highlight default link swiftTodos Todo 248 | highlight default link swiftDocString String 249 | highlight default link swiftShebang Comment 250 | highlight default link swiftComment Comment 251 | highlight default link swiftMarker Comment 252 | 253 | highlight default link swiftString String 254 | highlight default link swiftInterpolatedWrapper Delimiter 255 | highlight default link swiftNumber Number 256 | highlight default link swiftBoolean Boolean 257 | 258 | highlight default link swiftOperator Operator 259 | highlight default link swiftCastKeyword Keyword 260 | highlight default link swiftKeywords Keyword 261 | highlight default link swiftMultiwordKeywords Keyword 262 | highlight default link swiftEscapedReservedWord Normal 263 | highlight default link swiftClosureArgument Operator 264 | highlight default link swiftAttributes PreProc 265 | highlight default link swiftConditionStatement PreProc 266 | highlight default link swiftStructure Structure 267 | highlight default link swiftType Type 268 | highlight default link swiftImports Include 269 | highlight default link swiftPreprocessor PreProc 270 | highlight default link swiftMethod Function 271 | highlight default link swiftProperty Identifier 272 | 273 | highlight default link swiftConditionStatement PreProc 274 | highlight default link swiftAvailability Normal 275 | highlight default link swiftAvailabilityArg Normal 276 | highlight default link swiftPlatforms Keyword 277 | highlight default link swiftDebugIdentifier PreProc 278 | highlight default link swiftLineDirective PreProc 279 | 280 | " Force vim to sync at least x lines. This solves the multiline comment not 281 | " being highlighted issue 282 | syn sync minlines=100 283 | 284 | let b:current_syntax = "swift" 285 | -------------------------------------------------------------------------------- /.bashrc: -------------------------------------------------------------------------------- 1 | # ~/.bashrc: executed by bash(1) for non-login shells. 2 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 3 | # for examples 4 | 5 | # If not running interactively, don't do anything 6 | #[ -z "$PS1" ] && return 7 | 8 | # don't put duplicate lines in the history. See bash(1) for more options 9 | export HISTCONTROL=ignoredups 10 | 11 | # check the window size after each command and, if necessary, 12 | # update the values of LINES and COLUMNS. 13 | #shopt -s checkwinsize 14 | 15 | # set encode 16 | export LANG=C 17 | export LANG=en_US.UTF-8 18 | export LC_ALL=en_US.UTF-8 19 | 20 | ### alias ### 21 | # svn 22 | alias svn-st='svn st | grep ^M' 23 | alias svn-log='svn log -v --limit 5' 24 | 25 | # professional alias 26 | os=$(uname) 27 | if [[ "Darwin" == $os ]] || [[ "FreeBSD" == $os ]] 28 | then 29 | alias ls='ls -G' 30 | alias myip="ifconfig | grep 'inet ' | awk '{print \$2}'" 31 | else 32 | alias ls='ls --color' 33 | alias myip="ifconfig | grep 'inet ' | awk '{split(\$2, ip_cntr, \":\"); print ip_cntr[2];}'" 34 | fi 35 | alias ll='ls -l' 36 | alias la='ls -Aalth' 37 | alias l='ls -CF' 38 | alias lt='ls -lth' 39 | alias tf='tail -f' 40 | alias grep='grep --color=always' 41 | alias tree='tree -C' 42 | alias vih='sudo vim /etc/hosts' 43 | alias cdiff='~/local/colordiff/colordiff.pl | less -R' 44 | alias rscp='rsync -v -P -t -e ssh' 45 | alias wget='wget -c' 46 | alias sendmail='$HOME/local/sendEmail/sendEmail -f cli_mail@163.com -o message-content-type=auto -o message-charset=utf-8 -s smtp.163.com -xu cli_mail@163.com -xp Iwi11ct0' 47 | alias mysql='mysql --auto-rehash' 48 | alias ctagsp='ctags -R --langmap=PHP:.php.inc --php-types=c+f+d --exclude=.svn --exclude=svn --exclude=subversion --exclude=img --exclude=swf --exclude=js --exclude=tpl --exclude=htdocs --exclude=html --exclude=sql --exclude=static --exclude=.git' 49 | # tail -f 目录下所有文件 50 | alias tailaf='find . -type f | xargs tail -f' 51 | alias vi='vim' 52 | 53 | # alias for git 54 | alias git-ci='git commit' 55 | alias git-log='git log' 56 | alias git-stat='git status' 57 | alias git-diff='git diff' 58 | alias git-co='git checkout' 59 | alias git-pull='git pull' 60 | alias git-push='git push' 61 | alias git-clone='git clone' 62 | alias git-gm="git status | grep modified" 63 | 64 | # alias for gcc 65 | alias gw='gcc -g -O2 -Wall -fno-strict-aliasing -Wno-deprecated-declarations -D_THREAD_SAFE' 66 | alias gt='gcc -g -finline-functions -Wall -Winline -pipe' 67 | alias gco='gcc -framework Foundation' 68 | 69 | 70 | # enable programmable completion features (you don't need to enable 71 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 72 | # sources /etc/bash.bashrc). 73 | if [ -f /etc/bash_completion ]; then 74 | . /etc/bash_completion 75 | fi 76 | 77 | # bash 升级到4.0后,安装 bash-completion,开启命令参数自动补全 78 | if [ -f $HOME/local/bash/share/bash-completion/bash_completion ]; then 79 | . $HOME/local/bash/share/bash-completion/bash_completion 80 | fi 81 | 82 | # color man 83 | export LESS_TERMCAP_mb=$'\E[01;31m' 84 | export LESS_TERMCAP_md=$'\E[01;31m' 85 | export LESS_TERMCAP_me=$'\E[0m' 86 | export LESS_TERMCAP_se=$'\E[0m' 87 | export LESS_TERMCAP_so=$'\E[01;44;33m' 88 | export LESS_TERMCAP_ue=$'\E[0m' 89 | export LESS_TERMCAP_us=$'\E[01;32m' 90 | 91 | PAGER='less -X -M' 92 | export LESS=' -R ' 93 | 94 | export SVN_EDITOR=vim 95 | export EDITOR=vim 96 | 97 | export PATH=$HOME/local/bin:/usr/local/mysql/bin:$PATH 98 | 99 | # 使用 HISTTIMEFORMAT 在历史中显示 TIMESTAMP 100 | export HISTTIMEFORMAT='%F %T ' 101 | 102 | 103 | # 生成随机字符串 104 | function _randpwd() 105 | { 106 | str=`date +%s | shasum | base64 | head -c 16` 107 | echo $str 108 | } 109 | alias randpwd=_randpwd 110 | 111 | # some function 112 | function _memtop() 113 | { 114 | num=$1 115 | if ((num > 0)) 116 | then 117 | num=$num 118 | else 119 | num=30 120 | fi 121 | ps aux | sort -k4nr | head -n $num 122 | } 123 | alias memtop=_memtop 124 | 125 | # mac 不支持 126 | function _straceall { 127 | strace $(pidof "${1}" | sed 's/\([0-9]*\)/-p \1/g') 128 | } 129 | alias straceall=_straceall 130 | 131 | function _urlencode() 132 | { 133 | argc=$# 134 | if ((argc > 0)) 135 | then 136 | php $HOME/local/bin/url.php encode $* 137 | else 138 | echo "Need more arguments..." 139 | fi 140 | } 141 | alias urlencode=_urlencode 142 | 143 | function _urldecode() 144 | { 145 | argc=$# 146 | if ((argc > 0)) 147 | then 148 | php $HOME/local/bin/url.php decode $* 149 | else 150 | echo "Need more arguments..." 151 | fi 152 | } 153 | alias urldecode=_urldecode 154 | 155 | function _md2word() 156 | { 157 | PANDOC_INSTALLED=$(pandoc --version >> /dev/null; echo $?) 158 | 159 | if [ "0" == ${PANDOC_INSTALLED} ]; then 160 | pandoc -o $2 -f markdown -t docx $1 161 | else 162 | echo "Pandoc is not installed. Unable to convert document." 163 | fi 164 | } 165 | alias md2word=_md2word 166 | 167 | function _kgit() 168 | { 169 | ps axu | grep git | grep -v grep | awk '{print $2}' | xargs kill -9 170 | exit 0 171 | } 172 | alias kgit=_kgit 173 | 174 | ## Parses out the branch name from .git/HEAD: 175 | find_git_branch () { 176 | local dir=. head 177 | until [ "$dir" -ef / ]; do 178 | if [ -f "$dir/.git/HEAD" ]; then 179 | head=$(< "$dir/.git/HEAD") 180 | if [[ $head = ref:\ refs/heads/* ]]; then 181 | git_branch=" → ${head#*/*/}" 182 | elif [[ $head != '' ]]; then 183 | git_branch=" → (detached)" 184 | else 185 | git_branch=" → (unknow)" 186 | fi 187 | return 188 | fi 189 | dir="../$dir" 190 | done 191 | git_branch='' 192 | } 193 | PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND" 194 | 195 | # 日期转uninx时间戳毫秒 196 | function _dt2um() { 197 | local args=$* 198 | if [[ "Darwin" == $os ]] || [[ "FreeBSD" == $os ]] 199 | then 200 | um=`date -j -f "%Y-%m-%d %H:%M:%S" "$args" "+%s"` 201 | else 202 | um=`date +%s -d "$args"` 203 | fi 204 | um=$((um * 1000)) 205 | echo $um 206 | } 207 | alias dt2um=_dt2um 208 | 209 | # uninx时间戳毫秒转日期 210 | function _um2dt() { 211 | local um=$1 212 | um=$((um / 1000)) 213 | if [[ "Darwin" == $os ]] || [[ "FreeBSD" == $os ]] 214 | then 215 | echo `date -r "$um" +"%Y-%m-%d %H:%M:%S"` 216 | else 217 | echo `date -d @"$um" +"%Y-%m-%d %H:%M:%S"` 218 | fi 219 | } 220 | alias um2dt=_um2dt 221 | 222 | # Here is bash color codes you can use 223 | black=$'\[\e[1;30m\]' 224 | red=$'\[\e[1;31m\]' 225 | green=$'\[\e[1;32m\]' 226 | yellow=$'\[\e[1;33m\]' 227 | blue=$'\[\e[1;34m\]' 228 | magenta=$'\[\e[1;35m\]' 229 | cyan=$'\[\e[1;36m\]' 230 | white=$'\[\e[1;37m\]' 231 | normal=$'\[\e[m\]' 232 | 233 | # enable programmable completion features (you don't need to enable 234 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 235 | # sources /etc/bash.bashrc). 236 | if ! shopt -oq posix; then 237 | if [ -f /usr/share/bash-completion/bash_completion ]; then 238 | . /usr/share/bash-completion/bash_completion 239 | elif [ -f /etc/bash_completion ]; then 240 | . /etc/bash_completion 241 | fi 242 | fi 243 | [[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && \ 244 | source /usr/local/share/bash-completion/bash_completion.sh 245 | 246 | prompt='\$' 247 | if [ "root" = "$USER" ] 248 | then 249 | prompt='#' 250 | fi 251 | 252 | PS1="${white}[${green}\u${red}@${cyan}\h${normal}:${magenta}\w${white}]$yellow\$git_branch$white$prompt $normal" 253 | 254 | # 加入 git 自动补齐 255 | if [[ -f "$HOME/profile/local/git-completion.bash" ]]; then 256 | source $HOME/profile/local/git-completion.bash 257 | fi 258 | 259 | function _push_all() { 260 | branch=$(git remote -v | awk '{print $1}' | sort -u) 261 | for bc in $branch 262 | do 263 | echo "git push $bc master" 264 | git push $bc master 265 | done 266 | } 267 | alias push-all=_push_all 268 | 269 | export ESHOST="http://127.0.0.1:9200" 270 | 271 | function es_idx_info() { 272 | if [ $# -lt 1 ]; then 273 | echo "usage: es-idx-info index-name" 274 | else 275 | local idx=$1 276 | curl -H "Content-Type:application/json" -XGET $ESHOST/$idx/_settings?pretty 277 | fi 278 | } 279 | alias es-idx-info=es_idx_info 280 | 281 | function es_idx_map() { 282 | if [ $# -lt 1 ]; then 283 | echo "usage: es-idx-map index-name" 284 | else 285 | local idx=$1 286 | curl -H "Content-Type:application/json" -XGET $ESHOST/$idx/_mapping?pretty 287 | fi 288 | } 289 | alias es-idx-map=es_idx_map 290 | 291 | function es_idx_alias() { 292 | if [ $# -lt 1 ]; then 293 | echo "usage: es-idx-alias index-name" 294 | else 295 | local idx=$1 296 | curl -H "Content-Type:application/json" -XGET $ESHOST/$idx/_alias/*?pretty 297 | fi 298 | } 299 | alias es-idx-alias=es_idx_alias 300 | 301 | function es_alias_idx() { 302 | if [ $# -lt 1 ]; then 303 | echo "usage: es-alias-idx alias-name" 304 | else 305 | local name=$1 306 | curl -H "Content-Type:application/json" -XGET $ESHOST/*/_alias/$name?pretty 307 | fi 308 | } 309 | alias es-alias-idx=es_alias_idx 310 | 311 | function es_del_idx() { 312 | if [ $# -lt 1 ]; then 313 | echo "usage: es-del-idx index-name" 314 | else 315 | local idx=$1 316 | curl -XDELETE $ESHOST/$idx?pretty 317 | fi 318 | } 319 | alias es-del-idx=es_del_idx 320 | alias es-idxs="curl $ESHOST/_cat/indices?v" 321 | alias es-as="curl $ESHOST/_cat/aliases?v" 322 | alias esc='curl -H "Content-Type:application/json"' 323 | 324 | # 设置文件系统掩码,某些系统初始化后掩码有问题,统一设置为合理值 325 | umask 0022 326 | -------------------------------------------------------------------------------- /.vim/tools/python/pydiction.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Last modified: July 23rd, 2009 3 | """ 4 | 5 | pydiction.py 1.2 by Ryan Kulla (rkulla AT gmail DOT com). 6 | 7 | Description: Creates a Vim dictionary of Python module attributes for Vim's 8 | completion feature. The created dictionary file is used by 9 | the Vim ftplugin "python_pydiction.vim". 10 | 11 | Usage: pydiction.py ... [-v] 12 | Example: The following will append all the "time" and "math" modules' 13 | attributes to a file, in the current directory, called "pydiction" 14 | with and without the "time." and "math." prefix: 15 | $ python pydiction.py time math 16 | To print the output just to stdout, instead of appending to the file, 17 | supply the -v option: 18 | $ python pydiction.py -v time math 19 | 20 | License: BSD. 21 | """ 22 | 23 | 24 | __author__ = "Ryan Kulla (rkulla AT gmail DOT com)" 25 | __version__ = "1.2" 26 | __copyright__ = "Copyright (c) 2003-2009 Ryan Kulla" 27 | 28 | 29 | import os 30 | import sys 31 | import types 32 | import shutil 33 | 34 | 35 | # Path/filename of the vim dictionary file to write to: 36 | PYDICTION_DICT = r'complete-dict' 37 | # Path/filename of the vim dictionary backup file: 38 | PYDICTION_DICT_BACKUP = r'complete-dict.last' 39 | 40 | # Sentintal to test if we should only output to stdout: 41 | STDOUT_ONLY = False 42 | 43 | 44 | def get_submodules(module_name, submodules): 45 | """Build a list of all the submodules of modules.""" 46 | 47 | # Try to import a given module, so we can dir() it: 48 | try: 49 | imported_module = my_import(module_name) 50 | except ImportError, err: 51 | return submodules 52 | 53 | mod_attrs = dir(imported_module) 54 | 55 | for mod_attr in mod_attrs: 56 | if type(getattr(imported_module, mod_attr)) is types.ModuleType: 57 | submodules.append(module_name + '.' + mod_attr) 58 | 59 | return submodules 60 | 61 | 62 | def write_dictionary(module_name): 63 | """Write to module attributes to the vim dictionary file.""" 64 | prefix_on = '%s.%s' 65 | prefix_on_callable = '%s.%s(' 66 | prefix_off = '%s' 67 | prefix_off_callable = '%s(' 68 | 69 | try: 70 | imported_module = my_import(module_name) 71 | except ImportError, err: 72 | return 73 | 74 | mod_attrs = dir(imported_module) 75 | 76 | # Generate fully-qualified module names: 77 | write_to.write('\n--- import %s ---\n' % module_name) 78 | for mod_attr in mod_attrs: 79 | if callable(getattr(imported_module, mod_attr)): 80 | # If an attribute is callable, show an opening parentheses: 81 | format = prefix_on_callable 82 | else: 83 | format = prefix_on 84 | write_to.write(format % (module_name, mod_attr) + '\n') 85 | 86 | # Generate submodule names by themselves, for when someone does 87 | # "from foo import bar" and wants to complete bar.baz. 88 | # This works the same no matter how many .'s are in the module. 89 | if module_name.count('.'): 90 | # Get the "from" part of the module. E.g., 'xml.parsers' 91 | # if the module name was 'xml.parsers.expat': 92 | first_part = module_name[:module_name.rfind('.')] 93 | # Get the "import" part of the module. E.g., 'expat' 94 | # if the module name was 'xml.parsers.expat' 95 | second_part = module_name[module_name.rfind('.') + 1:] 96 | write_to.write('\n--- from %s import %s ---\n' % 97 | (first_part, second_part)) 98 | for mod_attr in mod_attrs: 99 | if callable(getattr(imported_module, mod_attr)): 100 | format = prefix_on_callable 101 | else: 102 | format = prefix_on 103 | write_to.write(format % (second_part, mod_attr) + '\n') 104 | 105 | # Generate non-fully-qualified module names: 106 | write_to.write('\n--- from %s import * ---\n' % module_name) 107 | for mod_attr in mod_attrs: 108 | if callable(getattr(imported_module, mod_attr)): 109 | format = prefix_off_callable 110 | else: 111 | format = prefix_off 112 | write_to.write(format % mod_attr + '\n') 113 | 114 | 115 | def my_import(name): 116 | """Make __import__ import "package.module" formatted names.""" 117 | mod = __import__(name) 118 | components = name.split('.') 119 | for comp in components[1:]: 120 | mod = getattr(mod, comp) 121 | return mod 122 | 123 | 124 | def remove_duplicates(seq, keep=()): 125 | """ 126 | 127 | Remove duplicates from a sequence while perserving order. 128 | 129 | The optional tuple argument "keep" can be given to specificy 130 | each string you don't want to be removed as a duplicate. 131 | """ 132 | seq2 = [] 133 | seen = set(); 134 | for i in seq: 135 | if i in (keep): 136 | seq2.append(i) 137 | continue 138 | elif i not in seen: 139 | seq2.append(i) 140 | seen.add(i) 141 | return seq2 142 | 143 | 144 | def get_yesno(msg="[Y/n]?"): 145 | """ 146 | 147 | Returns True if user inputs 'n', 'Y', "yes", "Yes"... 148 | Returns False if user inputs 'n', 'N', "no", "No"... 149 | If they enter an invalid option it tells them so and asks again. 150 | Hitting Enter is equivalent to answering Yes. 151 | Takes an optional message to display, defaults to "[Y/n]?". 152 | 153 | """ 154 | while True: 155 | answer = raw_input(msg) 156 | if answer == '': 157 | return True 158 | elif len(answer): 159 | answer = answer.lower()[0] 160 | if answer == 'y': 161 | return True 162 | break 163 | elif answer == 'n': 164 | return False 165 | break 166 | else: 167 | print "Invalid option. Please try again." 168 | continue 169 | 170 | 171 | def main(write_to): 172 | """Generate a dictionary for Vim of python module attributes.""" 173 | submodules = [] 174 | 175 | for module_name in sys.argv[1:]: 176 | try: 177 | imported_module = my_import(module_name) 178 | except ImportError, err: 179 | print "Couldn't import: %s. %s" % (module_name, err) 180 | sys.argv.remove(module_name) 181 | 182 | cli_modules = sys.argv[1:] 183 | 184 | # Step through each command line argument: 185 | for module_name in cli_modules: 186 | print "Trying module: %s" % module_name 187 | submodules = get_submodules(module_name, submodules) 188 | 189 | # Step through the current module's submodules: 190 | for submodule_name in submodules: 191 | submodules = get_submodules(submodule_name, submodules) 192 | 193 | # Add the top-level modules to the list too: 194 | for module_name in cli_modules: 195 | submodules.append(module_name) 196 | 197 | submodules.sort() 198 | 199 | # Step through all of the modules and submodules to create the dict file: 200 | for submodule_name in submodules: 201 | write_dictionary(submodule_name) 202 | 203 | if STDOUT_ONLY: 204 | return 205 | 206 | # Close and Reopen the file for reading and remove all duplicate lines: 207 | write_to.close() 208 | print "Removing duplicates..." 209 | f = open(PYDICTION_DICT, 'r') 210 | file_lines = f.readlines() 211 | file_lines = remove_duplicates(file_lines, ('\n')) 212 | f.close() 213 | 214 | # Delete the original file: 215 | os.unlink(PYDICTION_DICT) 216 | 217 | # Recreate the file, this time it won't have any duplicates lines: 218 | f = open(PYDICTION_DICT, 'w') 219 | for attr in file_lines: 220 | f.write(attr) 221 | f.close() 222 | print "Done." 223 | 224 | 225 | if __name__ == '__main__': 226 | """Process the command line.""" 227 | 228 | if sys.version_info[0:2] < (2, 3): 229 | sys.exit("You need a Python 2.x version of at least Python 2.3") 230 | 231 | if len(sys.argv) <= 1: 232 | sys.exit("%s requires at least one argument. None given." % 233 | sys.argv[0]) 234 | 235 | if '-v' in sys.argv: 236 | write_to = sys.stdout 237 | sys.argv.remove('-v') 238 | STDOUT_ONLY = True 239 | elif os.path.exists(PYDICTION_DICT): 240 | # See if any of the given modules have already been pydiction'd: 241 | f = open(PYDICTION_DICT, 'r') 242 | file_lines = f.readlines() 243 | for module_name in sys.argv[1:]: 244 | for line in file_lines: 245 | if line.find('--- import %s ' % module_name) != -1: 246 | print '"%s" already exists in %s. Skipping...' % \ 247 | (module_name, PYDICTION_DICT) 248 | sys.argv.remove(module_name) 249 | break 250 | f.close() 251 | 252 | if len(sys.argv) < 2: 253 | # Check if there's still enough command-line arguments: 254 | sys.exit("Nothing new to do. Aborting.") 255 | 256 | if os.path.exists(PYDICTION_DICT_BACKUP): 257 | answer = get_yesno('Overwrite existing backup "%s" [Y/n]? ' % \ 258 | PYDICTION_DICT_BACKUP) 259 | if (answer): 260 | print "Backing up old dictionary to: %s" % \ 261 | PYDICTION_DICT_BACKUP 262 | try: 263 | shutil.copyfile(PYDICTION_DICT, PYDICTION_DICT_BACKUP) 264 | except IOError, err: 265 | print "Couldn't back up %s. %s" % (PYDICTION_DICT, err) 266 | else: 267 | print "Skipping backup..." 268 | 269 | print 'Appending to: "%s"' % PYDICTION_DICT 270 | else: 271 | print "Backing up current %s to %s" % \ 272 | (PYDICTION_DICT, PYDICTION_DICT_BACKUP) 273 | try: 274 | shutil.copyfile(PYDICTION_DICT, PYDICTION_DICT_BACKUP) 275 | except IOError, err: 276 | print "Couldn't back up %s. %s" % (PYDICTION_DICT, err) 277 | else: 278 | print 'Creating file: "%s"' % PYDICTION_DICT 279 | 280 | 281 | if not STDOUT_ONLY: 282 | write_to = open(PYDICTION_DICT, 'a') 283 | 284 | main(write_to) 285 | -------------------------------------------------------------------------------- /.vim/tools/js/javascript.dict: -------------------------------------------------------------------------------- 1 | ActiveXObject 2 | Array 3 | attachEvent 4 | Boolean 5 | Components 6 | DOM 7 | DOMMouseScroll 8 | Date 9 | Error 10 | EvalError 11 | Function 12 | Image 13 | Infinity 14 | LN10 15 | LN2 16 | LOG10E 17 | LOG2E 18 | MAX_VALUE 19 | MIN_VALUE 20 | Math 21 | NEGATIVE_INFINITY 22 | NaN 23 | Number 24 | Object 25 | PI 26 | POSITIVE_INFINITY 27 | RangeError 28 | ReferenceError 29 | RegExp 30 | SQRT1_2 31 | SQRT2 32 | String 33 | SyntaxError 34 | TypeError 35 | URIError 36 | URL 37 | UTC 38 | __defineGetter__ 39 | __defineSetter__ 40 | __lookupGetter__ 41 | __lookupSetter__ 42 | _content 43 | abs 44 | acceptCharset 45 | acos 46 | action 47 | addEventListener 48 | addRange 49 | alert 50 | align 51 | alinkColor 52 | all 53 | alt 54 | altKey 55 | anchor 56 | anchorNode 57 | anchorOffset 58 | anchors 59 | appCodeName 60 | appMinorVersion 61 | appName 62 | appVersion 63 | appendChild 64 | applets 65 | apply 66 | arguments 67 | arity 68 | asin 69 | assign 70 | atan 71 | atan2 72 | atob 73 | attributes 74 | availHeight 75 | availLeft 76 | availTop 77 | availWidth 78 | back 79 | backgroundColor 80 | bgColor 81 | bgColorDeprecated 82 | big 83 | blink 84 | blur 85 | body 86 | bold 87 | border 88 | borderBottom 89 | borderBottomColor 90 | borderBottomStyle 91 | borderBottomWidth 92 | borderColor 93 | borderLeft 94 | borderLeftColor 95 | borderLeftStyle 96 | borderLeftWidth 97 | borderRight 98 | borderRightColor 99 | borderRightStyle 100 | borderRightWidth 101 | borderStyle 102 | borderTop 103 | borderTopColor 104 | borderTopStyle 105 | borderTopWidth 106 | borderWidth 107 | break 108 | browserLanguage 109 | btoa 110 | bubbles 111 | bufferDepth 112 | button 113 | call 114 | caller 115 | cancelBubble 116 | cancelable 117 | caption 118 | captureEvents 119 | case 120 | catch 121 | ceil 122 | cellPadding 123 | cellSpacing 124 | charAt 125 | charCode 126 | charCodeAt 127 | characterSet 128 | charset 129 | childNodes 130 | className 131 | clear 132 | clearInterval 133 | clearTimeout 134 | click 135 | clientHeight 136 | clientLeft 137 | clientTop 138 | clientWidth 139 | clientX 140 | clientY 141 | cloneNode 142 | close 143 | closed 144 | collapse 145 | collapseToEnd 146 | collapseToStart 147 | color 148 | colorDepth 149 | compatMode 150 | complete 151 | concat 152 | confirm 153 | const 154 | constructor 155 | containsNode 156 | content 157 | contentWindow 158 | continue 159 | controllers 160 | cookie 161 | cookieEnabled 162 | cos 163 | cpuClass 164 | createAttribute 165 | createCaption 166 | createDocumentFragment 167 | createElement 168 | createElementNS 169 | createEvent 170 | createNSResolver 171 | createRange 172 | createTFoot 173 | createTHead 174 | createTextNode 175 | crypto 176 | ctrlKey 177 | current 178 | currentTarget 179 | decodeURI 180 | decodeURIComponent 181 | default 182 | defaultCharset 183 | defaultStatus 184 | defaultView 185 | delete 186 | deleteCaption 187 | deleteFromDocument 188 | deleteRow 189 | deleteTFoot 190 | deleteTHead 191 | description 192 | designMode 193 | detail 194 | deviceXDPI 195 | deviceYDPI 196 | dir 197 | directories 198 | dispatchEvent 199 | display 200 | do 201 | doctype 202 | document 203 | documentElement 204 | domain 205 | dump 206 | elements 207 | else 208 | embeds 209 | encodeURI 210 | encodeURIComponent 211 | encoding 212 | enctype 213 | escape 214 | eval 215 | evaluate 216 | event 217 | eventPhase 218 | every 219 | exec 220 | execCommand 221 | exp 222 | explicitOriginalTarget 223 | export 224 | extend 225 | fgColor 226 | fileName 227 | filter 228 | finally 229 | find 230 | firstChild 231 | fixed 232 | floor 233 | focus 234 | focusNode 235 | focusOffset 236 | font 237 | fontFamily 238 | fontSize 239 | fontSmoothingEnabled 240 | fontStretch 241 | fontStyle 242 | fontVariant 243 | fontWeight 244 | fontcolor 245 | fontsize 246 | for 247 | forEach 248 | forms 249 | forward 250 | frame 251 | frameElement 252 | frames 253 | fromCharCode 254 | fromElement 255 | function 256 | galleryImg 257 | getAttention 258 | getAttribute 259 | getAttributeNS 260 | getAttributeNode 261 | getAttributeNodeNS 262 | getBoundingClientRect 263 | getComputedStyle 264 | getDate 265 | getDay 266 | getElementById 267 | getElementsByName 268 | getElementsByTagName 269 | getElementsByTagNameNS 270 | getFullYear 271 | getHours 272 | getMilliseconds 273 | getMinutes 274 | getMonth 275 | getRangeAt 276 | getSeconds 277 | getSelection 278 | getTime 279 | getTimezoneOffset 280 | getUTCDate 281 | getUTCDay 282 | getUTCFullYear 283 | getUTCHours 284 | getUTCMilliseconds 285 | getUTCMinutes 286 | getUTCMonth 287 | getUTCSeconds 288 | getYear 289 | global 290 | go 291 | hasAttribute 292 | hasAttributeNS 293 | hasAttributes 294 | hasChildNodes 295 | hasOwnProperty 296 | hash 297 | height 298 | history 299 | home 300 | host 301 | hostname 302 | href 303 | hspace 304 | id 305 | if 306 | ignoreCase 307 | images 308 | implementation 309 | import 310 | importNode 311 | in 312 | index 313 | indexOf 314 | initEvent 315 | initKeyEvent 316 | initMouseEvent 317 | initUIEvent 318 | innerHTML 319 | innerHeight 320 | innerWidth 321 | input 322 | insertBefore 323 | insertRow 324 | instanceof 325 | isChar 326 | isCollapsed 327 | isFinite 328 | isMap 329 | isNaN 330 | isPrototypeOf 331 | italics 332 | item 333 | javaEnabled 334 | join 335 | keyCode 336 | label 337 | lang 338 | language 339 | lastChild 340 | lastIndex 341 | lastIndexOf 342 | lastModified 343 | layerX 344 | layerY 345 | left 346 | length 347 | lineNumber 348 | link 349 | linkColor 350 | links 351 | loadOverlay 352 | localName 353 | location 354 | locationbar 355 | log 356 | logicalXDPI 357 | logicalYDPI 358 | lowsrc 359 | map 360 | match 361 | max 362 | menubar 363 | message 364 | metaKey 365 | method 366 | mimeTypes 367 | min 368 | moveBy 369 | moveTo 370 | multiline 371 | name 372 | nameProp 373 | namespaceURI 374 | navigate 375 | navigator 376 | new 377 | nextSibling 378 | nodeName 379 | nodeType 380 | nodeValue 381 | normalize 382 | now 383 | number 384 | offsetHeight 385 | offsetLeft 386 | offsetParent 387 | offsetTop 388 | offsetWidth 389 | offsetX 390 | offsetY 391 | onAbort 392 | onAfterPrint 393 | onBeforeCopy 394 | onBeforeCut 395 | onBeforePaste 396 | onBeforePrint 397 | onBeforeUnload 398 | onBlur 399 | onChange 400 | onClick 401 | onContextMenu 402 | onCopy 403 | onCut 404 | onDblClick 405 | onDrag 406 | onDragEnd 407 | onDragEnter 408 | onDragLeave 409 | onDragOver 410 | onDragStart 411 | onDrop 412 | onError 413 | onFinish 414 | onFocus 415 | onFocusIn 416 | onFocusOut 417 | onHelp 418 | onKeyDown 419 | onKeyPress 420 | onKeyUp 421 | onLine 422 | onLoad 423 | onMouseDown 424 | onMouseEnter 425 | onMouseLeave 426 | onMouseMove 427 | onMouseOut 428 | onMouseOver 429 | onMouseUp 430 | onMouseWheel 431 | onMove 432 | onMoveEnd 433 | onMoveStart 434 | onPaste 435 | onReadyStateChange 436 | onReset 437 | onResize 438 | onResizeEnd 439 | onResizeStart 440 | onScroll 441 | onSelect 442 | onSelectStart 443 | onSelectionChange 444 | onStart 445 | onStop 446 | onSubmit 447 | onUnload 448 | onabort 449 | onblur 450 | onchange 451 | onclick 452 | onclose 453 | ondblclick 454 | ondragdrop 455 | onerror 456 | onfocus 457 | onkeydown 458 | onkeypress 459 | onkeyup 460 | onload 461 | onmousedown 462 | onmousemove 463 | onmouseout 464 | onmouseover 465 | onmouseup 466 | onpaint 467 | onreset 468 | onresize 469 | onscroll 470 | onselect 471 | onsubmit 472 | onunload 473 | open 474 | openDialog 475 | opener 476 | opera 477 | opsProfile 478 | originalTarget 479 | oscpu 480 | outerHeight 481 | outerWidth 482 | ownerDocument 483 | pageX 484 | pageXOffset 485 | pageY 486 | pageYOffset 487 | parent 488 | parentNode 489 | parse 490 | parseFloat 491 | parseInt 492 | pathname 493 | personalbar 494 | pixelDepth 495 | pkcs11 496 | platform 497 | plugins 498 | pop 499 | port 500 | pow 501 | preference 502 | prefix 503 | preventBubble 504 | preventCapture 505 | preventDefault 506 | previousSibling 507 | print 508 | product 509 | productSub 510 | prompt 511 | propertyIsEnumerable 512 | propertyName 513 | protocol 514 | prototype 515 | push 516 | queryCommandEnabled 517 | queryCommandIndeterm 518 | queryCommandState 519 | queryCommandValue 520 | random 521 | rangeCount 522 | reduce 523 | reduceRight 524 | referrer 525 | relatedTarget 526 | releaseEvents 527 | reload 528 | removeAllRanges 529 | removeAttribute 530 | removeAttributeNS 531 | removeAttributeNode 532 | removeChild 533 | removeEventListener 534 | removeRange 535 | replace 536 | replaceChild 537 | reset 538 | resizeBy 539 | resizeTo 540 | return 541 | reverse 542 | round 543 | rows 544 | rules 545 | screen 546 | screenLeft 547 | screenTop 548 | screenX 549 | screenY 550 | scroll 551 | scrollBy 552 | scrollByLines 553 | scrollByPages 554 | scrollHeight 555 | scrollIntoView 556 | scrollLeft 557 | scrollMaxX 558 | scrollMaxY 559 | scrollTo 560 | scrollTop 561 | scrollWidth 562 | scrollX 563 | scrollY 564 | scrollbars 565 | search 566 | securityPolicy 567 | selectAllChildren 568 | selectionLanguageChange 569 | self 570 | setAttribute 571 | setAttributeNS 572 | setAttributeNode 573 | setAttributeNodeNS 574 | setDate 575 | setFullYear 576 | setHours 577 | setInterval 578 | setMilliseconds 579 | setMinutes 580 | setMonth 581 | setSeconds 582 | setTime 583 | setTimeout 584 | setUTCDate 585 | setUTCFullYear 586 | setUTCHours 587 | setUTCMilliseconds 588 | setUTCMinutes 589 | setUTCMonth 590 | setUTCSeconds 591 | setYear 592 | shift 593 | shiftKey 594 | sidebar 595 | sin 596 | sizeToContent 597 | slice 598 | small 599 | some 600 | sort 601 | source 602 | sourceIndex 603 | splice 604 | split 605 | sqrt 606 | src 607 | srcElement 608 | stack 609 | status 610 | statusbar 611 | stop 612 | stopPropagation 613 | strike 614 | style 615 | styleSheets 616 | sub 617 | submit 618 | substr 619 | substring 620 | summary 621 | sup 622 | supports 623 | switch 624 | systemLanguage 625 | tBodies 626 | tFoot 627 | tHead 628 | tabIndex 629 | tagName 630 | taintEnabled 631 | tan 632 | target 633 | test 634 | textContent 635 | this 636 | throw 637 | timeStamp 638 | title 639 | toDateString 640 | toElement 641 | toExponential 642 | toFixed 643 | toGMTString 644 | toLocaleDateString 645 | toLocaleLowerCase 646 | toLocaleString 647 | toLocaleTimeString 648 | toLocaleUpperCase 649 | toLowerCase 650 | toPrecision 651 | toSource 652 | toString 653 | toTimeString 654 | toUTCString 655 | toUpperCase 656 | toolbar 657 | top 658 | try 659 | type 660 | typeof 661 | undefined 662 | unescape 663 | uniqueID 664 | unshift 665 | unwatch 666 | updateCommands 667 | updateInterval 668 | useMap 669 | userAgent 670 | userLanguage 671 | userProfile 672 | valueOf 673 | var 674 | vendor 675 | vendorSub 676 | view 677 | vlinkColor 678 | void 679 | vspace 680 | watch 681 | wheelDelta 682 | which 683 | while 684 | width 685 | window 686 | with 687 | write 688 | writeln 689 | XMLHttpRequest 690 | console 691 | debugger 692 | --------------------------------------------------------------------------------