├── bin
├── show_doc
├── update
├── show_net_stats
├── rm_ds
├── change_git_origin_remote
├── git_init
├── word_count
├── show_memory_usage
├── search_aj
└── generate_md_contents
├── test
├── test_doc.md
├── test_doc_with_contents.md
└── test_doc_with_contents_anchor.md
├── doc
├── shortcut_keys_intro.md
├── brew_commands.md
├── ssh_timeout_solution.md
├── ssh_keys_save.md
├── st_shortcut_keys.md
├── useful_shells.md
└── zsh_tips.md
├── Makefile
├── mthings
├── .gitignore
├── common.sh
├── get.sh
├── tpl
└── gitignore.tpl
├── README.md
└── LICENSE
/bin/show_doc:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | more $MTHINGS_DIR/doc/$1'.md'
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "update mthings ..."
4 | cd $MTHINGS_DIR && git pull
5 |
6 | echo "update finished!"
--------------------------------------------------------------------------------
/bin/show_net_stats:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## show netstas
3 |
4 | netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
5 |
--------------------------------------------------------------------------------
/test/test_doc.md:
--------------------------------------------------------------------------------
1 | # Title
2 |
3 | ## SubTitle1
4 |
5 | sub title 1
6 |
7 | ## SubTitle2
8 |
9 | sub title 2
10 |
11 | ## SubTitle3
12 |
13 | sub title 3
--------------------------------------------------------------------------------
/bin/rm_ds:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## remove all the .DS_Store file in currrent dir
3 | # @Usage
4 | # $ ./rm_ds
5 | #
6 | # @author Bryant Hang
7 |
8 | find $PWD -name ".DS_Store" -exec rm -f {} \;
9 |
--------------------------------------------------------------------------------
/bin/change_git_origin_remote:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## change origin remote in a git repository
3 |
4 | git remote rm origin
5 | git remote add origin $1
6 |
7 | git fetch
8 |
9 | git branch --set-upstream-to=origin/master master
10 |
--------------------------------------------------------------------------------
/test/test_doc_with_contents.md:
--------------------------------------------------------------------------------
1 | # Title
2 |
3 | ## 目录
4 |
5 | * [SubTitle1](#subtitle1)
6 | * [SubTitle2](#subtitle2)
7 | * [SubTitle3](#subtitle3)
8 |
9 | ## SubTitle1
10 |
11 | sub title 1
12 |
13 | ## SubTitle2
14 |
15 | sub title 2
16 |
17 | ## SubTitle3
18 |
19 | sub title 3
--------------------------------------------------------------------------------
/doc/shortcut_keys_intro.md:
--------------------------------------------------------------------------------
1 | ⇧Shift
2 |
3 | ←方向键 左
4 |
5 | ↑方向键 上
6 |
7 | →方向键 右
8 |
9 | ↓方向键 下
10 |
11 | ↩Return
12 |
13 | ⇞PageUp
14 |
15 | ⇟PageDown
16 |
17 | ⌃Control
18 |
19 | ⌤Enter
20 |
21 | ⌘Command
22 |
23 | ⌥Option(Alt)
24 |
25 | ⌫Delete
26 |
27 | ⎋Escape(Esc)
28 |
29 | ⏏Eject
--------------------------------------------------------------------------------
/doc/brew_commands.md:
--------------------------------------------------------------------------------
1 | # HomeBrew隐藏命令
2 |
3 | 1. brew services [command] [formula]
4 |
5 | > 服务管理命令。command包括cleanup、list、restart、start、stop;formul是服务的名字,如nginx,mysql等。cleanup和list不用带有formula参数。
6 |
7 | 1. brew tap [github_user/repo]
8 |
9 | > 安装非官方扩展之前需要先使用这个命令添加github源。
10 |
11 | 1. brew commands
12 |
13 | > 可以查看所有命令,包括brew --help不包括的。
--------------------------------------------------------------------------------
/test/test_doc_with_contents_anchor.md:
--------------------------------------------------------------------------------
1 | # Title
2 |
3 | ## 目录
4 |
5 | * [SubTitle1](#SubTitle1)
6 | * [SubTitle2](#SubTitle2)
7 | * [SubTitle3](#SubTitle3)
8 |
9 | ## SubTitle1
10 |
11 | sub title 1
12 |
13 | ## SubTitle2
14 |
15 | sub title 2
16 |
17 | ## SubTitle3
18 |
19 | sub title 3
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | prefix=/usr/local
2 |
3 | all:
4 | @echo "usage: make install"
5 | @echo " make uninstall"
6 |
7 | install:
8 | @mkdir -p $(prefix)/bin/
9 | @echo '#!/bin/bash' > $(prefix)/bin/mthings
10 | @echo '##$(shell pwd)' >> $(prefix)/bin/mthings
11 | @echo 'exec "$(shell pwd)/mthings" "$$@"' >> $(prefix)/bin/mthings
12 | @chmod 755 $(prefix)/bin/mthings
13 | @chmod 755 mthings
14 | @echo 'install finished! type "mthings" to show usages.'
15 | uninstall:
16 | @rm -f $(prefix)/bin/mthings
--------------------------------------------------------------------------------
/doc/ssh_timeout_solution.md:
--------------------------------------------------------------------------------
1 | ## Solution of ssh connection timeout in Mac
2 |
3 | When using mac os to connect a sever with ssh,we often find that the connection will timeout after a period time. The reason is the config in server.
4 | In /etc/ssh/sshd_config, ClientAliveCountMax(minute) represent the timout.U can modify the server config to solve the problem.But when u can't config the server,U can do follow things:
5 |
6 | - Use terminal
7 |
8 | open .ssh/config and add
9 |
10 | ServerAliveInterval 60
11 |
12 | the unit of ***ServerAliveInterval*** is Second.
13 |
14 | - Use zoc
15 |
16 | Session Profile -> Idel Timer -> After "3" sec. idle Send ^@.
17 |
--------------------------------------------------------------------------------
/mthings:
--------------------------------------------------------------------------------
1 |
2 | #!/bin/bash
3 |
4 | export MTHINGS_DIR=$(dirname $0)
5 |
6 | # load common lib functions
7 | source $MTHINGS_DIR/common.sh
8 |
9 | if [ $# = 0 ];then
10 | print_column 'Usage '
11 | print_column " mthings list\t: show all commands \nmthings command\t: execute a command\nmthings show_doc\t: show the contents of the specified doc\nmthings update\t: update mthings\nmthings uninstall\t: uninstall mthings"
12 | exit
13 | fi
14 |
15 | if [ "$1" = "list" ];then
16 | list_command "$@"
17 | fi
18 |
19 | tools_dir=$MTHINGS_DIR/bin
20 | command_file=$1;shift
21 | command=`find $tools_dir -maxdepth 1 -name $command_file `
22 |
23 | if [ ! -f "$command" ]; then
24 | echo "$command_file command not found!"
25 | exit 1;
26 | fi
27 |
28 | exec "$command" "$@"
--------------------------------------------------------------------------------
/bin/git_init:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## init git repository with .gitignore
3 | # @Usage
4 | # $ ./git_init [git_repos_url] [to_dir]
5 | #
6 | # @author Bryant Hang
7 |
8 | if [ ! -z $1 ]; then
9 | DIR=$2
10 | if [ -z $DIR ]; then
11 | OLD_IFS=”$IFS”
12 | IFS=”/”
13 | arr=($1)
14 | IFS=”$OLD_IFS”
15 | len=${#arr[@]}
16 | DIR=${arr[($len-1)]}
17 | fi
18 |
19 | git clone $1 $DIR
20 |
21 | echo 'git cloned to '$DIR
22 |
23 | cd $DIR
24 | fi
25 |
26 | rm -rf .gitignore
27 |
28 | #IGNORE_FILES=(.DS_Store build target .idea .classpath .project *.iml out)
29 |
30 | #for rm_file in ${IGNORE_FILES[@]}
31 | #do
32 | # echo $rm_file >> .gitignore
33 | #done
34 |
35 | PRG="$0"
36 | PRGDIR=`dirname "$PRG"`
37 | cp -rf $PRGDIR/../tpl/gitignore.tpl .gitignore
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 |
5 | # C extensions
6 | *.so
7 |
8 | # Distribution / packaging
9 | .Python
10 | env/
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | lib/
17 | lib64/
18 | parts/
19 | sdist/
20 | var/
21 | *.egg-info/
22 | .installed.cfg
23 | *.egg
24 |
25 | # PyInstaller
26 | # Usually these files are written by a python script from a template
27 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
28 | *.manifest
29 | *.spec
30 |
31 | # Installer logs
32 | pip-log.txt
33 | pip-delete-this-directory.txt
34 |
35 | # Unit test / coverage reports
36 | htmlcov/
37 | .tox/
38 | .coverage
39 | .cache
40 | nosetests.xml
41 | coverage.xml
42 |
43 | # Translations
44 | *.mo
45 | *.pot
46 |
47 | # Django stuff:
48 | *.log
49 |
50 | # Sphinx documentation
51 | docs/_build/
52 |
53 | # PyBuilder
54 | target/
55 | .DS_Store
56 |
--------------------------------------------------------------------------------
/doc/ssh_keys_save.md:
--------------------------------------------------------------------------------
1 | Mac系统Yosemite版本之前,可以通过`ssh-add -K `将私钥存入keychain中。但是之后的版本中由于OpenSSH版本升级,此方式不再生效,每次重启系统都需要再次ssh-add。
2 |
3 | 1. 在`~/.ssh/config`中对Host进行配置
4 |
5 | ```
6 | Host <* | hostName>
7 | ...
8 | IdentityFile
9 | UseKeychain yes
10 | AddKeysToAgent yes
11 | ...
12 | ```
13 |
14 | 2. 使用`ssh-add -K `将私钥加入到keychain中,然后每次启动系统时自动执行`ssh-add -A`。
15 |
16 | ```
17 |
18 |
19 |
20 |
21 |
22 | Label
23 | ssh-add-a
24 | ProgramArguments
25 |
26 | ssh-add
27 | -A
28 |
29 | RunAtLoad
30 |
31 |
32 |
33 | ```
34 |
--------------------------------------------------------------------------------
/bin/word_count:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=UTF-8
3 | ## count the word in the doc, support chinese
4 |
5 |
6 | import sys
7 | import shutil
8 | import os
9 | import getopt
10 | import string
11 |
12 | reload(sys)
13 | sys.setdefaultencoding( "utf-8" )
14 |
15 | def usage():
16 | print "usage: word_count doc_name"
17 |
18 | def main():
19 | opts,args = getopt.getopt(sys.argv[1:],'',[])
20 |
21 | argc = len(args)
22 | if argc < 1:
23 | print "Invalid argument count."
24 | sys.exit(1)
25 |
26 | fname = args[0]
27 |
28 | print '-'*10 + 'start wordcount for %s' % fname + '-'*10
29 |
30 | count = 0
31 | with open(fname) as f:
32 | words = f.read().strip()
33 | for ch in '!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ \n':
34 | words = words.replace(ch, '')
35 | count = count + len(words.decode('utf-8'))
36 |
37 | print '-'*10 + 'total word: %s' % count + '-'*10
38 |
39 | if __name__ == "__main__":
40 | main()
--------------------------------------------------------------------------------
/bin/show_memory_usage:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | ## show the memory usage
3 |
4 | import subprocess
5 |
6 | import re
7 |
8 | # Get process info
9 | ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0]
10 | vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0]
11 |
12 | # Iterate processes
13 | processLines = ps.split('\n')
14 | sep = re.compile('[\s]+')
15 | rssTotal = 0 # kB
16 | for row in range(1,len(processLines)):
17 | rowText = processLines[row].strip()
18 | rowElements = sep.split(rowText)
19 | try:
20 | rss = float(rowElements[0]) * 1024
21 | except:
22 | rss = 0 # ignore...
23 | rssTotal += rss
24 |
25 | # Process vm_stat
26 | vmLines = vm.split('\n')
27 | sep = re.compile(':[\s]+')
28 | vmStats = {}
29 | for row in range(1,len(vmLines)-2):
30 | rowText = vmLines[row].strip()
31 | rowElements = sep.split(rowText)
32 | vmStats[(rowElements[0])] = int(rowElements[1].strip('\.')) * 4096
33 |
34 | print 'Wired Memory:\t\t%d MB' % ( vmStats["Pages wired down"]/1024/1024 )
35 | print 'Active Memory:\t\t%d MB' % ( vmStats["Pages active"]/1024/1024 )
36 | print 'Inactive Memory:\t%d MB' % ( vmStats["Pages inactive"]/1024/1024 )
37 | print 'Free Memory:\t\t%d MB' % ( vmStats["Pages free"]/1024/1024 )
38 | print 'Real Mem Total (ps):\t%.3f MB' % ( rssTotal/1024/1024 )
39 |
--------------------------------------------------------------------------------
/doc/st_shortcut_keys.md:
--------------------------------------------------------------------------------
1 | ## 打开/前往
2 |
3 | ⌘T 前往文件
4 |
5 | ⌘⌃P 前往项目
6 |
7 | ⌘R 前往 method
8 |
9 | ⌘⇧P 命令提示
10 |
11 | ⌃G 前往行
12 |
13 | ⌘KB 开关侧栏
14 |
15 | ⌃ ` python 控制台
16 |
17 | ⌘⇧N 新建窗口
18 |
19 | ## 编辑
20 |
21 | ⌘L 选择行 (重复按下将下一行加入选择)
22 |
23 | ⌘D 选择词 (重复按下时多重选择相同的词进行多重编辑)
24 |
25 | ⌃⇧M 选择括号内的内容
26 |
27 | ⌘⇧↩ 在当前行前插入新行
28 |
29 | ⌘↩ 在当前行后插入新行
30 |
31 | ⌃⇧K 删除行
32 |
33 | ⌘KK 从光标处删除至行尾
34 |
35 | ⌘K⌫ 从光标处删除至行首
36 |
37 | ⌘⇧D 复制(多)行
38 |
39 | ⌘J 合并(多)行
40 |
41 | ⌘KU 改为大写
42 |
43 | ⌘KL 改为小写
44 |
45 | ⌘ / 注释
46 |
47 | ⌘⌥ / 块注释
48 |
49 | ⌘Y 恢复或重复
50 |
51 | ⌘⇧V 粘贴并自动缩进
52 |
53 | ⌃ space 自动完成(重复按下选择下一个提示)
54 |
55 | ⌃M 跳转至对应的括号
56 |
57 | ⌘U 软撤销(可撤销光标移动)
58 |
59 | ⌘⇧U 软重做(可重做光标移动)
60 |
61 | ## XML/HTML
62 |
63 | ⌘⇧A 选择标签内的内容
64 |
65 | ⌘⌥ . 闭合当前标签
66 |
67 | ## 查找/替换
68 |
69 | ⌘F 查找
70 |
71 | ⌘⌥F 替换
72 |
73 | ⌘⌥G 查找下一个符合当前所选的内容
74 |
75 | ⌘⌃G 查找所有符合当前所选的内容进行多重编辑
76 |
77 | ⌘⇧F 在所有打开的文件中进行查找
78 |
79 | ## 拆分窗口/标签页
80 |
81 | ⌘⌥1 单列
82 |
83 | ⌘⌥2 双列
84 |
85 | ⌘⌥5 网格 (4组)
86 |
87 | ⌃[1,2,3,4] 焦点移动至相应组
88 |
89 | ⌃⇧[1,2,3,4] 将当前文件移动至相应组
90 |
91 | ⌘[1,2,3…] 选择相应标签页
92 |
93 | ## 书签
94 |
95 | ⌘F2 添加/去除书签
96 |
97 | F2 下一个书签
98 |
99 | ⇧F2 前一个书签
100 |
101 | ⌘⇧F2 清除书签
102 |
103 | ## 标记
104 |
105 | ⌘K space 设置标记
106 |
107 | ⌘KW 从光标位置删除至标记
108 |
109 | ⌘KA 从光标位置选择至标记
110 |
111 | ⌘KG 清除标记
--------------------------------------------------------------------------------
/common.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | print_column (){
4 | echo -e $1 |awk -F'\t' '{printf "%-15s%s\n",$1,$2}'
5 | }
6 |
7 | print_title (){
8 | length=`echo "$1" |wc -c`
9 | prefix_count=$(((30-length)/2))
10 | for i in `seq 0 $prefix_count` ;do
11 | echo -n '='
12 | done
13 | echo -n " $1 "
14 | postfix_count=$((length % 2 != 0 ? prefix_count+1: prefix_count))
15 | for i in `seq 0 $postfix_count` ;do
16 | echo -n '='
17 | done
18 | printf '\r\n'
19 | }
20 |
21 | find_command(){
22 | commands=`ls -l $1/bin |grep -v '^d' |awk '{print $9}'`
23 | if [ "$commands" = "" ]; then
24 | continue;
25 | fi
26 |
27 | print_title bin
28 | for file in $commands ;do
29 | desp=`grep '^##' $1/bin/$file | cut -c 3-`
30 | if [ "$desp" != "" ]; then
31 | print_column "$file\t:$desp"
32 | echo "$file" >> $HOME/.mthings/cmds.cache
33 | fi
34 | done
35 | echo ''
36 | }
37 |
38 | list_command() {
39 | rm -f $HOME/.mthings/cmds.cache 2>/dev/null
40 | mkdir $HOME/.mthings 2>/dev/null
41 | echo 'Available commands:'
42 | find_command $MTHINGS_DIR
43 | exit 0;
44 | }
45 |
46 | uninstall() {
47 | echo -n "Uninstall mthings,(y)es or (n)o?"
48 | read choice < /dev/tty
49 | if [ "$choice" = "y" ] && [ "$MTHINGS_DIR" != "/" ];then
50 | cd $MTHINGS_DIR && make uninstall && rm -rf $MTHINGS_DIR && echo "mthings uninstall finished. Bye~"
51 | fi
52 | exit 0
53 | }
54 |
--------------------------------------------------------------------------------
/doc/useful_shells.md:
--------------------------------------------------------------------------------
1 | # 查看某个工具编译出来的时间
2 | $(which appname)
3 |
4 | # 常用for循环
5 | for i in 1 2 3 4 5; do echo "$i"; done;
6 |
7 | for((i=140;i<200;i++)); do git tag -d v1.3.$i;done;
8 |
9 | # 常用读取文件
10 | cat filename | while read line
11 | do
12 | echo $line
13 | done
14 |
15 | # "$@"的神奇之处 "$@" 的 参数如果是 “test test” 会直接输出。不会分开
16 | for i in "$@"; do
17 |
18 | # mail和mutt的使用
19 | echo hello| mail -s "test" "test@126.com" -f "no-reply@126.com"
20 | echo | mutt -a syslogs.tar.gz admin@domain.org
21 |
22 | #查看当前文件夹的总大小
23 | du -sh dirname
24 |
25 | # 使用caffeinate阻止Mac运行屏幕保护和睡眠
26 | caffeinate -t 3600
27 |
28 | # 使用pkgutil解压PKG文件
29 | pkgutil --expand macx.pkg ~/Desktop/
30 |
31 | # 使用purge命令释放内存
32 | purge
33 |
34 | # 使用open命令开启多个相同应用
35 | open -n /Applications/Safari.app/
36 |
37 | # 不通过App Store更新OS X
38 | sudo softwareupdate -i -a
39 |
40 | # 将所有下载过的文件列出来
41 | sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent' |more
42 |
43 | # 使用chflags命令隐藏文件或文件夹,如果你想再次看到文件夹,只需将hidden改为nohidden即可。
44 | chflags hidden ~/Desktop/macx
45 |
46 | # 创建有密码保护的压缩文件
47 | zip -e protected.zip ~/Desktop/macx.txt
48 |
49 | ## .DS_store
50 |
51 | .DS_Store是Mac OS保存文件夹的自定义属性的隐藏文件,如文件的图标位置或背景色,相当于Windows的desktop.ini。
52 |
53 | - 禁止.DS_store生成:defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
54 | - 恢复.DS_store生成: defaults delete com.apple.desktopservices DSDontWriteNetworkStores
55 |
--------------------------------------------------------------------------------
/doc/zsh_tips.md:
--------------------------------------------------------------------------------
1 | # ZSH使用技巧
2 |
3 | ## 1. ‘cd’命令的自动补全
4 |
5 | cd
6 |
7 | 当你在Bash中按下键,你会看到当前目录的文件列表。
8 |
9 | ## 2. ‘ls’命令自动补全
10 |
11 | ls
12 |
13 | ## 3. 聪明的历史记录
14 |
15 | 以输入命令的一部分并按下键。它会找到历史记录中最后一条以’ls’开头的指令。如果需要,我们可以继续点击向上键循环查找。
16 |
17 | ## 4. 命令历史共享
18 |
19 | 在Bash中,每一个shell都有自己的历史。Zsh与所有现行的shell共享命令历史。这意味着你不必记住你在哪里输入过命令。
20 |
21 | ## 5. 环境变量展开
22 |
23 | 在Zsh中,你可以按下键来展开这些值。
24 |
25 | $JAVA_HOME
26 |
27 | ## 6. 进程关闭命令的自动补全
28 |
29 | 通常,我会在用ps命令查看进程值后使用kill命令,或者如果明确可以使用pkill,Zsh给了你另外一个选择。
30 |
31 | kill -9
32 |
33 | ## 7. 那个选项是什么?
34 |
35 | 为了弄明白一条命令如何工作,通常你会尝试执行它,或者不带参数,带-help参数或者查看帮助页面。Zsh给了你另外一个选择。
36 |
37 | 输入选项的开始,然后点击。
38 |
39 | ls -
40 |
41 | 上述操作会列举出有内联说明的选项名称。你也可以选择使用键盘导航。
42 |
43 | 这不只限于ls命令。同样适用于大量像netstat,git和chmod这样的令人困惑的命令。
44 |
45 | ## 8. Git的改善
46 |
47 | 每个人都有自己最喜欢的git命令的别名。oh-my-zsh也有大量的别名。
48 |
49 | g=git
50 | gc=git commit -v
51 | ga=git add
52 | ...
53 |
54 | ## 9. 当进入git控制的目录时,它还能改善给你的提示。
55 |
56 | 比如:
57 |
58 | - 小的闪电符号是在提示当前目录下有未提交的更改。
59 |
60 | - 开头的绿色箭头。这表明上一条命令被正确执行。如果命令失败,那么在下一条指令被正确执行前该提示符会变成红色。
61 |
62 | ## 10. 文件名生成
63 |
64 | 在Bash中,我经常使用find命令和xargs一起进行查找,使用它们完成任务。Zsh内建的globbing支持涵盖了大部分的应用场景。
65 |
66 | 假设我们需要验收项目,只需要找出今天发生变更的文件。
67 |
68 | ls (*m0)
69 |
70 | 我们可以给ls命令的搜索部分添加限制参数来筛选出我们想要的。
71 |
72 |
73 | ## 11. 使用**递归的搜索。
74 |
75 | ls **/test
76 |
77 | 使用修饰符来递归查找超过20mb的文件。
78 |
79 | ls -lh **/*(Lm+20)
80 |
81 | ## 12. 有用的别名
82 |
83 | 和git的别名一样,oh-my-zsh也有很多有用的常用别名。
84 |
85 | ..=cd ..
86 | -=cd -
87 | ...=cd ../../
88 | ...
89 |
90 | ## 13. 命令执行历史
91 |
92 | mac os的history命令是fc -l 1的别名。如果想要查看命令执行的时间。可以使用
93 |
94 | fc -li 1
95 |
--------------------------------------------------------------------------------
/get.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | do_download(){
4 | fetch_dir=$1;
5 | if [ ! -d $fetch_dir ]; then
6 | echo "$fetch_dir is not vaild!"
7 | exit 1;
8 | fi
9 | cd $fetch_dir
10 | test_exists $fetch_dir
11 | set +e
12 | type "git" >/dev/null 2>/dev/null
13 | has_git=$?
14 | set -e
15 | if [ "$has_git" -eq 0 ];then
16 | echo "fetching source from github"
17 | do_fetch $fetch_dir;
18 | else
19 | echo "can't locate git ,using archive mode."
20 | do_download_archive $fetch_dir;
21 | fi
22 | echo "awesome-mac-things is downloaded to $fetch_dir/awesome-mac-things"
23 | }
24 |
25 | do_download_archive(){
26 | wget https://codeload.github.com/superhj1987/awesome-mac-things/zip/master -O awesome-mac-things.zip
27 | unzip awesome-mac-things.zip
28 | rm -rf awesome-mac-things.zip
29 | mv awesome-mac-things-master awesome-mac-things
30 | cd awesome-mac-things
31 | }
32 |
33 | do_fetch(){
34 | fetch_dir=$1;
35 | if [ ! -d $fetch_dir ]; then
36 | echo "$fetch_dir is not vaild!"
37 | exit 1;
38 | fi
39 | cd $fetch_dir ;
40 | test_exists awesome-mac-things;
41 | git clone https://github.com/superhj1987/awesome-mac-things.git awesome-mac-things --depth=1
42 | cd awesome-mac-things
43 | return 0
44 | }
45 |
46 | test_exists(){
47 | if [ -e awesome-mac-things ]; then
48 | echo "$1/awesome-mac-things already exist!"
49 | while(true);do
50 | echo -n "(q)uit or (r)eplace?"
51 | read choice < /dev/tty
52 | if [ "$choice" = "q" ];then
53 | exit 0;
54 | elif [ "$choice" = "r" ];then
55 | rm -fr $1/awesome-mac-things
56 | break;
57 | else
58 | echo "$choice is not valid!"
59 | fi
60 | done
61 | fi
62 | }
63 |
64 | do_install(){
65 | echo '***install need sudo,please enter password***'
66 | sudo make install
67 | echo 'awesome-mac-things was installed to /usr/local/bin,have fun.'
68 | }
69 |
70 | main(){
71 | echo "Launching awesome-mac-things installer..."
72 | do_download `pwd`
73 | do_install
74 | }
75 |
76 | main "$@"
--------------------------------------------------------------------------------
/bin/search_aj:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=UTF-8
3 | ## 搜索Java资源,https://github.com/superhj1987/awesome-tech-collections/blob/master/awesome-java.md
4 |
5 | import sys
6 | import getopt
7 | import urllib2
8 |
9 | reload(sys)
10 | sys.setdefaultencoding( "utf-8" )
11 |
12 | TIPS_TPL = "\n" + '=' * 8 + "%s" + '=' * 8 + "\n"
13 |
14 | def usage():
15 | print "usage: search_aj [catagory_name | project_name]"
16 |
17 | def progress_report(bytes_so_far, chunk_size, total_size):
18 | percent = float(bytes_so_far) / total_size
19 | percent = round(percent*100, 2)
20 | sys.stdout.write("searching.... (%0.2f%%)\r" %
21 | (percent))
22 | sys.stdout.flush()
23 |
24 | if bytes_so_far >= total_size:
25 | sys.stdout.write('\n')
26 |
27 | def main():
28 | opts,args = getopt.getopt(sys.argv[1:],'',[])
29 |
30 | argc = len(args)
31 | if argc < 1:
32 | usage()
33 | sys.exit(1)
34 |
35 | search_name = args[0]
36 |
37 | req = urllib2.Request("https://raw.githubusercontent.com/superhj1987/awesome-tech-collections/master/awesome-java.md")
38 | res = urllib2.urlopen(req)
39 |
40 | total_size = res.info().getheader('Content-Length').strip()
41 | total_size = int(total_size)
42 | chunk_size = 1024
43 | bytes_so_far = 0
44 | data = []
45 | while 1:
46 | chunk = res.read(chunk_size)
47 | bytes_so_far += len(chunk)
48 | if not chunk:
49 | break
50 |
51 | data += chunk
52 |
53 | progress_report(bytes_so_far, chunk_size, total_size)
54 | content = "".join(data)
55 |
56 | category = ""
57 | target_cat = None
58 | search_result = ""
59 | lines = content.split("\n")
60 | search_name = search_name.lower()
61 | for line in lines:
62 | if line.startswith("##") :
63 | target_cat = None
64 | category = line[line.index(" "):].strip().lower()
65 | if category.find(search_name) > 0:
66 | search_result += TIPS_TPL % ('finded in Categoty[' + category + ']')
67 | target_cat = category
68 | elif line.startswith("* ["):
69 | project = line[line.index("["):].strip().lower()
70 | if target_cat:
71 | search_result += project + "\n"
72 | elif project.find(search_name) > 0:
73 | search_result += TIPS_TPL % ('find matched projects in Category[' + category + ']') + project + "\n"
74 |
75 | print search_result
76 |
77 | if __name__ == "__main__":
78 | main()
--------------------------------------------------------------------------------
/tpl/gitignore.tpl:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | build
3 | target
4 | .idea
5 | .classpath
6 | .project
7 | *.iml
8 | out
9 | *.ipr
10 | # Created by https://www.gitignore.io/api/java,maven,intellij,git,scala
11 |
12 | ### Maven ###
13 | target/
14 | pom.xml.tag
15 | pom.xml.releaseBackup
16 | pom.xml.versionsBackup
17 | pom.xml.next
18 | release.properties
19 | dependency-reduced-pom.xml
20 | buildNumber.properties
21 | .mvn/timing.properties
22 |
23 |
24 | ### Intellij ###
25 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
26 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
27 |
28 | # User-specific stuff:
29 | .idea/workspace.xml
30 | .idea/tasks.xml
31 | .idea/dictionaries
32 | .idea/vcs.xml
33 | .idea/jsLibraryMappings.xml
34 |
35 | # Sensitive or high-churn files:
36 | .idea/dataSources.ids
37 | .idea/dataSources.xml
38 | .idea/dataSources.local.xml
39 | .idea/sqlDataSources.xml
40 | .idea/dynamic.xml
41 | .idea/uiDesigner.xml
42 |
43 | # Gradle:
44 | .idea/gradle.xml
45 | .idea/libraries
46 |
47 | # Mongo Explorer plugin:
48 | .idea/mongoSettings.xml
49 |
50 | ## File-based project format:
51 | *.iws
52 |
53 | ## Plugin-specific files:
54 |
55 | # IntelliJ
56 | /out/
57 |
58 | # mpeltonen/sbt-idea plugin
59 | .idea_modules/
60 |
61 | # JIRA plugin
62 | atlassian-ide-plugin.xml
63 |
64 | # Crashlytics plugin (for Android Studio and IntelliJ)
65 | com_crashlytics_export_strings.xml
66 | crashlytics.properties
67 | crashlytics-build.properties
68 | fabric.properties
69 |
70 | ### Intellij Patch ###
71 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
72 |
73 | # *.iml
74 | # modules.xml
75 | # .idea/misc.xml
76 | # *.ipr
77 |
78 |
79 | ### Git ###
80 | *.orig
81 |
82 |
83 | ### Scala ###
84 | *.class
85 | *.log
86 |
87 | # sbt specific
88 | .cache
89 | .history
90 | .lib/
91 | dist/*
92 | target/
93 | lib_managed/
94 | src_managed/
95 | project/boot/
96 | project/plugins/project/
97 |
98 | # Scala-IDE specific
99 | .scala_dependencies
100 | .worksheet
101 |
102 | # ENSIME specific
103 | .ensime_cache/
104 | .ensime
105 |
106 |
107 | ### Java ###
108 | *.class
109 |
110 | # Mobile Tools for Java (J2ME)
111 | .mtj.tmp/
112 |
113 | # Package Files #
114 | *.jar
115 | *.war
116 | *.ear
117 |
118 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
119 | hs_err_pid*
120 |
--------------------------------------------------------------------------------
/bin/generate_md_contents:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=UTF-8
3 | ## generate contents for a markdown
4 |
5 | '''
6 | 根据标题(# ## ### ####...)生成mardown文档的目录, 支持无限层级标题
7 |
8 | **#,##,##与标题之间必须留有空格**
9 |
10 | 自动生成subTitle的目录附加到title的下一行
11 | '''
12 |
13 | import sys
14 | import shutil
15 | import os
16 | import getopt
17 |
18 | reload(sys)
19 | sys.setdefaultencoding( "utf-8" )
20 |
21 | contents_template = '* [%s](#%s)\n'
22 | tag_anchor_template = " %s\n"
23 | contents_title = u'## 目录\n'
24 |
25 | def usage():
26 | print "usage: generate_md_contents [-a] doc_name [to_doc_name]"
27 |
28 | def main():
29 | opts,args = getopt.getopt(sys.argv[1:],'ah',[])
30 |
31 | anchorFlag = False
32 | for option, value in opts:
33 | if option == "-a":
34 | anchorFlag = True
35 | elif option == "-h":
36 | usage()
37 | sys.exit(0)
38 |
39 | argc = len(args)
40 | if argc < 1:
41 | usage()
42 | sys.exit(1)
43 |
44 | fname = args[0]
45 | targetFname = args[1] if argc >= 2 else fname
46 |
47 | print '-'*10 + 'start process %s' % fname + '-'*10
48 |
49 | new_lines = []
50 |
51 | contents = []
52 |
53 | i = 0
54 | with open(fname) as f:
55 | lines = f.readlines()
56 | for line in lines:
57 | if i == 0 and line.startswith('#'):
58 | contents.append(line) #添加一级title
59 | contents += ['\n',contents_title,'\n'] #添加目录title
60 | elif line.startswith(contents_title):
61 | print 'oh, the file already have contents...'
62 |
63 | if fname != targetFname:
64 | shutil.copyfile(fname,targetFname)
65 |
66 | sys.exit(0)
67 | else:
68 | if line.startswith('##'): #标题
69 | titleLevel = line.index(' ');
70 | tag = line[(titleLevel+1) : -1] #去除结尾换行符
71 | anchor = tag if anchorFlag else tag.lower()
72 | contents.append(' ' * (titleLevel - 2) + contents_template % (tag,anchor))
73 |
74 | line = '#' * titleLevel + tag_anchor_template % (tag,anchor) if anchorFlag else line #生成tag描点
75 | new_lines.append(line)
76 | i = i + 1
77 |
78 | new_lines = contents + new_lines
79 |
80 | bak_file = None
81 |
82 | if targetFname == fname: #覆盖原文件需要先备份
83 | # 备份原文件
84 | bak_file = fname + '.bak'
85 | shutil.copyfile(fname,bak_file)
86 |
87 | try:
88 | with open(targetFname, "w") as f:
89 | f.writelines(new_lines)
90 | except IOError as err:
91 | print("update file error:" + str(err)) #str()将对象转换为字符串
92 |
93 | if bak_file != None and os.path.exists(bak_file):
94 | shutil.copyfile(bak_file,fname)
95 |
96 | if bak_file != None and os.path.exists(bak_file):
97 | os.remove(bak_file)
98 |
99 | print '-'*10 + 'end generate contents of %s to %s' % (fname,targetFname) + '-'*10
100 |
101 | if __name__ == "__main__":
102 | main()
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | awesome-mac-things [](https://www.apache.org/licenses/LICENSE-2.0.html)
2 | ----
3 | [](https://github.com/superhj1987/awesome-mac-things/stargazers)
4 | [](https://github.com/superhj1987/awesome-mac-things/fork)
5 |
6 | some useful things in MAC OS.
7 |
8 | - scripts
9 | - shells
10 | - tips of some common useful apps
11 |
12 | ## Requirement
13 |
14 | - Linux
15 | - Mac
16 | - git1.7+
17 |
18 | ## Install
19 |
20 | Three methods:
21 |
22 | - `curl -s "https://raw.githubusercontent.com/superhj1987/awesome-mac-things/master/get.sh" | bash -s`
23 | - Download the source and `make install`
24 | - Download the source and set `bin` to the System Path to use the common usage shells
25 |
26 | ## Uninstall
27 |
28 | mthings uninstall
29 |
30 | ## Usage
31 |
32 | * `mthings`
33 | > show system command
34 |
35 | * `mtings list`
36 | > show command list
37 |
38 | * `mthings update`
39 | > update mthings
40 |
41 | * `mthings show_doc [doc_name]`
42 | > show the contents of the specified doc
43 |
44 | ## Docs and Commands
45 |
46 | ### :watch: Document
47 |
48 | * `useful_shells`
49 | > some mac useful shells
50 |
51 | * `shortcut_keys_intro`
52 | > introduce mac shortcut keys
53 |
54 | * `st_shortcut_keys`
55 | > SublimeText2 shortcut keys
56 |
57 | * `zsh_tips`
58 | > zsh useful tips
59 |
60 | * `ssh_timeout_solution`
61 | > solution of ssh timeout
62 |
63 | * `ssh_keys_save`
64 | > solution of save password of the ssh keys to avoid input password
65 |
66 | ### :coffee: bin
67 |
68 | * `show_memory_usage`
69 | > show memory usage in python`
70 |
71 | * `git_init`
72 | > init git repository
73 | >
74 | > **Usage**: `git_init [git_repos_url] [to_dir]`
75 | >
76 | > **Option**:
77 | >
78 | > - when ***git_repos_url*** is empty,init .gitignore, otherwise clone the repository to [to_dir],and int .gitignore
79 | > - when ***to_dir*** is empty, the to_dir is the end of the git_repos_url,for example **mac_useful_thins.git**
80 | >
81 | > **Example**:
82 | >
83 | > `git_init git@github.com:superhj1987/mac_useful_things.git mac_useful_things`
84 |
85 | * `rm_ds`
86 | > delete .DS_Store in current dir
87 |
88 | * `show_net_stats`
89 | > show the count of each status connection,including time_wait、close_wait and so on.
90 |
91 | - `generate_md_contents`
92 | > generate the contents of a markdown doc.The doc's format meets:the first line is the title:# [title],the other title such as ##,###,####... is the contents and there must be a blank between #,##,###... and title text. The example docs are in the **test** dir.
93 | >
94 | > **Usage**: `generate_md_contents [-a] doc_name [to_doc_name]`
95 | >
96 | > **Option**:
97 | >
98 | > - ***-a*** means generate the contents with append the anchor to the sub title.
99 | > - when ***to__doc_name*** is empty,the generate content will overwrite the ***doc_name*** file, otherwise the content will be in the ***to__doc_name*** file.
100 | >
101 | > **Example**:
102 | >
103 | > `generate_md_contents ../test/test_doc.md test__doc_with_contents.md`
104 |
105 | * `change_git_origin_remote`
106 | > change current origin remote repos to a new url
107 | >
108 | > **Usage**: `change_git_origin_remote [new_git_repos_url]`
109 |
110 | * `word_count`
111 | > get the word total count in a doc
112 | >
113 | > **Usage**: `word_count [doc_name]`
114 | >
115 |
116 | * `search_aj`
117 | > search java resources from
118 | >
119 | > **Usage**: `search_aj [project_name | category_name]`
120 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 |
3 | Apache License
4 | Version 2.0, January 2004
5 | http://www.apache.org/licenses/
6 |
7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 |
9 | 1. Definitions.
10 |
11 | "License" shall mean the terms and conditions for use, reproduction,
12 | and distribution as defined by Sections 1 through 9 of this document.
13 |
14 | "Licensor" shall mean the copyright owner or entity authorized by
15 | the copyright owner that is granting the License.
16 |
17 | "Legal Entity" shall mean the union of the acting entity and all
18 | other entities that control, are controlled by, or are under common
19 | control with that entity. For the purposes of this definition,
20 | "control" means (i) the power, direct or indirect, to cause the
21 | direction or management of such entity, whether by contract or
22 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | outstanding shares, or (iii) beneficial ownership of such entity.
24 |
25 | "You" (or "Your") shall mean an individual or Legal Entity
26 | exercising permissions granted by this License.
27 |
28 | "Source" form shall mean the preferred form for making modifications,
29 | including but not limited to software source code, documentation
30 | source, and configuration files.
31 |
32 | "Object" form shall mean any form resulting from mechanical
33 | transformation or translation of a Source form, including but
34 | not limited to compiled object code, generated documentation,
35 | and conversions to other media types.
36 |
37 | "Work" shall mean the work of authorship, whether in Source or
38 | Object form, made available under the License, as indicated by a
39 | copyright notice that is included in or attached to the work
40 | (an example is provided in the Appendix below).
41 |
42 | "Derivative Works" shall mean any work, whether in Source or Object
43 | form, that is based on (or derived from) the Work and for which the
44 | editorial revisions, annotations, elaborations, or other modifications
45 | represent, as a whole, an original work of authorship. For the purposes
46 | of this License, Derivative Works shall not include works that remain
47 | separable from, or merely link (or bind by name) to the interfaces of,
48 | the Work and Derivative Works thereof.
49 |
50 | "Contribution" shall mean any work of authorship, including
51 | the original version of the Work and any modifications or additions
52 | to that Work or Derivative Works thereof, that is intentionally
53 | submitted to Licensor for inclusion in the Work by the copyright owner
54 | or by an individual or Legal Entity authorized to submit on behalf of
55 | the copyright owner. For the purposes of this definition, "submitted"
56 | means any form of electronic, verbal, or written communication sent
57 | to the Licensor or its representatives, including but not limited to
58 | communication on electronic mailing lists, source code control systems,
59 | and issue tracking systems that are managed by, or on behalf of, the
60 | Licensor for the purpose of discussing and improving the Work, but
61 | excluding communication that is conspicuously marked or otherwise
62 | designated in writing by the copyright owner as "Not a Contribution."
63 |
64 | "Contributor" shall mean Licensor and any individual or Legal Entity
65 | on behalf of whom a Contribution has been received by Licensor and
66 | subsequently incorporated within the Work.
67 |
68 | 2. Grant of Copyright License. Subject to the terms and conditions of
69 | this License, each Contributor hereby grants to You a perpetual,
70 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | copyright license to reproduce, prepare Derivative Works of,
72 | publicly display, publicly perform, sublicense, and distribute the
73 | Work and such Derivative Works in Source or Object form.
74 |
75 | 3. Grant of Patent License. Subject to the terms and conditions of
76 | this License, each Contributor hereby grants to You a perpetual,
77 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | (except as stated in this section) patent license to make, have made,
79 | use, offer to sell, sell, import, and otherwise transfer the Work,
80 | where such license applies only to those patent claims licensable
81 | by such Contributor that are necessarily infringed by their
82 | Contribution(s) alone or by combination of their Contribution(s)
83 | with the Work to which such Contribution(s) was submitted. If You
84 | institute patent litigation against any entity (including a
85 | cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | or a Contribution incorporated within the Work constitutes direct
87 | or contributory patent infringement, then any patent licenses
88 | granted to You under this License for that Work shall terminate
89 | as of the date such litigation is filed.
90 |
91 | 4. Redistribution. You may reproduce and distribute copies of the
92 | Work or Derivative Works thereof in any medium, with or without
93 | modifications, and in Source or Object form, provided that You
94 | meet the following conditions:
95 |
96 | (a) You must give any other recipients of the Work or
97 | Derivative Works a copy of this License; and
98 |
99 | (b) You must cause any modified files to carry prominent notices
100 | stating that You changed the files; and
101 |
102 | (c) You must retain, in the Source form of any Derivative Works
103 | that You distribute, all copyright, patent, trademark, and
104 | attribution notices from the Source form of the Work,
105 | excluding those notices that do not pertain to any part of
106 | the Derivative Works; and
107 |
108 | (d) If the Work includes a "NOTICE" text file as part of its
109 | distribution, then any Derivative Works that You distribute must
110 | include a readable copy of the attribution notices contained
111 | within such NOTICE file, excluding those notices that do not
112 | pertain to any part of the Derivative Works, in at least one
113 | of the following places: within a NOTICE text file distributed
114 | as part of the Derivative Works; within the Source form or
115 | documentation, if provided along with the Derivative Works; or,
116 | within a display generated by the Derivative Works, if and
117 | wherever such third-party notices normally appear. The contents
118 | of the NOTICE file are for informational purposes only and
119 | do not modify the License. You may add Your own attribution
120 | notices within Derivative Works that You distribute, alongside
121 | or as an addendum to the NOTICE text from the Work, provided
122 | that such additional attribution notices cannot be construed
123 | as modifying the License.
124 |
125 | You may add Your own copyright statement to Your modifications and
126 | may provide additional or different license terms and conditions
127 | for use, reproduction, or distribution of Your modifications, or
128 | for any such Derivative Works as a whole, provided Your use,
129 | reproduction, and distribution of the Work otherwise complies with
130 | the conditions stated in this License.
131 |
132 | 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | any Contribution intentionally submitted for inclusion in the Work
134 | by You to the Licensor shall be under the terms and conditions of
135 | this License, without any additional terms or conditions.
136 | Notwithstanding the above, nothing herein shall supersede or modify
137 | the terms of any separate license agreement you may have executed
138 | with Licensor regarding such Contributions.
139 |
140 | 6. Trademarks. This License does not grant permission to use the trade
141 | names, trademarks, service marks, or product names of the Licensor,
142 | except as required for reasonable and customary use in describing the
143 | origin of the Work and reproducing the content of the NOTICE file.
144 |
145 | 7. Disclaimer of Warranty. Unless required by applicable law or
146 | agreed to in writing, Licensor provides the Work (and each
147 | Contributor provides its Contributions) on an "AS IS" BASIS,
148 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | implied, including, without limitation, any warranties or conditions
150 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | PARTICULAR PURPOSE. You are solely responsible for determining the
152 | appropriateness of using or redistributing the Work and assume any
153 | risks associated with Your exercise of permissions under this License.
154 |
155 | 8. Limitation of Liability. In no event and under no legal theory,
156 | whether in tort (including negligence), contract, or otherwise,
157 | unless required by applicable law (such as deliberate and grossly
158 | negligent acts) or agreed to in writing, shall any Contributor be
159 | liable to You for damages, including any direct, indirect, special,
160 | incidental, or consequential damages of any character arising as a
161 | result of this License or out of the use or inability to use the
162 | Work (including but not limited to damages for loss of goodwill,
163 | work stoppage, computer failure or malfunction, or any and all
164 | other commercial damages or losses), even if such Contributor
165 | has been advised of the possibility of such damages.
166 |
167 | 9. Accepting Warranty or Additional Liability. While redistributing
168 | the Work or Derivative Works thereof, You may choose to offer,
169 | and charge a fee for, acceptance of support, warranty, indemnity,
170 | or other liability obligations and/or rights consistent with this
171 | License. However, in accepting such obligations, You may act only
172 | on Your own behalf and on Your sole responsibility, not on behalf
173 | of any other Contributor, and only if You agree to indemnify,
174 | defend, and hold each Contributor harmless for any liability
175 | incurred by, or claims asserted against, such Contributor by reason
176 | of your accepting any such warranty or additional liability.
177 |
178 | END OF TERMS AND CONDITIONS
179 |
180 | APPENDIX: How to apply the Apache License to your work.
181 |
182 | To apply the Apache License to your work, attach the following
183 | boilerplate notice, with the fields enclosed by brackets "[]"
184 | replaced with your own identifying information. (Don't include
185 | the brackets!) The text should be enclosed in the appropriate
186 | comment syntax for the file format. We also recommend that a
187 | file or class name and description of purpose be included on the
188 | same "printed page" as the copyright notice for easier
189 | identification within third-party archives.
190 |
191 | Copyright [yyyy] [name of copyright owner]
192 |
193 | Licensed under the Apache License, Version 2.0 (the "License");
194 | you may not use this file except in compliance with the License.
195 | You may obtain a copy of the License at
196 |
197 | http://www.apache.org/licenses/LICENSE-2.0
198 |
199 | Unless required by applicable law or agreed to in writing, software
200 | distributed under the License is distributed on an "AS IS" BASIS,
201 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | See the License for the specific language governing permissions and
203 | limitations under the License.
--------------------------------------------------------------------------------