├── .gitignore ├── LICENSE ├── README.md ├── README.zh-CN.md ├── bin └── simpletool ├── files ├── .gitconfig ├── .gitignore ├── .vimrc ├── .zshrc ├── chap-secrets ├── nginx.phpmyadmin.default ├── pptpd-options ├── pptpd.conf ├── rc.local ├── supervisor.startup ├── supervisord.conf ├── sysctl.conf └── vsftpd.conf ├── lib ├── simpletool.rb └── support │ ├── ftp │ └── vsftpd.conf │ ├── phpmyadmin │ └── nginx.phpmyadmin.default │ ├── pptp_vpn │ └── ubuntu │ │ ├── pptpd-options │ │ ├── pptpd.conf │ │ ├── rc.local │ │ └── sysctl.conf │ └── zsh │ └── .zshrc ├── quick-install ├── mac │ └── upload-sshkey.sh └── ubuntu │ ├── install-ftp.sh │ ├── install-gem.sh │ ├── install-phpmyadmin.sh │ ├── install-pip-1.3.sh │ ├── install-pptp.sh │ ├── install-quick-dev.sh │ ├── install-scrapy.sh │ ├── install-shadowsock-server.sh │ ├── install-simpleserver.sh │ ├── install-vagrant.sh │ ├── install-zsh.sh │ └── quick-logrotate.sh ├── rules └── 后台开发经验.md ├── simpletool.gemspec └── textexpander ├── add_sudo_user.textexpander ├── ftime.textexpander ├── ip.textexpander ├── jsonp.textexpander ├── nginx.textexpander ├── supervisord.textexpander ├── time.textexpander └── zsh.textexpander /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.gem 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 seaify 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [simpletool 中文版](README.zh-CN.md) 2 | 3 | # simpletool 4 | 5 | simpletool provide pptp vpn, ftp, phpmyadmin, oh-my-zsh quick install without config, only one command. 6 | 7 | Install 8 | -------- 9 | 10 | ```shell 11 | gem install simpletool 12 | ``` 13 | or add the following line to Gemfile: 14 | 15 | ```ruby 16 | gem 'simpletool' 17 | ``` 18 | and run `bundle install` from your shell. 19 | 20 | Usage 21 | -------- 22 | ```ruby 23 | chuck@chuck-MacBook-Pro:~/seaify/ % simpletool 24 | Commands: 25 | simpletool help [COMMAND] # Describe available commands or one specific command 26 | simpletool install_ftp username passwd # install ftp on ubuntu, need provide username & passwd 27 | simpletool install_phpmyadmin # quick install phpmyadmin on ubuntu 28 | simpletool install_pptp_vpn username passwd # quick install pptp vpn on ubuntu, need provide username & password, remember to reboot machine to check!!! 29 | simpletool install_zsh # quick install oh-my-zsh with plugins configed on ubuntu 30 | ``` 31 | 32 | Environment version 33 | ----------------------- 34 | 35 | ruby 2.1.5 36 | ubuntu 14.04 37 | 38 | More Information 39 | ---------------- 40 | 41 | * [Rubygems](https://rubygems.org/gems/simpletool) 42 | * [Issues](https://github.com/seaify//issues) -------------------------------------------------------------------------------- /README.zh-CN.md: -------------------------------------------------------------------------------- 1 | ## 简介 2 | 后台服务开发过程中,总是需要做一些重复的事情,如安装zsh, ftp等,所以将使用过的服务做成了一键安装脚本,避免重复,程序员已经够苦了,不应该再在这种屁事上浪费生命。 3 | 4 | 开发过程中常用的工具,如一键安装vpn, ftp, phpmyadmin shadowsocks, zsh, 以及配置文件如vimrc, zshrc等, 注意以下安装脚本仅在ubuntu 14.04下经过测试。 5 | 6 | ## 经验文章 7 | ### [后台开发原则篇](rules/后台开发经验.md) 8 | 9 | ## [git alias命令篇](files/.gitconfig) 10 | git很好用,不过在git的基础命令之上,可以构建一些更复杂的命令,简化git的操作流程,作为日常用的最多的工具,减少重复,便能节约不少时间 11 | ### backup 12 | 当你需要对当前分支进行一些危险的操作,担心误操作,或是为了留下一些重要的版本分支,进行测试时,使用git backup将当前的分支进行备份,比如当前是dev分支,执行该命令会生成dev.bak分支(dev的备份), 且当前分支会维持住在dev分支,而不是切换到dev.bak 13 | ```sh 14 | backup = "!f(){ current=`git rev-parse --abbrev-ref HEAD`; git checkout -b "$current.bak"; git checkout $current; }; f" 15 | ``` 16 | 17 | ### tar 18 | 因一些原因,需要将当前branch下的文件都打包成一个压缩文件 19 | ```sh 20 | tar = "!f(){ current=`git rev-parse --abbrev-ref HEAD`; tar -czvf "$current.tar.gz" `git ls-files`; }; f" 21 | ``` 22 | 23 | ### pushtoserver 24 | 将当期分支推送到remote上,且推送前rebase某个分支, 下面实例里是每次推送前,先rebase develop分支 25 | ```sh 26 | update = !git fetch origin && git rebase origin/develop 27 | pushtoserver = "!f(){ current=`git rev-parse --abbrev-ref HEAD`; git update; git push origin "HEAD:$current"; }; f" 28 | ``` 29 | 30 | ### listfiles 31 | git listfiles a145de2854ba5eff2d8aa2a22f2510a7565c2776 会列出这个commit中修改,增加,删除的文件 32 | ```sh 33 | listfiles = show --pretty="format:" --name-only 34 | ``` 35 | 36 | 37 | ## Mac app推荐篇 38 | - [1password](https://agilebits.com/onepassword), 装上相应chrome插件后,登陆网站再也不需要记得各种密码了,只需要记得1password的主密码,大爱。 39 | - [textexpander](https://smilesoftware.com/TextExpander/index.html), 每天都在用的神器, 大量减少重复的输入,最简单例子比如输入;addr,就能出现你家的完整地址, 当然高端功能还有不少。 40 | - [iterm2](http://iterm2.com/), 可以方便的定制profile,windows,支持trigger,能轻松的创建个windows,指定目录打开mysql和redis,或运行其它程序。 41 | - [hazel](http://www.noodlesoft.com/hazel.php), 对文件夹中的文件进行定制操作,若下载.zip文件会,自动压缩,移动到applications目录,如tutsplus网站下载的视频,自动移动到自己制定的文件夹,并自动打开,支持applescript。文件夹再也不混乱了。 42 | - [alfred](http://www.alfredapp.com/), 网络上大量的alfred workflow,你能很方便的定制自己想要的workflow,mac上最惊艳的app。 43 | - [screenflow](http://www.telestream.net/screenflow/overview.htm), 录制视频,给你组内其它程序员讲讲课哈。 44 | - [dropself](https://pilotmoon.com/dropshelf/), 很方便的拖曳管理复制粘贴 45 | - [slack](https://slack.com/), 很好的企业协同办公工具,我每天都往slackbot上发消息,记录一些临时想法。 46 | - [things](https://culturedcode.com/things/), gtd工具,管理你的工作效率 47 | - [fantastical 2](http://flexibits.com/Fantastical), 很好的日历软件,界面很漂亮,功能很简洁 48 | - [airmail](http://airmailapp.com/), 邮件真的需要个本地客户端,它支持markdown,支持定制规则 49 | - [haroopad](http://pad.haroopress.com/), 我最喜欢的markdown编辑器, 支持vi 模式,实时预览 50 | - [bartender](http://www.macbartender.com/), app装的多了,都显示在右上侧,就太挤了,它就是管理任务栏的 51 | - [vagrant manager](http://vagrantmanager.com/), 不少软件还是要用windows的,所以要虚拟机,这个软件便是管理vagrant虚拟机的 52 | - [teamviewer](https://www.teamviewer.com/en/index.aspx), 自由职业的,远程控制,访问 53 | - [moom](http://manytricks.com/moom/), 很方便的管理窗口,最大化,最小化,移到其它桌面,指定到桌面的位置 54 | - [clearmymac3](http://cleanmymac.com/), 有一天,你发现电脑硬盘空间不够了,或者想方便删软件,就是它了 55 | 56 | 另外附一个淘宝店,http://macsofts.taobao.com/, 我的大部分软件是在这买的,不是盗版,是那种家庭版,或者id共享版,也有个人版, 比appstore要便宜一些。 57 | 当然最稳妥的就是直接去appstore里买,或者官网里买。但真的,最好别去盗版,或者盗版了,有点钱后,还是买下正版的吧。 58 | 59 | ## 一键安装脚本 60 | 61 | ### 安装pptp vpn服务 62 | 参考文档https://help.ubuntu.com/community/PPTPServer 63 | 执行下述命令,将创建一个pptp账户,用户名为user,密码为passwd。 64 | 注意: 执行完后,需要重启机器生效。另外如果你连接不上vpn,可能是你家路由器没有vpn穿透功能,或者路由器未开启vpn穿透配置,我家的就是这样,只能手机3g使用vpn。 65 | ```sh 66 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-pptp.sh | sh -s -- user passwd 67 | ``` 68 | 69 | ### 安装phpmyadmin服务 70 | 执行下述命令,将安装对应的nginx, phpmyadmin, 并做好相应配置, mysql-server需要自己安装 71 | ```sh 72 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-phpmyadmin.sh | sh 73 | ``` 74 | ### 安装vsftpd服务 75 | 执行下述命令,将创建一个ftp账户,用户名为chuck,密码为love 76 | ```sh 77 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-ftp.sh | sh -s chuck love 78 | ``` 79 | 80 | ### 安装shadowsocks server和client 81 | 参考文档: https://github.com/shadowsocks/shadowsocks/wiki, 和https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-File 82 | 执行下述命令,将创建一个shaowsocks server密码为love。使用supervisord管理shadowsocks服务,为supervisord增加了开机启动脚本,所以每次重启, shadowsocks服务也会跟着启动。 83 | ```sh 84 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-shadowsock-server.sh | sh -s -- love 85 | ``` 86 | 87 | shadowsocks client参考https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients,就可以了,mac, ubuntu, windows, iphone, android经测试都可以正常使用,但iphone要越狱 88 | 89 | 90 | ### 安装zsh, 已经配置好相应插件 91 | 使用zle-vi-visual vi-mode git-prompt autojump history history-substring-search jump sudo 这些插件。 92 | 视频讲解: http://v.youku.com/v_show/id_XODkyNTc0NDIw.html 93 | 执行完下述命令,就安装好了zsh以及其插件,配置文件查看.zshrc, 输入zsh开始体验吧。 94 | ``` 95 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-zsh.sh | sh 96 | ``` 97 | 98 | 99 | ### 一键将当前目录下的文件加入logrotate, 每日自动化进行压缩, 默认保留7天备份 100 | nginx, redis, mysql等许多系统服务在安装时,都会安装一份logrotate的配置文件,用来管理日志. 下面的这个脚本,就是用来运维值班人员,发现某台机器上磁盘空间不足,并找到了目录后,方便一键使用logrotate管理该目录的文件压缩,而不是简单的删除文件,下次又报警。 101 | 下列脚本在日志目录如/var/logs/tomcat或类似的任意目录下,执行后,会对匹配到.log的文件,使用日志压缩,规则是保留7天的备份,gz压缩, 如1.log, 会生成1.log-20150422.gz这样的备份文件, 而生成的配置文件则为/etc/logrotate.d/mylog。 102 | ```sh 103 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/quick-logrotate.sh | sudo sh -s .log mylog 104 | ``` 105 | 106 | ### 安装simplehttpserver 107 | 在当前目录下,执行下列命令,将该目录自动对外开放, 可用来托管图片,书籍等, 下面的脚本实际配置了相应的nginx,以及supervisor使用python -m SimpleHTTPServer。 108 | sh -s -- 后的第一个参数为域名地址,第二个为程序端口,默认8080,可选参数。 109 | ``` 110 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-simpleserver.sh | sh -s -- static.seaify.com [port] 111 | ``` 112 | 113 | 114 | ## textexpander有用的snippets分享 115 | ### [ftime.textexpander](textexpander/ftime.textexpander) 116 | 用法: 复制一个10位的数字后,输入指定的abbreviation后,将该数字转化为2015-03-01 00:00:00格式的字符串。 117 | 如复制1428846374后,输入;ftime, 替换为2015-04-12 21:46:14。 118 | 119 | ### [time.textexpander](textexpander/time.textexpander) 120 | 用法: 输入指定的abbreviation后,输出当前的时间戳(10位字符) 121 | 如输入;time, 替换为1428846535。 122 | 123 | ### [jsonp.textexpander](textexpander/jsonp.textexpander) 124 | 用法: 复制jsonp的目标url,输入指定的abbreviation后,自动输出下列jsonp api的请求代码,且光标定位在console.log这句的下一行。 125 | ```javascript 126 | jquery.ajax({ 127 | url: "https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins", 128 | dataType: "jsonp", 129 | success: function(data){ 130 | console.log(data); 131 | 132 | }}); 133 | ``` 134 | 135 | ### [nginx.textexpander](textexpander/nginx.textexpander) 136 | 用法: 输入指定的abbreviation后, 在弹出的输入框中填入好域名test和端口5000(菜单已指定,不用输入默认即可),即可配置好一个简单的nginx配置文件。 137 | ```ngnix 138 | server { 139 | listen 80; 140 | 141 | server_name test.seaify.com; 142 | access_log /var/log/nginx/test_access.log; 143 | error_log /var/log/nginx/test_error.log; 144 | 145 | 146 | location / { 147 | proxy_pass http://127.0.0.1:5000; 148 | proxy_set_header Host $host; 149 | proxy_set_header X-Real-IP $remote_addr; 150 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 151 | } 152 | } 153 | ``` 154 | 155 | 156 | ### [add_sudo_user.textexpander](textexpander/add_sudo_user.textexpander) 157 | 用法: 输入指定的abbreviation后, 在弹出的输入框中填入用户名和密码,即可创建一个有sudo权限的新账户。 158 | 159 | 160 | ### [ip.textexpander](textexpander/ip.textexpander) 161 | 用法: 输入指定的abbreviation后, 替换为系统的外网ip(有时候填配置文件,需要外网ip,这时候我们去百度搜ip,或者终端下敲curl ifconfig.me都太慢了,还得重新回编辑器) 162 | 163 | 164 | ## Bugs and Feature Requests 165 | 有bug或者feature的requests,欢迎提交! 166 | 167 | ## 后续 168 | - 会添加textexpander中有用的sinppet,以及alfred workflow, automator。 169 | - 关注能提高开发效率的工具。 170 | -------------------------------------------------------------------------------- /bin/simpletool: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'simpletool' 4 | 5 | SimpleTool.start ARGV 6 | -------------------------------------------------------------------------------- /files/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = chuck.lei 3 | email = dilin.life@gmail.com 4 | [core] 5 | editor = vim 6 | [merge] 7 | tool = vimdiff 8 | [color] 9 | ui = true 10 | [alias] 11 | lastpatch = format-patch HEAD^ 12 | undolastcommit = reset --hard HEAD~1 13 | backup = "!f(){ current=`git rev-parse --abbrev-ref HEAD`; git checkout -b "$current.bak"; git checkout $current; }; f" 14 | listfiles = show --pretty="format:" --name-only 15 | update = !git fetch origin && git rebase origin/develop 16 | pushtoserver = "!f(){ current=`git rev-parse --abbrev-ref HEAD`; git update; git push origin "HEAD:$current"; }; f" 17 | tar = "!f(){ current=`git rev-parse --abbrev-ref HEAD`; tar -czvf "$current.tar.gz" `git ls-files`; }; f" 18 | deleteremote = "!f(){ git push origin --delete $1; }; f" 19 | #git diff mybranch master -- myfile.cs 20 | #git merge-base A B 21 | #git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] 22 | 23 | [receive] 24 | denyCurrentBranch = refuse 25 | [difftool "sourcetree"] 26 | cmd = opendiff \"$LOCAL\" \"$REMOTE\" 27 | path = 28 | [mergetool "sourcetree"] 29 | cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" 30 | trustExitCode = true 31 | [filter "media"] 32 | required = true 33 | clean = git media clean %f 34 | smudge = git media smudge %f 35 | [filter "hawser"] 36 | clean = git hawser clean %f 37 | smudge = git hawser smudge %f 38 | required = true 39 | -------------------------------------------------------------------------------- /files/.gitignore: -------------------------------------------------------------------------------- 1 | .swp 2 | .pyc 3 | -------------------------------------------------------------------------------- /files/.vimrc: -------------------------------------------------------------------------------- 1 | set encoding=utf-8 2 | set fileencodings=utf-8,cp950 3 | set nocompatible 4 | set number 5 | set ruler 6 | set backspace=2 7 | set ic 8 | set ru 9 | set hlsearch 10 | set incsearch 11 | set smartindent 12 | set confirm 13 | set history=100 14 | set cursorline 15 | set tabstop=8 16 | set expandtab 17 | set shiftwidth=4 18 | set softtabstop=4 19 | set background=dark 20 | let Tlist_Ctags_Cmd="/usr/local/bin/ctags" 21 | set laststatus=2 22 | -------------------------------------------------------------------------------- /files/.zshrc: -------------------------------------------------------------------------------- 1 | # Path to your oh-my-zsh installation. 2 | export ZSH=$HOME/.oh-my-zsh 3 | 4 | # Set name of the theme to load. 5 | # Look in ~/.oh-my-zsh/themes/ 6 | # Optionally, if you set this to "random", it'll load a random theme each 7 | # time that oh-my-zsh is loaded. 8 | ZSH_THEME="robbyrussell" 9 | 10 | 11 | # Uncomment the following line to use case-sensitive completion. 12 | # CASE_SENSITIVE="true" 13 | 14 | # Uncomment the following line to disable bi-weekly auto-update checks. 15 | # DISABLE_AUTO_UPDATE="true" 16 | 17 | # Uncomment the following line to change how often to auto-update (in days). 18 | # export UPDATE_ZSH_DAYS=13 19 | 20 | # Uncomment the following line to disable colors in ls. 21 | # DISABLE_LS_COLORS="true" 22 | 23 | # Uncomment the following line to disable auto-setting terminal title. 24 | # DISABLE_AUTO_TITLE="true" 25 | 26 | # Uncomment the following line to enable command auto-correction. 27 | # ENABLE_CORRECTION="true" 28 | 29 | # Uncomment the following line to display red dots whilst waiting for completion. 30 | # COMPLETION_WAITING_DOTS="true" 31 | 32 | # Uncomment the following line if you want to disable marking untracked files 33 | # under VCS as dirty. This makes repository status check for large repositories 34 | # much, much faster. 35 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 36 | 37 | # Uncomment the following line if you want to change the command execution time 38 | # stamp shown in the history command output. 39 | # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 40 | # HIST_STAMPS="mm/dd/yyyy" 41 | 42 | # Would you like to use another custom folder than $ZSH/custom? 43 | # ZSH_CUSTOM=/path/to/new-custom-folder 44 | 45 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 46 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 47 | # Example format: plugins=(rails git textmate ruby lighthouse) 48 | # Add wisely, as too many plugins slow down shell startup. 49 | plugins=(zle-vi-visual vi-mode git-prompt autojump history history-substring-search jump sudo) 50 | #plugins=(zle-vi-visual vi-mode git-prompt django pip z autojump autopep8 copyfile history history-substring-search jump tmuxinator web-search sudo) 51 | #plugins=(git-prompt django pip z autojump autopep8 copyfile history-substring-search jump tmuxinator web-search sudo) 52 | 53 | 54 | source $ZSH/oh-my-zsh.sh 55 | 56 | 57 | [[ -s ~/.autojump/etc/profile.d/autojump.zsh ]] && . ~/.autojump/etc/profile.d/autojump.zsh 58 | 59 | source ~/opensource/zsh-git-prompt/zshrc.sh 60 | source ~/opensource/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 61 | source ~/opensource/zsh-history-substring-search/zsh-history-substring-search.zsh 62 | 63 | bindkey -M vicmd 'k' history-substring-search-up 64 | bindkey -M vicmd 'j' history-substring-search-down 65 | 66 | #zmodload zsh/terminfo 67 | #bindkey "$terminfo[kcuu1]" history-substring-search-up 68 | #bindkey "$terminfo[kcud1]" history-substring-search-down 69 | # an example prompt 70 | PROMPT='$fg[red]%}%n@%m%{$fg[green]%}:%B%~%b$(git_super_status) %# ' 71 | 72 | # User configuration 73 | export PATH=~/Dropbox/BackUp/bin:~/opensource/mongodb/bin:$PATH 74 | export PYTHONPATH=~/togic:~/togic/warehouse:$PYTHONPATH 75 | 76 | export PATH=~/opensource/phpfarm/inst/current-bin:~/opensource/phpfarm/inst/bin:~/.dropbox-dist:$HOME/bin:/usr/local/bin:$PATH 77 | 78 | # export MANPATH="/usr/local/man:$MANPATH" 79 | 80 | # You may need to manually set your language environment 81 | # export LANG=en_US.UTF-8 82 | 83 | # Preferred editor for local and remote sessions 84 | # if [[ -n $SSH_CONNECTION ]]; then 85 | # export EDITOR='vim' 86 | # else 87 | # export EDITOR='mvim' 88 | # fi 89 | export EDITOR='vim' 90 | 91 | # Compilation flags 92 | # export ARCHFLAGS="-arch x86_64" 93 | 94 | # ssh 95 | # export SSH_KEY_PATH="~/.ssh/dsa_id" 96 | 97 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 98 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 99 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 100 | # For a full list of active aliases, run `alias`. 101 | # 102 | # Example aliases 103 | # alias zshconfig="mate ~/.zshrc" 104 | # alias ohmyzsh="mate ~/.oh-my-zsh" 105 | export PHPBREW_SET_PROMPT=1 106 | 107 | #source ~/.phpbrew/bashrc 108 | 109 | alias ls="ls -l" 110 | alias ga="git add" 111 | alias gco="git checkout" 112 | alias gc="git commit" 113 | alias gs="git status" 114 | alias composer="php ~/opensource/composer.phar " 115 | function take () { 116 | mkdir $1 117 | cd $1 118 | } 119 | 120 | function server () { 121 | if [ $1 ] 122 | then 123 | local port="$1" 124 | else 125 | local port="8000" 126 | fi 127 | open "http://localhost:$port" && python -m SimpleHTTPServer "$port" 128 | } 129 | 130 | # Search google for the given keywords. 131 | function google; { 132 | $VIEW "http://www.google.com/search?q=`url-encode "${(j: :)@}"`" 133 | } 134 | export NODE_PATH="/usr/local/lib/node_modules" 135 | -------------------------------------------------------------------------------- /files/chap-secrets: -------------------------------------------------------------------------------- 1 | 2 | # Secrets for authentication using CHAP 3 | # client server secret IP addresses 4 | demo * demo * 5 | -------------------------------------------------------------------------------- /files/nginx.phpmyadmin.default: -------------------------------------------------------------------------------- 1 | # You may add here your 2 | # server { 3 | # ... 4 | # } 5 | # statements for each of your virtual hosts to this file 6 | 7 | ## 8 | # You should look at the following URL's in order to grasp a solid understanding 9 | # of Nginx configuration files in order to fully unleash the power of Nginx. 10 | # http://wiki.nginx.org/Pitfalls 11 | # http://wiki.nginx.org/QuickStart 12 | # http://wiki.nginx.org/Configuration 13 | # 14 | # Generally, you will want to move this file somewhere, and start with a clean 15 | # file but keep this around for reference. Or just disable in sites-enabled. 16 | # 17 | # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. 18 | ## 19 | 20 | server { 21 | listen 80 default_server; 22 | listen [::]:80 default_server ipv6only=on; 23 | 24 | root /usr/share/nginx/html; 25 | index index.php index.html index.htm; 26 | 27 | # Make site accessible from http://localhost/ 28 | server_name localhost; 29 | 30 | location / { 31 | # First attempt to serve request as file, then 32 | # as directory, then fall back to displaying a 404. 33 | try_files $uri $uri/ =404; 34 | # Uncomment to enable naxsi on this location 35 | # include /etc/nginx/naxsi.rules 36 | } 37 | 38 | # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests 39 | #location /RequestDenied { 40 | # proxy_pass http://127.0.0.1:8080; 41 | #} 42 | 43 | #error_page 404 /404.html; 44 | 45 | # redirect server error pages to the static page /50x.html 46 | # 47 | #error_page 500 502 503 504 /50x.html; 48 | #location = /50x.html { 49 | # root /usr/share/nginx/html; 50 | #} 51 | 52 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 53 | # 54 | location ~ \.php$ { 55 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 56 | # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 57 | # 58 | # # With php5-cgi alone: 59 | #fastcgi_pass 127.0.0.1:9000; 60 | # # With php5-fpm: 61 | fastcgi_pass unix:/var/run/php5-fpm.sock; 62 | fastcgi_index index.php; 63 | include fastcgi_params; 64 | } 65 | 66 | # deny access to .htaccess files, if Apache's document root 67 | # concurs with nginx's one 68 | # 69 | location ~ /\.ht { 70 | deny all; 71 | } 72 | } 73 | 74 | 75 | # another virtual host using mix of IP-, name-, and port-based configuration 76 | # 77 | #server { 78 | # listen 8000; 79 | # listen somename:8080; 80 | # server_name somename alias another.alias; 81 | # root html; 82 | # index index.html index.htm; 83 | # 84 | # location / { 85 | # try_files $uri $uri/ =404; 86 | # } 87 | #} 88 | 89 | 90 | # HTTPS server 91 | # 92 | #server { 93 | # listen 443; 94 | # server_name localhost; 95 | # 96 | # root html; 97 | # index index.html index.htm; 98 | # 99 | # ssl on; 100 | # ssl_certificate cert.pem; 101 | # ssl_certificate_key cert.key; 102 | # 103 | # ssl_session_timeout 5m; 104 | # 105 | # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; 106 | # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; 107 | # ssl_prefer_server_ciphers on; 108 | # 109 | # location / { 110 | # try_files $uri $uri/ =404; 111 | # } 112 | #} 113 | -------------------------------------------------------------------------------- /files/pptpd-options: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # $Id$ 3 | # 4 | # Sample Poptop PPP options file /etc/ppp/pptpd-options 5 | # Options used by PPP when a connection arrives from a client. 6 | # This file is pointed to by /etc/pptpd.conf option keyword. 7 | # Changes are effective on the next connection. See "man pppd". 8 | # 9 | # You are expected to change this file to suit your system. As 10 | # packaged, it requires PPP 2.4.2 and the kernel MPPE module. 11 | ############################################################################### 12 | 13 | 14 | # Authentication 15 | 16 | # Name of the local system for authentication purposes 17 | # (must match the second field in /etc/ppp/chap-secrets entries) 18 | name pptpd 19 | 20 | # Optional: domain name to use for authentication 21 | # domain mydomain.net 22 | 23 | # Strip the domain prefix from the username before authentication. 24 | # (applies if you use pppd with chapms-strip-domain patch) 25 | #chapms-strip-domain 26 | 27 | 28 | # Encryption 29 | # (There have been multiple versions of PPP with encryption support, 30 | # choose with of the following sections you will use.) 31 | 32 | 33 | # BSD licensed ppp-2.4.2 upstream with MPPE only, kernel module ppp_mppe.o 34 | # {{{ 35 | refuse-pap 36 | refuse-chap 37 | refuse-mschap 38 | # Require the peer to authenticate itself using MS-CHAPv2 [Microsoft 39 | # Challenge Handshake Authentication Protocol, Version 2] authentication. 40 | require-mschap-v2 41 | # Require MPPE 128-bit encryption 42 | # (note that MPPE requires the use of MSCHAP-V2 during authentication) 43 | require-mppe-128 44 | # }}} 45 | 46 | 47 | 48 | 49 | # Network and Routing 50 | 51 | # If pppd is acting as a server for Microsoft Windows clients, this 52 | # option allows pppd to supply one or two DNS (Domain Name Server) 53 | # addresses to the clients. The first instance of this option 54 | # specifies the primary DNS address; the second instance (if given) 55 | # specifies the secondary DNS address. 56 | # Attention! This information may not be taken into account by a Windows 57 | # client. See KB311218 in Microsoft's knowledge base for more information. 58 | ms-dns 8.8.8.8 59 | ms-dns 8.8.4.4 60 | 61 | # If pppd is acting as a server for Microsoft Windows or "Samba" 62 | # clients, this option allows pppd to supply one or two WINS (Windows 63 | # Internet Name Services) server addresses to the clients. The first 64 | # instance of this option specifies the primary WINS address; the 65 | # second instance (if given) specifies the secondary WINS address. 66 | #ms-wins 10.0.0.3 67 | #ms-wins 10.0.0.4 68 | 69 | # Add an entry to this system's ARP [Address Resolution Protocol] 70 | # table with the IP address of the peer and the Ethernet address of this 71 | # system. This will have the effect of making the peer appear to other 72 | # systems to be on the local ethernet. 73 | # (you do not need this if your PPTP server is responsible for routing 74 | # packets to the clients -- James Cameron) 75 | proxyarp 76 | 77 | # Normally pptpd passes the IP address to pppd, but if pptpd has been 78 | # given the delegate option in pptpd.conf or the --delegate command line 79 | # option, then pppd will use chap-secrets or radius to allocate the 80 | # client IP address. The default local IP address used at the server 81 | # end is often the same as the address of the server. To override this, 82 | # specify the local IP address here. 83 | # (you must not use this unless you have used the delegate option) 84 | #10.8.0.100 85 | 86 | # Debian: do not replace the default route 87 | nodefaultroute 88 | 89 | 90 | # Logging 91 | 92 | # Enable connection debugging facilities. 93 | # (see your syslog configuration for where pppd sends to) 94 | #debug 95 | 96 | # Print out all the option values which have been set. 97 | # (often requested by mailing list to verify options) 98 | #dump 99 | 100 | 101 | # Miscellaneous 102 | 103 | # Create a UUCP-style lock file for the pseudo-tty to ensure exclusive 104 | # access. 105 | lock 106 | 107 | # Disable BSD-Compress compression 108 | nobsdcomp 109 | 110 | # Disable Van Jacobson compression 111 | # (needed on some networks with Windows 9x/ME/XP clients, see posting to 112 | # poptop-server on 14th April 2005 by Pawel Pokrywka and followups, 113 | # http://marc.theaimsgroup.com/?t=111343175400006&r=1&w=2 ) 114 | novj 115 | novjccomp 116 | 117 | # turn off logging to stderr, since this may be redirected to pptpd, 118 | # which may trigger a loopback 119 | nologfd 120 | 121 | # put plugins here 122 | # (putting them higher up may cause them to sent messages to the pty) 123 | -------------------------------------------------------------------------------- /files/pptpd.conf: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # $Id$ 3 | # 4 | # Sample Poptop configuration file /etc/pptpd.conf 5 | # 6 | # Changes are effective when pptpd is restarted. 7 | ############################################################################### 8 | 9 | # TAG: ppp 10 | # Path to the pppd program, default '/usr/sbin/pppd' on Linux 11 | # 12 | #ppp /usr/sbin/pppd 13 | 14 | # TAG: option 15 | # Specifies the location of the PPP options file. 16 | # By default PPP looks in '/etc/ppp/options' 17 | # 18 | option /etc/ppp/pptpd-options 19 | 20 | # TAG: debug 21 | # Turns on (more) debugging to syslog 22 | # 23 | #debug 24 | 25 | # TAG: stimeout 26 | # Specifies timeout (in seconds) on starting ctrl connection 27 | # 28 | # stimeout 10 29 | 30 | # TAG: noipparam 31 | # Suppress the passing of the client's IP address to PPP, which is 32 | # done by default otherwise. 33 | # 34 | #noipparam 35 | 36 | # TAG: logwtmp 37 | # Use wtmp(5) to record client connections and disconnections. 38 | # 39 | logwtmp 40 | 41 | # TAG: bcrelay 42 | # Turns on broadcast relay to clients from interface 43 | # 44 | #bcrelay eth1 45 | 46 | # TAG: delegate 47 | # Delegates the allocation of client IP addresses to pppd. 48 | # 49 | # Without this option, which is the default, pptpd manages the list of 50 | # IP addresses for clients and passes the next free address to pppd. 51 | # With this option, pptpd does not pass an address, and so pppd may use 52 | # radius or chap-secrets to allocate an address. 53 | # 54 | #delegate 55 | 56 | # TAG: connections 57 | # Limits the number of client connections that may be accepted. 58 | # 59 | # If pptpd is allocating IP addresses (e.g. delegate is not 60 | # used) then the number of connections is also limited by the 61 | # remoteip option. The default is 100. 62 | #connections 100 63 | 64 | # TAG: localip 65 | # TAG: remoteip 66 | # Specifies the local and remote IP address ranges. 67 | # 68 | # These options are ignored if delegate option is set. 69 | # 70 | # Any addresses work as long as the local machine takes care of the 71 | # routing. But if you want to use MS-Windows networking, you should 72 | # use IP addresses out of the LAN address space and use the proxyarp 73 | # option in the pppd options file, or run bcrelay. 74 | # 75 | # You can specify single IP addresses seperated by commas or you can 76 | # specify ranges, or both. For example: 77 | # 78 | # 192.168.0.234,192.168.0.245-249,192.168.0.254 79 | # 80 | # IMPORTANT RESTRICTIONS: 81 | # 82 | # 1. No spaces are permitted between commas or within addresses. 83 | # 84 | # 2. If you give more IP addresses than the value of connections, 85 | # it will start at the beginning of the list and go until it 86 | # gets connections IPs. Others will be ignored. 87 | # 88 | # 3. No shortcuts in ranges! ie. 234-8 does not mean 234 to 238, 89 | # you must type 234-238 if you mean this. 90 | # 91 | # 4. If you give a single localIP, that's ok - all local IPs will 92 | # be set to the given one. You MUST still give at least one remote 93 | # IP for each simultaneous client. 94 | # 95 | # (Recommended) 96 | #localip 10.0.10.1 97 | #remoteip 10.0.10.2-254 98 | localip 192.168.0.1 99 | remoteip 192.168.0.234-238,192.168.0.245 100 | # or 101 | #localip 192.168.0.234-238,192.168.0.245 102 | #remoteip 192.168.1.234-238,192.168.1.245 103 | -------------------------------------------------------------------------------- /files/rc.local: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/sh -e 3 | # 4 | # rc.local 5 | # 6 | # This script is executed at the end of each multiuser runlevel. 7 | # Make sure that the script will "exit 0" on success or any other 8 | # value on error. 9 | # 10 | # In order to enable or disable this script just change the execution 11 | # bits. 12 | # 13 | # By default this script does nothing. 14 | 15 | iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE 16 | iptables -A FORWARD -p tcp --syn -s 192.168.0.0/24 -j TCPMSS --set-mss 1356 17 | exit 0 18 | -------------------------------------------------------------------------------- /files/supervisor.startup: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # skeleton example file to build /etc/init.d/ scripts. 4 | # This file should be used to construct scripts for /etc/init.d. 5 | # 6 | # Written by Miquel van Smoorenburg . 7 | # Modified for Debian 8 | # by Ian Murdock . 9 | # Further changes by Javier Fernandez-Sanguino 10 | # 11 | # Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl 12 | # 13 | ### BEGIN INIT INFO 14 | # Provides: supervisor 15 | # Required-Start: $remote_fs $network $named 16 | # Required-Stop: $remote_fs $network $named 17 | # Default-Start: 2 3 4 5 18 | # Default-Stop: 0 1 6 19 | # Short-Description: Start/stop supervisor 20 | # Description: Start/stop supervisor daemon and its configured 21 | # subprocesses. 22 | ### END INIT INFO 23 | 24 | . /lib/lsb/init-functions 25 | 26 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 27 | DAEMON=/usr/bin/supervisord 28 | NAME=supervisord 29 | DESC=supervisor 30 | 31 | test -x $DAEMON || exit 0 32 | 33 | LOGDIR=/var/log/supervisor 34 | PIDFILE=/var/run/$NAME.pid 35 | DODTIME=5 # Time to wait for the server to die, in seconds 36 | # If this value is set too low you might not 37 | # let some servers to die gracefully and 38 | # 'restart' will not work 39 | 40 | # Include supervisor defaults if available 41 | if [ -f /etc/default/supervisor ] ; then 42 | . /etc/default/supervisor 43 | fi 44 | DAEMON_OPTS="-c /etc/supervisor/supervisord.conf $DAEMON_OPTS" 45 | 46 | set -e 47 | 48 | running_pid() 49 | { 50 | # Check if a given process pid's cmdline matches a given name 51 | pid=$1 52 | name=$2 53 | [ -z "$pid" ] && return 1 54 | [ ! -d /proc/$pid ] && return 1 55 | (cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1 56 | return 0 57 | } 58 | 59 | running() 60 | { 61 | # Check if the process is running looking at /proc 62 | # (works for all users) 63 | 64 | # No pidfile, probably no daemon present 65 | [ ! -f "$PIDFILE" ] && return 1 66 | # Obtain the pid and check it against the binary name 67 | pid=`cat $PIDFILE` 68 | running_pid $pid $DAEMON || return 1 69 | return 0 70 | } 71 | 72 | force_stop() { 73 | # Forcefully kill the process 74 | [ ! -f "$PIDFILE" ] && return 75 | if running ; then 76 | kill -15 $pid 77 | # Is it really dead? 78 | [ -n "$DODTIME" ] && sleep "$DODTIME"s 79 | if running ; then 80 | kill -9 $pid 81 | [ -n "$DODTIME" ] && sleep "$DODTIME"s 82 | if running ; then 83 | echo "Cannot kill $LABEL (pid=$pid)!" 84 | exit 1 85 | fi 86 | fi 87 | fi 88 | rm -f $PIDFILE 89 | return 0 90 | } 91 | 92 | case "$1" in 93 | start) 94 | echo -n "Starting $DESC: " 95 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ 96 | --startas $DAEMON -- $DAEMON_OPTS 97 | test -f $PIDFILE || sleep 1 98 | if running ; then 99 | echo "$NAME." 100 | else 101 | echo " ERROR." 102 | fi 103 | ;; 104 | stop) 105 | echo -n "Stopping $DESC: " 106 | start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE 107 | echo "$NAME." 108 | ;; 109 | force-stop) 110 | echo -n "Forcefully stopping $DESC: " 111 | force_stop 112 | if ! running ; then 113 | echo "$NAME." 114 | else 115 | echo " ERROR." 116 | fi 117 | ;; 118 | #reload) 119 | # 120 | # If the daemon can reload its config files on the fly 121 | # for example by sending it SIGHUP, do it here. 122 | # 123 | # If the daemon responds to changes in its config file 124 | # directly anyway, make this a do-nothing entry. 125 | # 126 | # echo "Reloading $DESC configuration files." 127 | # start-stop-daemon --stop --signal 1 --quiet --pidfile \ 128 | # /var/run/$NAME.pid --exec $DAEMON 129 | #;; 130 | force-reload) 131 | # 132 | # If the "reload" option is implemented, move the "force-reload" 133 | # option to the "reload" entry above. If not, "force-reload" is 134 | # just the same as "restart" except that it does nothing if the 135 | # daemon isn't already running. 136 | # check wether $DAEMON is running. If so, restart 137 | start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \ 138 | --startas $DAEMON \ 139 | && $0 restart \ 140 | || exit 0 141 | ;; 142 | restart) 143 | echo -n "Restarting $DESC: " 144 | start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE 145 | [ -n "$DODTIME" ] && sleep $DODTIME 146 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ 147 | --startas $DAEMON -- $DAEMON_OPTS 148 | echo "$NAME." 149 | ;; 150 | status) 151 | echo -n "$LABEL is " 152 | if running ; then 153 | echo "running" 154 | else 155 | echo " not running." 156 | exit 1 157 | fi 158 | ;; 159 | *) 160 | N=/etc/init.d/$NAME 161 | # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 162 | echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2 163 | exit 1 164 | ;; 165 | esac 166 | 167 | exit 0 168 | -------------------------------------------------------------------------------- /files/supervisord.conf: -------------------------------------------------------------------------------- 1 | 2 | ; Sample supervisor config file. 3 | ; 4 | ; For more information on the config file, please see: 5 | ; http://supervisord.org/configuration.html 6 | ; 7 | ; Notes: 8 | ; - Shell expansion ("~" or "$HOME") is not supported. Environment 9 | ; variables can be expanded using this syntax: "%(ENV_HOME)s". 10 | ; - Comments must have a leading space: "a=b ;comment" not "a=b;comment". 11 | 12 | [unix_http_server] 13 | file=/tmp/supervisor.sock ; (the path to the socket file) 14 | ;chmod=0700 ; socket file mode (default 0700) 15 | ;chown=nobody:nogroup ; socket file uid:gid owner 16 | ;username=user ; (default is no username (open server)) 17 | ;password=123 ; (default is no password (open server)) 18 | 19 | ;[inet_http_server] ; inet (TCP) server disabled by default 20 | ;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) 21 | ;username=user ; (default is no username (open server)) 22 | ;password=123 ; (default is no password (open server)) 23 | 24 | [supervisord] 25 | logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) 26 | logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) 27 | logfile_backups=10 ; (num of main logfile rotation backups;default 10) 28 | loglevel=info ; (log level;default info; others: debug,warn,trace) 29 | pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) 30 | nodaemon=false ; (start in foreground if true;default false) 31 | minfds=1024 ; (min. avail startup file descriptors;default 1024) 32 | minprocs=200 ; (min. avail process descriptors;default 200) 33 | ;umask=022 ; (process file creation umask;default 022) 34 | ;user=chrism ; (default is current user, required if root) 35 | ;identifier=supervisor ; (supervisord identifier, default is 'supervisor') 36 | ;directory=/tmp ; (default is not to cd during start) 37 | ;nocleanup=true ; (don't clean up tempfiles at start;default false) 38 | ;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) 39 | ;environment=KEY="value" ; (key value pairs to add to environment) 40 | ;strip_ansi=false ; (strip ansi escape codes in logs; def. false) 41 | 42 | ; the below section must remain in the config file for RPC 43 | ; (supervisorctl/web interface) to work, additional interfaces may be 44 | ; added by defining them in separate rpcinterface: sections 45 | [rpcinterface:supervisor] 46 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 47 | 48 | [supervisorctl] 49 | serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket 50 | ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket 51 | ;username=chris ; should be same as http_username if set 52 | ;password=123 ; should be same as http_password if set 53 | ;prompt=mysupervisor ; cmd line prompt (default "supervisor") 54 | ;history_file=~/.sc_history ; use readline history if available 55 | 56 | ; The below sample program section shows all possible program subsection values, 57 | ; create one or more 'real' program: sections to be able to control them under 58 | ; supervisor. 59 | 60 | ;[program:theprogramname] 61 | ;command=/bin/cat ; the program (relative uses PATH, can take args) 62 | ;process_name=%(program_name)s ; process_name expr (default %(program_name)s) 63 | ;numprocs=1 ; number of processes copies to start (def 1) 64 | ;directory=/tmp ; directory to cwd to before exec (def no cwd) 65 | ;umask=022 ; umask for process (default None) 66 | ;priority=999 ; the relative start priority (default 999) 67 | ;autostart=true ; start at supervisord start (default: true) 68 | ;autorestart=unexpected ; whether/when to restart (default: unexpected) 69 | ;startsecs=1 ; number of secs prog must stay running (def. 1) 70 | ;startretries=3 ; max # of serial start failures (default 3) 71 | ;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) 72 | ;stopsignal=QUIT ; signal used to kill process (default TERM) 73 | ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) 74 | ;stopasgroup=false ; send stop signal to the UNIX process group (default false) 75 | ;killasgroup=false ; SIGKILL the UNIX process group (def false) 76 | ;user=chrism ; setuid to this UNIX account to run the program 77 | ;redirect_stderr=true ; redirect proc stderr to stdout (default false) 78 | ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO 79 | ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 80 | ;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) 81 | ;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 82 | ;stdout_events_enabled=false ; emit events on stdout writes (default false) 83 | ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO 84 | ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 85 | ;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) 86 | ;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) 87 | ;stderr_events_enabled=false ; emit events on stderr writes (default false) 88 | ;environment=A="1",B="2" ; process environment additions (def no adds) 89 | ;serverurl=AUTO ; override serverurl computation (childutils) 90 | 91 | ; The below sample eventlistener section shows all possible 92 | ; eventlistener subsection values, create one or more 'real' 93 | ; eventlistener: sections to be able to handle event notifications 94 | ; sent by supervisor. 95 | 96 | ;[eventlistener:theeventlistenername] 97 | ;command=/bin/eventlistener ; the program (relative uses PATH, can take args) 98 | ;process_name=%(program_name)s ; process_name expr (default %(program_name)s) 99 | ;numprocs=1 ; number of processes copies to start (def 1) 100 | ;events=EVENT ; event notif. types to subscribe to (req'd) 101 | ;buffer_size=10 ; event buffer queue size (default 10) 102 | ;directory=/tmp ; directory to cwd to before exec (def no cwd) 103 | ;umask=022 ; umask for process (default None) 104 | ;priority=-1 ; the relative start priority (default -1) 105 | ;autostart=true ; start at supervisord start (default: true) 106 | ;autorestart=unexpected ; whether/when to restart (default: unexpected) 107 | ;startsecs=1 ; number of secs prog must stay running (def. 1) 108 | ;startretries=3 ; max # of serial start failures (default 3) 109 | ;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) 110 | ;stopsignal=QUIT ; signal used to kill process (default TERM) 111 | ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) 112 | ;stopasgroup=false ; send stop signal to the UNIX process group (default false) 113 | ;killasgroup=false ; SIGKILL the UNIX process group (def false) 114 | ;user=chrism ; setuid to this UNIX account to run the program 115 | ;redirect_stderr=true ; redirect proc stderr to stdout (default false) 116 | ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO 117 | ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 118 | ;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) 119 | ;stdout_events_enabled=false ; emit events on stdout writes (default false) 120 | ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO 121 | ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) 122 | ;stderr_logfile_backups ; # of stderr logfile backups (default 10) 123 | ;stderr_events_enabled=false ; emit events on stderr writes (default false) 124 | ;environment=A="1",B="2" ; process environment additions 125 | ;serverurl=AUTO ; override serverurl computation (childutils) 126 | 127 | ; The below sample group section shows all possible group values, 128 | ; create one or more 'real' group: sections to create "heterogeneous" 129 | ; process groups. 130 | 131 | ;[group:thegroupname] 132 | ;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions 133 | ;priority=999 ; the relative start priority (default 999) 134 | 135 | ; The [include] section can just contain the "files" setting. This 136 | ; setting can list multiple files (separated by whitespace or 137 | ; newlines). It can also contain wildcards. The filenames are 138 | ; interpreted as relative to this file. Included files *cannot* 139 | ; include files themselves. 140 | 141 | [include] 142 | files = /etc/supervisord/conf.d/*.conf 143 | -------------------------------------------------------------------------------- /files/sysctl.conf: -------------------------------------------------------------------------------- 1 | # 2 | # /etc/sysctl.conf - Configuration file for setting system variables 3 | # See /etc/sysctl.d/ for additional system variables. 4 | # See sysctl.conf (5) for information. 5 | # 6 | 7 | #kernel.domainname = example.com 8 | 9 | # Uncomment the following to stop low-level messages on console 10 | #kernel.printk = 3 4 1 3 11 | 12 | ##############################################################3 13 | # Functions previously found in netbase 14 | # 15 | 16 | # Uncomment the next two lines to enable Spoof protection (reverse-path filter) 17 | # Turn on Source Address Verification in all interfaces to 18 | # prevent some spoofing attacks 19 | #net.ipv4.conf.default.rp_filter=1 20 | #net.ipv4.conf.all.rp_filter=1 21 | 22 | # Uncomment the next line to enable TCP/IP SYN cookies 23 | # See http://lwn.net/Articles/277146/ 24 | # Note: This may impact IPv6 TCP sessions too 25 | #net.ipv4.tcp_syncookies=1 26 | 27 | # Uncomment the next line to enable packet forwarding for IPv4 28 | fs.file-max=51200 29 | net.ipv4.ip_forward=1 30 | 31 | # Uncomment the next line to enable packet forwarding for IPv6 32 | # Enabling this option disables Stateless Address Autoconfiguration 33 | # based on Router Advertisements for this host 34 | #net.ipv6.conf.all.forwarding=1 35 | 36 | 37 | ################################################################### 38 | # Additional settings - these settings can improve the network 39 | # security of the host and prevent against some network attacks 40 | # including spoofing attacks and man in the middle attacks through 41 | # redirection. Some network environments, however, require that these 42 | # settings are disabled so review and enable them as needed. 43 | # 44 | # Do not accept ICMP redirects (prevent MITM attacks) 45 | #net.ipv4.conf.all.accept_redirects = 0 46 | #net.ipv6.conf.all.accept_redirects = 0 47 | # _or_ 48 | # Accept ICMP redirects only for gateways listed in our default 49 | # gateway list (enabled by default) 50 | # net.ipv4.conf.all.secure_redirects = 1 51 | # 52 | # Do not send ICMP redirects (we are not a router) 53 | #net.ipv4.conf.all.send_redirects = 0 54 | # 55 | # Do not accept IP source route packets (we are not a router) 56 | #net.ipv4.conf.all.accept_source_route = 0 57 | #net.ipv6.conf.all.accept_source_route = 0 58 | # 59 | # Log Martian Packets 60 | #net.ipv4.conf.all.log_martians = 1 61 | # 62 | 63 | # Digital Ocean Recommended Settings: 64 | net.core.wmem_max=12582912 65 | net.core.rmem_max=12582912 66 | net.ipv4.tcp_rmem= 10240 87380 12582912 67 | net.ipv4.tcp_wmem= 10240 87380 12582912 68 | 69 | 70 | # Digital Ocean Recommended Settings: 71 | net.core.wmem_max=12582912 72 | net.core.rmem_max=12582912 73 | net.ipv4.tcp_rmem= 10240 87380 12582912 74 | net.ipv4.tcp_wmem= 10240 87380 12582912 75 | 76 | 77 | # Digital Ocean Recommended Settings: 78 | net.core.wmem_max=12582912 79 | net.core.rmem_max=12582912 80 | net.ipv4.tcp_rmem= 10240 87380 12582912 81 | net.ipv4.tcp_wmem= 10240 87380 12582912 82 | 83 | 84 | # Digital Ocean Recommended Settings: 85 | net.core.wmem_max=12582912 86 | net.core.rmem_max=12582912 87 | net.ipv4.tcp_rmem= 10240 87380 12582912 88 | net.ipv4.tcp_wmem= 10240 87380 12582912 89 | 90 | 91 | # Digital Ocean Recommended Settings: 92 | net.core.wmem_max=12582912 93 | net.core.rmem_max=12582912 94 | net.ipv4.tcp_rmem= 10240 87380 12582912 95 | net.ipv4.tcp_wmem= 10240 87380 12582912 96 | 97 | 98 | # Digital Ocean Recommended Settings: 99 | net.core.wmem_max=12582912 100 | net.core.rmem_max=12582912 101 | net.ipv4.tcp_rmem= 10240 87380 12582912 102 | net.ipv4.tcp_wmem= 10240 87380 12582912 103 | -------------------------------------------------------------------------------- /files/vsftpd.conf: -------------------------------------------------------------------------------- 1 | # Example config file /etc/vsftpd.conf 2 | # 3 | # The default compiled in settings are fairly paranoid. This sample file 4 | # loosens things up a bit, to make the ftp daemon more usable. 5 | # Please see vsftpd.conf.5 for all compiled in defaults. 6 | # 7 | # READ THIS: This example file is NOT an exhaustive list of vsftpd options. 8 | # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's 9 | # capabilities. 10 | # 11 | # 12 | # Run standalone? vsftpd can run either from an inetd or as a standalone 13 | # daemon started from an initscript. 14 | listen=YES 15 | # 16 | # Run standalone with IPv6? 17 | # Like the listen parameter, except vsftpd will listen on an IPv6 socket 18 | # instead of an IPv4 one. This parameter and the listen parameter are mutually 19 | # exclusive. 20 | #listen_ipv6=YES 21 | # 22 | # Allow anonymous FTP? (Disabled by default) 23 | anonymous_enable=NO 24 | # 25 | # Uncomment this to allow local users to log in. 26 | local_enable=YES 27 | pam_service_name=vsftpd 28 | # 29 | # Uncomment this to enable any form of FTP write command. 30 | write_enable=YES 31 | # 32 | # Default umask for local users is 077. You may wish to change this to 022, 33 | # if your users expect that (022 is used by most other ftpd's) 34 | #local_umask=022 35 | # 36 | # Uncomment this to allow the anonymous FTP user to upload files. This only 37 | # has an effect if the above global write enable is activated. Also, you will 38 | # obviously need to create a directory writable by the FTP user. 39 | #anon_upload_enable=YES 40 | # 41 | # Uncomment this if you want the anonymous FTP user to be able to create 42 | # new directories. 43 | #anon_mkdir_write_enable=YES 44 | # 45 | # Activate directory messages - messages given to remote users when they 46 | # go into a certain directory. 47 | dirmessage_enable=YES 48 | # 49 | # If enabled, vsftpd will display directory listings with the time 50 | # in your local time zone. The default is to display GMT. The 51 | # times returned by the MDTM FTP command are also affected by this 52 | # option. 53 | use_localtime=YES 54 | # 55 | # Activate logging of uploads/downloads. 56 | xferlog_enable=YES 57 | # 58 | # Make sure PORT transfer connections originate from port 20 (ftp-data). 59 | connect_from_port_20=YES 60 | # 61 | # If you want, you can arrange for uploaded anonymous files to be owned by 62 | # a different user. Note! Using "root" for uploaded files is not 63 | # recommended! 64 | #chown_uploads=YES 65 | #chown_username=whoever 66 | # 67 | # You may override where the log file goes if you like. The default is shown 68 | # below. 69 | #xferlog_file=/var/log/vsftpd.log 70 | # 71 | # If you want, you can have your log file in standard ftpd xferlog format. 72 | # Note that the default log file location is /var/log/xferlog in this case. 73 | #xferlog_std_format=YES 74 | # 75 | # You may change the default value for timing out an idle session. 76 | #idle_session_timeout=600 77 | # 78 | # You may change the default value for timing out a data connection. 79 | #data_connection_timeout=120 80 | # 81 | # It is recommended that you define on your system a unique user which the 82 | # ftp server can use as a totally isolated and unprivileged user. 83 | #nopriv_user=ftpsecure 84 | # 85 | # Enable this and the server will recognise asynchronous ABOR requests. Not 86 | # recommended for security (the code is non-trivial). Not enabling it, 87 | # however, may confuse older FTP clients. 88 | #async_abor_enable=YES 89 | # 90 | # By default the server will pretend to allow ASCII mode but in fact ignore 91 | # the request. Turn on the below options to have the server actually do ASCII 92 | # mangling on files when in ASCII mode. 93 | # Beware that on some FTP servers, ASCII support allows a denial of service 94 | # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd 95 | # predicted this attack and has always been safe, reporting the size of the 96 | # raw file. 97 | # ASCII mangling is a horrible feature of the protocol. 98 | #ascii_upload_enable=YES 99 | #ascii_download_enable=YES 100 | # 101 | # You may fully customise the login banner string: 102 | #ftpd_banner=Welcome to blah FTP service. 103 | # 104 | # You may specify a file of disallowed anonymous e-mail addresses. Apparently 105 | # useful for combatting certain DoS attacks. 106 | #deny_email_enable=YES 107 | # (default follows) 108 | #banned_email_file=/etc/vsftpd.banned_emails 109 | # 110 | # You may restrict local users to their home directories. See the FAQ for 111 | # the possible risks in this before using chroot_local_user or 112 | # chroot_list_enable below. 113 | #chroot_local_user=YES 114 | # 115 | # You may specify an explicit list of local users to chroot() to their home 116 | # directory. If chroot_local_user is YES, then this list becomes a list of 117 | # users to NOT chroot(). 118 | # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that 119 | # the user does not have write access to the top level directory within the 120 | # chroot) 121 | #chroot_local_user=YES 122 | #chroot_list_enable=YES 123 | # (default follows) 124 | #chroot_list_file=/etc/vsftpd.chroot_list 125 | # 126 | # You may activate the "-R" option to the builtin ls. This is disabled by 127 | # default to avoid remote users being able to cause excessive I/O on large 128 | # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume 129 | # the presence of the "-R" option, so there is a strong case for enabling it. 130 | #ls_recurse_enable=YES 131 | # 132 | # Customization 133 | # 134 | # Some of vsftpd's settings don't fit the filesystem layout by 135 | # default. 136 | # 137 | # This option should be the name of a directory which is empty. Also, the 138 | # directory should not be writable by the ftp user. This directory is used 139 | # as a secure chroot() jail at times vsftpd does not require filesystem 140 | # access. 141 | secure_chroot_dir=/var/run/vsftpd/empty 142 | # 143 | # This string is the name of the PAM service vsftpd will use. 144 | pam_service_name=vsftpd 145 | seccomp_sandbox=NO 146 | # 147 | # This option specifies the location of the RSA certificate to use for SSL 148 | # encrypted connections. 149 | rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem 150 | # This option specifies the location of the RSA key to use for SSL 151 | # encrypted connections. 152 | rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key 153 | -------------------------------------------------------------------------------- /lib/simpletool.rb: -------------------------------------------------------------------------------- 1 | require 'thor' 2 | require 'awesome_print' 3 | 4 | class SimpleTool < Thor 5 | include Thor::Actions 6 | 7 | def self.source_root 8 | File.dirname(__FILE__) 9 | end 10 | 11 | no_commands do 12 | def cp_file(src, dest, sudo=false) 13 | command = 'cp -r ' + SimpleTool.source_root + '/' + src + ' ' + dest 14 | command = 'sudo ' + command if sudo 15 | ap command 16 | `#{command}` 17 | end 18 | end 19 | 20 | 21 | 22 | desc "install_pptp_vpn username passwd", "quick install pptp vpn on ubuntu, need provide username & password, remember to reboot machine to check!!!" 23 | def install_pptp_vpn(user, pwd) 24 | ap "hello" 25 | `sudo apt-get install --yes pptpd pptp-linux` 26 | cp_file('support/pptp_vpn/ubuntu/pptpd.conf', '/etc/pptpd.conf', true) 27 | cp_file('support/pptp_vpn/ubuntu/pptpd-options', '/etc/ppp/pptpd-options', true) 28 | `sudo bash -c "echo '#{user} * #{pwd} *' >> /etc/ppp/chap-secrets"` 29 | cp_file('support/pptp_vpn/ubuntu/sysctl.conf', '/etc/sysctl.conf', true) 30 | cp_file('support/pptp_vpn/ubuntu/rc.local', '/etc/rc.local', true) 31 | `sudo modprobe nf_conntrack_proto_gre nf_conntrack_pptp` 32 | `sudo /etc/init.d/pptpd restart` 33 | `echo 'pleaese reboot to make it works'` 34 | end 35 | 36 | desc "install_phpmyadmin", "quick install phpmyadmin on ubuntu" 37 | def install_phpmyadmin 38 | `sudo apt-get -y install nginx php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql php5-gd php-apc php5-common` 39 | 40 | #modify mysql.ini 41 | `sudo sed -i'' -e '/bind-address/d' /etc/mysql/my.cnf` 42 | `wget https://files.phpmyadmin.net/phpMyAdmin/4.4.15.8/phpMyAdmin-4.4.15.8-english.tar.gz -O phpmyadmin.tar.gz` 43 | `tar -xvzf phpmyadmin.tar.gz` 44 | `sudo mv phpMyAdmin-4.4.15.8-english /usr/share/nginx/html/phpmyadmin` 45 | 46 | cp_file('support/phpmyadmin/nginx.phpmyadmin.default', '/etc/nginx/sites-enabled/nginx.phpmyadmin.default', true) 47 | `sudo service nginx reload` 48 | `sudo service php5-fpm restart` 49 | end 50 | 51 | desc "install_ftp username passwd", "install ftp on ubuntu, need provide username & passwd" 52 | def install_ftp(username, passwd) 53 | `sudo apt-get --yes install wget vsftpd` 54 | `sudo useradd #{username}` 55 | `sudo mkdir /home/#{username}` 56 | `sudo chown "#{username}:#{username}" "/home/$1"` 57 | `sudo bash -c "echo '#{username}:#{passwd}' | /usr/sbin/chpasswd"` 58 | `sudo rm /etc/pam.d/vsftpd` 59 | cp_file('support/ftp/vsftpd.conf', '/etc/vsftpd.conf', true) 60 | `sudo service vsftpd restart` 61 | end 62 | 63 | desc "install_zsh", "quick install oh-my-zsh with plugins configed on ubuntu" 64 | def install_zsh 65 | `sudo apt-get --yes install git zsh autojump` 66 | `mkdir ~/opensource` 67 | `git clone https://github.com/robbyrussell/oh-my-zsh ~/.oh-my-zsh` 68 | `git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/opensource/zsh-syntax-highlighting` 69 | `git clone https://github.com/zsh-users/zsh-history-substring-search.git ~/opensource/zsh-history-substring-search` 70 | `git clone https://github.com/olivierverdier/zsh-git-prompt.git ~/opensource/zsh-git-prompt` 71 | cp_file('support/zsh/.zshrc', '~/.zshrc') 72 | `sudo chsh -s $(which zsh)` 73 | `zsh` 74 | end 75 | 76 | 77 | 78 | end 79 | -------------------------------------------------------------------------------- /lib/support/ftp/vsftpd.conf: -------------------------------------------------------------------------------- 1 | # Example config file /etc/vsftpd.conf 2 | # 3 | # The default compiled in settings are fairly paranoid. This sample file 4 | # loosens things up a bit, to make the ftp daemon more usable. 5 | # Please see vsftpd.conf.5 for all compiled in defaults. 6 | # 7 | # READ THIS: This example file is NOT an exhaustive list of vsftpd options. 8 | # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's 9 | # capabilities. 10 | # 11 | # 12 | # Run standalone? vsftpd can run either from an inetd or as a standalone 13 | # daemon started from an initscript. 14 | listen=YES 15 | # 16 | # Run standalone with IPv6? 17 | # Like the listen parameter, except vsftpd will listen on an IPv6 socket 18 | # instead of an IPv4 one. This parameter and the listen parameter are mutually 19 | # exclusive. 20 | #listen_ipv6=YES 21 | # 22 | # Allow anonymous FTP? (Disabled by default) 23 | anonymous_enable=NO 24 | # 25 | # Uncomment this to allow local users to log in. 26 | local_enable=YES 27 | pam_service_name=vsftpd 28 | # 29 | # Uncomment this to enable any form of FTP write command. 30 | write_enable=YES 31 | # 32 | # Default umask for local users is 077. You may wish to change this to 022, 33 | # if your users expect that (022 is used by most other ftpd's) 34 | #local_umask=022 35 | # 36 | # Uncomment this to allow the anonymous FTP user to upload files. This only 37 | # has an effect if the above global write enable is activated. Also, you will 38 | # obviously need to create a directory writable by the FTP user. 39 | #anon_upload_enable=YES 40 | # 41 | # Uncomment this if you want the anonymous FTP user to be able to create 42 | # new directories. 43 | #anon_mkdir_write_enable=YES 44 | # 45 | # Activate directory messages - messages given to remote users when they 46 | # go into a certain directory. 47 | dirmessage_enable=YES 48 | # 49 | # If enabled, vsftpd will display directory listings with the time 50 | # in your local time zone. The default is to display GMT. The 51 | # times returned by the MDTM FTP command are also affected by this 52 | # option. 53 | use_localtime=YES 54 | # 55 | # Activate logging of uploads/downloads. 56 | xferlog_enable=YES 57 | # 58 | # Make sure PORT transfer connections originate from port 20 (ftp-data). 59 | connect_from_port_20=YES 60 | # 61 | # If you want, you can arrange for uploaded anonymous files to be owned by 62 | # a different user. Note! Using "root" for uploaded files is not 63 | # recommended! 64 | #chown_uploads=YES 65 | #chown_username=whoever 66 | # 67 | # You may override where the log file goes if you like. The default is shown 68 | # below. 69 | #xferlog_file=/var/log/vsftpd.log 70 | # 71 | # If you want, you can have your log file in standard ftpd xferlog format. 72 | # Note that the default log file location is /var/log/xferlog in this case. 73 | #xferlog_std_format=YES 74 | # 75 | # You may change the default value for timing out an idle session. 76 | #idle_session_timeout=600 77 | # 78 | # You may change the default value for timing out a data connection. 79 | #data_connection_timeout=120 80 | # 81 | # It is recommended that you define on your system a unique user which the 82 | # ftp server can use as a totally isolated and unprivileged user. 83 | #nopriv_user=ftpsecure 84 | # 85 | # Enable this and the server will recognise asynchronous ABOR requests. Not 86 | # recommended for security (the code is non-trivial). Not enabling it, 87 | # however, may confuse older FTP clients. 88 | #async_abor_enable=YES 89 | # 90 | # By default the server will pretend to allow ASCII mode but in fact ignore 91 | # the request. Turn on the below options to have the server actually do ASCII 92 | # mangling on files when in ASCII mode. 93 | # Beware that on some FTP servers, ASCII support allows a denial of service 94 | # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd 95 | # predicted this attack and has always been safe, reporting the size of the 96 | # raw file. 97 | # ASCII mangling is a horrible feature of the protocol. 98 | #ascii_upload_enable=YES 99 | #ascii_download_enable=YES 100 | # 101 | # You may fully customise the login banner string: 102 | #ftpd_banner=Welcome to blah FTP service. 103 | # 104 | # You may specify a file of disallowed anonymous e-mail addresses. Apparently 105 | # useful for combatting certain DoS attacks. 106 | #deny_email_enable=YES 107 | # (default follows) 108 | #banned_email_file=/etc/vsftpd.banned_emails 109 | # 110 | # You may restrict local users to their home directories. See the FAQ for 111 | # the possible risks in this before using chroot_local_user or 112 | # chroot_list_enable below. 113 | #chroot_local_user=YES 114 | # 115 | # You may specify an explicit list of local users to chroot() to their home 116 | # directory. If chroot_local_user is YES, then this list becomes a list of 117 | # users to NOT chroot(). 118 | # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that 119 | # the user does not have write access to the top level directory within the 120 | # chroot) 121 | #chroot_local_user=YES 122 | #chroot_list_enable=YES 123 | # (default follows) 124 | #chroot_list_file=/etc/vsftpd.chroot_list 125 | # 126 | # You may activate the "-R" option to the builtin ls. This is disabled by 127 | # default to avoid remote users being able to cause excessive I/O on large 128 | # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume 129 | # the presence of the "-R" option, so there is a strong case for enabling it. 130 | #ls_recurse_enable=YES 131 | # 132 | # Customization 133 | # 134 | # Some of vsftpd's settings don't fit the filesystem layout by 135 | # default. 136 | # 137 | # This option should be the name of a directory which is empty. Also, the 138 | # directory should not be writable by the ftp user. This directory is used 139 | # as a secure chroot() jail at times vsftpd does not require filesystem 140 | # access. 141 | secure_chroot_dir=/var/run/vsftpd/empty 142 | # 143 | # This string is the name of the PAM service vsftpd will use. 144 | pam_service_name=vsftpd 145 | seccomp_sandbox=NO 146 | # 147 | # This option specifies the location of the RSA certificate to use for SSL 148 | # encrypted connections. 149 | rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem 150 | # This option specifies the location of the RSA key to use for SSL 151 | # encrypted connections. 152 | rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key 153 | -------------------------------------------------------------------------------- /lib/support/phpmyadmin/nginx.phpmyadmin.default: -------------------------------------------------------------------------------- 1 | # You may add here your 2 | # server { 3 | # ... 4 | # } 5 | # statements for each of your virtual hosts to this file 6 | 7 | ## 8 | # You should look at the following URL's in order to grasp a solid understanding 9 | # of Nginx configuration files in order to fully unleash the power of Nginx. 10 | # http://wiki.nginx.org/Pitfalls 11 | # http://wiki.nginx.org/QuickStart 12 | # http://wiki.nginx.org/Configuration 13 | # 14 | # Generally, you will want to move this file somewhere, and start with a clean 15 | # file but keep this around for reference. Or just disable in sites-enabled. 16 | # 17 | # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. 18 | ## 19 | 20 | server { 21 | listen 80 default_server; 22 | listen [::]:80 default_server ipv6only=on; 23 | 24 | root /usr/share/nginx/html; 25 | index index.php index.html index.htm; 26 | 27 | # Make site accessible from http://localhost/ 28 | server_name localhost; 29 | 30 | location / { 31 | # First attempt to serve request as file, then 32 | # as directory, then fall back to displaying a 404. 33 | try_files $uri $uri/ =404; 34 | # Uncomment to enable naxsi on this location 35 | # include /etc/nginx/naxsi.rules 36 | } 37 | 38 | # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests 39 | #location /RequestDenied { 40 | # proxy_pass http://127.0.0.1:8080; 41 | #} 42 | 43 | #error_page 404 /404.html; 44 | 45 | # redirect server error pages to the static page /50x.html 46 | # 47 | #error_page 500 502 503 504 /50x.html; 48 | #location = /50x.html { 49 | # root /usr/share/nginx/html; 50 | #} 51 | 52 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 53 | # 54 | location ~ \.php$ { 55 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 56 | # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 57 | # 58 | # # With php5-cgi alone: 59 | #fastcgi_pass 127.0.0.1:9000; 60 | # # With php5-fpm: 61 | fastcgi_pass unix:/var/run/php5-fpm.sock; 62 | fastcgi_index index.php; 63 | include fastcgi_params; 64 | } 65 | 66 | # deny access to .htaccess files, if Apache's document root 67 | # concurs with nginx's one 68 | # 69 | location ~ /\.ht { 70 | deny all; 71 | } 72 | } 73 | 74 | 75 | # another virtual host using mix of IP-, name-, and port-based configuration 76 | # 77 | #server { 78 | # listen 8000; 79 | # listen somename:8080; 80 | # server_name somename alias another.alias; 81 | # root html; 82 | # index index.html index.htm; 83 | # 84 | # location / { 85 | # try_files $uri $uri/ =404; 86 | # } 87 | #} 88 | 89 | 90 | # HTTPS server 91 | # 92 | #server { 93 | # listen 443; 94 | # server_name localhost; 95 | # 96 | # root html; 97 | # index index.html index.htm; 98 | # 99 | # ssl on; 100 | # ssl_certificate cert.pem; 101 | # ssl_certificate_key cert.key; 102 | # 103 | # ssl_session_timeout 5m; 104 | # 105 | # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; 106 | # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; 107 | # ssl_prefer_server_ciphers on; 108 | # 109 | # location / { 110 | # try_files $uri $uri/ =404; 111 | # } 112 | #} 113 | -------------------------------------------------------------------------------- /lib/support/pptp_vpn/ubuntu/pptpd-options: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # $Id$ 3 | # 4 | # Sample Poptop PPP options file /etc/ppp/pptpd-options 5 | # Options used by PPP when a connection arrives from a client. 6 | # This file is pointed to by /etc/pptpd.conf option keyword. 7 | # Changes are effective on the next connection. See "man pppd". 8 | # 9 | # You are expected to change this file to suit your system. As 10 | # packaged, it requires PPP 2.4.2 and the kernel MPPE module. 11 | ############################################################################### 12 | 13 | 14 | # Authentication 15 | 16 | # Name of the local system for authentication purposes 17 | # (must match the second field in /etc/ppp/chap-secrets entries) 18 | name pptpd 19 | 20 | # Optional: domain name to use for authentication 21 | # domain mydomain.net 22 | 23 | # Strip the domain prefix from the username before authentication. 24 | # (applies if you use pppd with chapms-strip-domain patch) 25 | #chapms-strip-domain 26 | 27 | 28 | # Encryption 29 | # (There have been multiple versions of PPP with encryption support, 30 | # choose with of the following sections you will use.) 31 | 32 | 33 | # BSD licensed ppp-2.4.2 upstream with MPPE only, kernel module ppp_mppe.o 34 | # {{{ 35 | refuse-pap 36 | refuse-chap 37 | refuse-mschap 38 | # Require the peer to authenticate itself using MS-CHAPv2 [Microsoft 39 | # Challenge Handshake Authentication Protocol, Version 2] authentication. 40 | require-mschap-v2 41 | # Require MPPE 128-bit encryption 42 | # (note that MPPE requires the use of MSCHAP-V2 during authentication) 43 | require-mppe-128 44 | # }}} 45 | 46 | 47 | 48 | 49 | # Network and Routing 50 | 51 | # If pppd is acting as a server for Microsoft Windows clients, this 52 | # option allows pppd to supply one or two DNS (Domain Name Server) 53 | # addresses to the clients. The first instance of this option 54 | # specifies the primary DNS address; the second instance (if given) 55 | # specifies the secondary DNS address. 56 | # Attention! This information may not be taken into account by a Windows 57 | # client. See KB311218 in Microsoft's knowledge base for more information. 58 | ms-dns 8.8.8.8 59 | ms-dns 8.8.4.4 60 | 61 | # If pppd is acting as a server for Microsoft Windows or "Samba" 62 | # clients, this option allows pppd to supply one or two WINS (Windows 63 | # Internet Name Services) server addresses to the clients. The first 64 | # instance of this option specifies the primary WINS address; the 65 | # second instance (if given) specifies the secondary WINS address. 66 | #ms-wins 10.0.0.3 67 | #ms-wins 10.0.0.4 68 | 69 | # Add an entry to this system's ARP [Address Resolution Protocol] 70 | # table with the IP address of the peer and the Ethernet address of this 71 | # system. This will have the effect of making the peer appear to other 72 | # systems to be on the local ethernet. 73 | # (you do not need this if your PPTP server is responsible for routing 74 | # packets to the clients -- James Cameron) 75 | proxyarp 76 | 77 | # Normally pptpd passes the IP address to pppd, but if pptpd has been 78 | # given the delegate option in pptpd.conf or the --delegate command line 79 | # option, then pppd will use chap-secrets or radius to allocate the 80 | # client IP address. The default local IP address used at the server 81 | # end is often the same as the address of the server. To override this, 82 | # specify the local IP address here. 83 | # (you must not use this unless you have used the delegate option) 84 | #10.8.0.100 85 | 86 | # Debian: do not replace the default route 87 | nodefaultroute 88 | 89 | 90 | # Logging 91 | 92 | # Enable connection debugging facilities. 93 | # (see your syslog configuration for where pppd sends to) 94 | #debug 95 | 96 | # Print out all the option values which have been set. 97 | # (often requested by mailing list to verify options) 98 | #dump 99 | 100 | 101 | # Miscellaneous 102 | 103 | # Create a UUCP-style lock file for the pseudo-tty to ensure exclusive 104 | # access. 105 | lock 106 | 107 | # Disable BSD-Compress compression 108 | nobsdcomp 109 | 110 | # Disable Van Jacobson compression 111 | # (needed on some networks with Windows 9x/ME/XP clients, see posting to 112 | # poptop-server on 14th April 2005 by Pawel Pokrywka and followups, 113 | # http://marc.theaimsgroup.com/?t=111343175400006&r=1&w=2 ) 114 | novj 115 | novjccomp 116 | 117 | # turn off logging to stderr, since this may be redirected to pptpd, 118 | # which may trigger a loopback 119 | nologfd 120 | 121 | # put plugins here 122 | # (putting them higher up may cause them to sent messages to the pty) 123 | -------------------------------------------------------------------------------- /lib/support/pptp_vpn/ubuntu/pptpd.conf: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # $Id$ 3 | # 4 | # Sample Poptop configuration file /etc/pptpd.conf 5 | # 6 | # Changes are effective when pptpd is restarted. 7 | ############################################################################### 8 | 9 | # TAG: ppp 10 | # Path to the pppd program, default '/usr/sbin/pppd' on Linux 11 | # 12 | #ppp /usr/sbin/pppd 13 | 14 | # TAG: option 15 | # Specifies the location of the PPP options file. 16 | # By default PPP looks in '/etc/ppp/options' 17 | # 18 | option /etc/ppp/pptpd-options 19 | 20 | # TAG: debug 21 | # Turns on (more) debugging to syslog 22 | # 23 | #debug 24 | 25 | # TAG: stimeout 26 | # Specifies timeout (in seconds) on starting ctrl connection 27 | # 28 | # stimeout 10 29 | 30 | # TAG: noipparam 31 | # Suppress the passing of the client's IP address to PPP, which is 32 | # done by default otherwise. 33 | # 34 | #noipparam 35 | 36 | # TAG: logwtmp 37 | # Use wtmp(5) to record client connections and disconnections. 38 | # 39 | logwtmp 40 | 41 | # TAG: bcrelay 42 | # Turns on broadcast relay to clients from interface 43 | # 44 | #bcrelay eth1 45 | 46 | # TAG: delegate 47 | # Delegates the allocation of client IP addresses to pppd. 48 | # 49 | # Without this option, which is the default, pptpd manages the list of 50 | # IP addresses for clients and passes the next free address to pppd. 51 | # With this option, pptpd does not pass an address, and so pppd may use 52 | # radius or chap-secrets to allocate an address. 53 | # 54 | #delegate 55 | 56 | # TAG: connections 57 | # Limits the number of client connections that may be accepted. 58 | # 59 | # If pptpd is allocating IP addresses (e.g. delegate is not 60 | # used) then the number of connections is also limited by the 61 | # remoteip option. The default is 100. 62 | #connections 100 63 | 64 | # TAG: localip 65 | # TAG: remoteip 66 | # Specifies the local and remote IP address ranges. 67 | # 68 | # These options are ignored if delegate option is set. 69 | # 70 | # Any addresses work as long as the local machine takes care of the 71 | # routing. But if you want to use MS-Windows networking, you should 72 | # use IP addresses out of the LAN address space and use the proxyarp 73 | # option in the pppd options file, or run bcrelay. 74 | # 75 | # You can specify single IP addresses seperated by commas or you can 76 | # specify ranges, or both. For example: 77 | # 78 | # 192.168.0.234,192.168.0.245-249,192.168.0.254 79 | # 80 | # IMPORTANT RESTRICTIONS: 81 | # 82 | # 1. No spaces are permitted between commas or within addresses. 83 | # 84 | # 2. If you give more IP addresses than the value of connections, 85 | # it will start at the beginning of the list and go until it 86 | # gets connections IPs. Others will be ignored. 87 | # 88 | # 3. No shortcuts in ranges! ie. 234-8 does not mean 234 to 238, 89 | # you must type 234-238 if you mean this. 90 | # 91 | # 4. If you give a single localIP, that's ok - all local IPs will 92 | # be set to the given one. You MUST still give at least one remote 93 | # IP for each simultaneous client. 94 | # 95 | # (Recommended) 96 | #localip 10.0.10.1 97 | #remoteip 10.0.10.2-254 98 | localip 192.168.0.1 99 | remoteip 192.168.0.234-238,192.168.0.245 100 | # or 101 | #localip 192.168.0.234-238,192.168.0.245 102 | #remoteip 192.168.1.234-238,192.168.1.245 103 | -------------------------------------------------------------------------------- /lib/support/pptp_vpn/ubuntu/rc.local: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/sh -e 3 | # 4 | # rc.local 5 | # 6 | # This script is executed at the end of each multiuser runlevel. 7 | # Make sure that the script will "exit 0" on success or any other 8 | # value on error. 9 | # 10 | # In order to enable or disable this script just change the execution 11 | # bits. 12 | # 13 | # By default this script does nothing. 14 | 15 | iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE 16 | iptables -A FORWARD -p tcp --syn -s 192.168.0.0/24 -j TCPMSS --set-mss 1356 17 | exit 0 18 | -------------------------------------------------------------------------------- /lib/support/pptp_vpn/ubuntu/sysctl.conf: -------------------------------------------------------------------------------- 1 | # 2 | # /etc/sysctl.conf - Configuration file for setting system variables 3 | # See /etc/sysctl.d/ for additional system variables. 4 | # See sysctl.conf (5) for information. 5 | # 6 | 7 | #kernel.domainname = example.com 8 | 9 | # Uncomment the following to stop low-level messages on console 10 | #kernel.printk = 3 4 1 3 11 | 12 | ##############################################################3 13 | # Functions previously found in netbase 14 | # 15 | 16 | # Uncomment the next two lines to enable Spoof protection (reverse-path filter) 17 | # Turn on Source Address Verification in all interfaces to 18 | # prevent some spoofing attacks 19 | #net.ipv4.conf.default.rp_filter=1 20 | #net.ipv4.conf.all.rp_filter=1 21 | 22 | # Uncomment the next line to enable TCP/IP SYN cookies 23 | # See http://lwn.net/Articles/277146/ 24 | # Note: This may impact IPv6 TCP sessions too 25 | #net.ipv4.tcp_syncookies=1 26 | 27 | # Uncomment the next line to enable packet forwarding for IPv4 28 | fs.file-max=51200 29 | net.ipv4.ip_forward=1 30 | 31 | # Uncomment the next line to enable packet forwarding for IPv6 32 | # Enabling this option disables Stateless Address Autoconfiguration 33 | # based on Router Advertisements for this host 34 | #net.ipv6.conf.all.forwarding=1 35 | 36 | 37 | ################################################################### 38 | # Additional settings - these settings can improve the network 39 | # security of the host and prevent against some network attacks 40 | # including spoofing attacks and man in the middle attacks through 41 | # redirection. Some network environments, however, require that these 42 | # settings are disabled so review and enable them as needed. 43 | # 44 | # Do not accept ICMP redirects (prevent MITM attacks) 45 | #net.ipv4.conf.all.accept_redirects = 0 46 | #net.ipv6.conf.all.accept_redirects = 0 47 | # _or_ 48 | # Accept ICMP redirects only for gateways listed in our default 49 | # gateway list (enabled by default) 50 | # net.ipv4.conf.all.secure_redirects = 1 51 | # 52 | # Do not send ICMP redirects (we are not a router) 53 | #net.ipv4.conf.all.send_redirects = 0 54 | # 55 | # Do not accept IP source route packets (we are not a router) 56 | #net.ipv4.conf.all.accept_source_route = 0 57 | #net.ipv6.conf.all.accept_source_route = 0 58 | # 59 | # Log Martian Packets 60 | #net.ipv4.conf.all.log_martians = 1 61 | # 62 | 63 | # Digital Ocean Recommended Settings: 64 | net.core.wmem_max=12582912 65 | net.core.rmem_max=12582912 66 | net.ipv4.tcp_rmem= 10240 87380 12582912 67 | net.ipv4.tcp_wmem= 10240 87380 12582912 68 | 69 | 70 | # Digital Ocean Recommended Settings: 71 | net.core.wmem_max=12582912 72 | net.core.rmem_max=12582912 73 | net.ipv4.tcp_rmem= 10240 87380 12582912 74 | net.ipv4.tcp_wmem= 10240 87380 12582912 75 | 76 | 77 | # Digital Ocean Recommended Settings: 78 | net.core.wmem_max=12582912 79 | net.core.rmem_max=12582912 80 | net.ipv4.tcp_rmem= 10240 87380 12582912 81 | net.ipv4.tcp_wmem= 10240 87380 12582912 82 | 83 | 84 | # Digital Ocean Recommended Settings: 85 | net.core.wmem_max=12582912 86 | net.core.rmem_max=12582912 87 | net.ipv4.tcp_rmem= 10240 87380 12582912 88 | net.ipv4.tcp_wmem= 10240 87380 12582912 89 | 90 | 91 | # Digital Ocean Recommended Settings: 92 | net.core.wmem_max=12582912 93 | net.core.rmem_max=12582912 94 | net.ipv4.tcp_rmem= 10240 87380 12582912 95 | net.ipv4.tcp_wmem= 10240 87380 12582912 96 | 97 | 98 | # Digital Ocean Recommended Settings: 99 | net.core.wmem_max=12582912 100 | net.core.rmem_max=12582912 101 | net.ipv4.tcp_rmem= 10240 87380 12582912 102 | net.ipv4.tcp_wmem= 10240 87380 12582912 103 | -------------------------------------------------------------------------------- /lib/support/zsh/.zshrc: -------------------------------------------------------------------------------- 1 | # Path to your oh-my-zsh installation. 2 | export ZSH=$HOME/.oh-my-zsh 3 | 4 | # Set name of the theme to load. 5 | # Look in ~/.oh-my-zsh/themes/ 6 | # Optionally, if you set this to "random", it'll load a random theme each 7 | # time that oh-my-zsh is loaded. 8 | ZSH_THEME="robbyrussell" 9 | 10 | 11 | # Uncomment the following line to use case-sensitive completion. 12 | # CASE_SENSITIVE="true" 13 | 14 | # Uncomment the following line to disable bi-weekly auto-update checks. 15 | # DISABLE_AUTO_UPDATE="true" 16 | 17 | # Uncomment the following line to change how often to auto-update (in days). 18 | # export UPDATE_ZSH_DAYS=13 19 | 20 | # Uncomment the following line to disable colors in ls. 21 | # DISABLE_LS_COLORS="true" 22 | 23 | # Uncomment the following line to disable auto-setting terminal title. 24 | # DISABLE_AUTO_TITLE="true" 25 | 26 | # Uncomment the following line to enable command auto-correction. 27 | # ENABLE_CORRECTION="true" 28 | 29 | # Uncomment the following line to display red dots whilst waiting for completion. 30 | # COMPLETION_WAITING_DOTS="true" 31 | 32 | # Uncomment the following line if you want to disable marking untracked files 33 | # under VCS as dirty. This makes repository status check for large repositories 34 | # much, much faster. 35 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 36 | 37 | # Uncomment the following line if you want to change the command execution time 38 | # stamp shown in the history command output. 39 | # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 40 | # HIST_STAMPS="mm/dd/yyyy" 41 | 42 | # Would you like to use another custom folder than $ZSH/custom? 43 | # ZSH_CUSTOM=/path/to/new-custom-folder 44 | 45 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 46 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 47 | # Example format: plugins=(rails git textmate ruby lighthouse) 48 | # Add wisely, as too many plugins slow down shell startup. 49 | plugins=(zle-vi-visual vi-mode git-prompt autojump history history-substring-search jump sudo) 50 | #plugins=(zle-vi-visual vi-mode git-prompt django pip z autojump autopep8 copyfile history history-substring-search jump tmuxinator web-search sudo) 51 | #plugins=(git-prompt django pip z autojump autopep8 copyfile history-substring-search jump tmuxinator web-search sudo) 52 | 53 | 54 | source $ZSH/oh-my-zsh.sh 55 | 56 | 57 | [[ -s ~/.autojump/etc/profile.d/autojump.zsh ]] && . ~/.autojump/etc/profile.d/autojump.zsh 58 | 59 | source ~/opensource/zsh-git-prompt/zshrc.sh 60 | source ~/opensource/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 61 | source ~/opensource/zsh-history-substring-search/zsh-history-substring-search.zsh 62 | 63 | bindkey -M vicmd 'k' history-substring-search-up 64 | bindkey -M vicmd 'j' history-substring-search-down 65 | 66 | #zmodload zsh/terminfo 67 | #bindkey "$terminfo[kcuu1]" history-substring-search-up 68 | #bindkey "$terminfo[kcud1]" history-substring-search-down 69 | # an example prompt 70 | PROMPT='$fg[red]%}%n@%m%{$fg[green]%}:%B%~%b$(git_super_status) %# ' 71 | 72 | # User configuration 73 | export PATH=~/Dropbox/BackUp/bin:~/opensource/mongodb/bin:$PATH 74 | export PYTHONPATH=~/togic:~/togic/warehouse:$PYTHONPATH 75 | 76 | export PATH=~/opensource/phpfarm/inst/current-bin:~/opensource/phpfarm/inst/bin:~/.dropbox-dist:$HOME/bin:/usr/local/bin:$PATH 77 | 78 | # export MANPATH="/usr/local/man:$MANPATH" 79 | 80 | # You may need to manually set your language environment 81 | # export LANG=en_US.UTF-8 82 | 83 | # Preferred editor for local and remote sessions 84 | # if [[ -n $SSH_CONNECTION ]]; then 85 | # export EDITOR='vim' 86 | # else 87 | # export EDITOR='mvim' 88 | # fi 89 | export EDITOR='vim' 90 | 91 | # Compilation flags 92 | # export ARCHFLAGS="-arch x86_64" 93 | 94 | # ssh 95 | # export SSH_KEY_PATH="~/.ssh/dsa_id" 96 | 97 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 98 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 99 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 100 | # For a full list of active aliases, run `alias`. 101 | # 102 | # Example aliases 103 | # alias zshconfig="mate ~/.zshrc" 104 | # alias ohmyzsh="mate ~/.oh-my-zsh" 105 | export PHPBREW_SET_PROMPT=1 106 | 107 | #source ~/.phpbrew/bashrc 108 | 109 | alias ls="ls -l" 110 | alias ga="git add" 111 | alias gco="git checkout" 112 | alias gc="git commit" 113 | alias gs="git status" 114 | alias composer="php ~/opensource/composer.phar " 115 | function take () { 116 | mkdir $1 117 | cd $1 118 | } 119 | 120 | function server () { 121 | if [ $1 ] 122 | then 123 | local port="$1" 124 | else 125 | local port="8000" 126 | fi 127 | open "http://localhost:$port" && python -m SimpleHTTPServer "$port" 128 | } 129 | 130 | # Search google for the given keywords. 131 | function google; { 132 | $VIEW "http://www.google.com/search?q=`url-encode "${(j: :)@}"`" 133 | } 134 | export NODE_PATH="/usr/local/lib/node_modules" 135 | -------------------------------------------------------------------------------- /quick-install/mac/upload-sshkey.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ssh-keygen -t rsa 3 | brew install ssh-copy-id 4 | ssh-copy-id chuck@104.236.51.112 5 | ssh chuck@104.236.51.112 6 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-ftp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo apt-get update 3 | sudo apt-get --yes install wget vsftpd 4 | sudo useradd "$1" 5 | sudo mkdir "/home/$1" 6 | sudo chown "$1:$1" "/home/$1" 7 | sudo bash -c "echo '$1:$2' | /usr/sbin/chpasswd" 8 | sudo rm /etc/pam.d/vsftpd 9 | sudo wget https://raw.githubusercontent.com/seaify/tools/master/files/vsftpd.conf -O /etc/vsftpd.conf 10 | sudo service vsftpd restart 11 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-gem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo apt-get -y install ruby ruby1.9.1-dev 3 | mkdir ~/opensource 4 | cd ~/opensource 5 | wget http://production.cf.rubygems.org/rubygems/rubygems-2.4.6.zip 6 | unzip rubygems-2.4.6.zip 7 | cd rubygems-2.4.6 8 | sudo ruby setup.rb 9 | sudo gem install bundler 10 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-phpmyadmin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sudo apt-get --yes install nginx 4 | sudo apt-get -y install php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql php5-gd php-apc php5-common 5 | 6 | #modify mysql.ini 7 | sed -i'' -e '/bind-address/d' /etc/mysql/my.cnf 8 | 9 | #wget nginx default 10 | sudo wget https://raw.githubusercontent.com/seaify/tools/master/files/nginx.phpmyadmin.default -O /etc/nginx/sites-enabled/default 11 | 12 | #download phpmyadmin files 13 | cd /usr/share/nginx/html 14 | sudo wget http://superb-dca2.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.4.8/phpMyAdmin-4.4.8-all-languages.tar.bz2 15 | sudo tar xvf phpMyAdmin-4.4.8-all-languages.tar.bz2 16 | sudo mv phpMyAdmin-4.4.8-all-languages phpmyadmin 17 | 18 | sudo service nginx reload 19 | sudo service php5-fpm restart 20 | 21 | ##test with http://ip/phpmyadmin, or http://localhost/phpmyadmin 22 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-pip-1.3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | curl -O https://pypi.python.org/packages/source/p/pip/pip-1.3.tar.gz 3 | tar xvfz pip-1.3.tar.gz 4 | cd pip-1.3 5 | sudo python setup.py install 6 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-pptp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #for ubuntu14.04 3 | sudo apt-get install --yes pptpd pptp-linux 4 | sudo wget https://raw.githubusercontent.com/seaify/tools/master/files/pptpd.conf -O /etc/pptpd.conf 5 | sudo wget https://raw.githubusercontent.com/seaify/tools/master/files/pptpd-options -O /etc/ppp/pptpd-options 6 | sudo bash -c "echo '$1 * $2 *' >> /etc/ppp/chap-secrets" 7 | sudo wget https://raw.githubusercontent.com/seaify/tools/master/files/sysctl.conf -O /etc/sysctl.conf 8 | sudo wget https://raw.githubusercontent.com/seaify/tools/master/files/rc.local -O /etc/rc.local 9 | sudo modprobe nf_conntrack_proto_gre nf_conntrack_pptp 10 | sudo /etc/init.d/pptpd restart 11 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-quick-dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo apt-add-repository ppa:brightbox/ruby-ng 3 | sudo apt-get update 4 | sudo apt-get install --yes unzip build-essential mysql-client-5.5 python-mysqldb libxml2-dev libxslt1-dev python-dev redis-server nginx gcc python-pip python-lxml python-tk watchdog ruby2.2 ruby2.2-dev rubygems-integration 5 | sudo gem install nokogiri -v '1.6.6.2' 6 | sudo useradd $1 7 | sudo mkdir "/home/$1" 8 | sudo chown "$1:$1" "/home/$1" 9 | sudo echo "$1:$2" | /usr/sbin/chpasswd 10 | sudo adduser $1 sudo 11 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-zsh.sh | sh 12 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-pip-1.3.sh | sh 13 | sudo pip install werkzeug jinja2 celery service_identity scrapy beautifulsoup4 wechat_sdk supervisor gunicorn flask redis 14 | sudo mkdir -p /etc/supervisord/conf.d 15 | sudo wget https://raw.githubusercontent.com/seaify/tools/master/files/supervisord.conf -O /etc/supervisord.conf 16 | wget https://raw.githubusercontent.com/seaify/tools/master/files/.gitconfig -O ~/.gitconfig 17 | wget https://raw.githubusercontent.com/seaify/tools/master/files/.vimrc -O ~/.vimrc 18 | sudo wget https://gist.github.com/howthebodyworks/176149/raw/88d0d68c4af22a7474ad1d011659ea2d27e35b8d/supervisord.sh -O /etc/init.d/supervisord 19 | sudo chmod +x /etc/init.d/supervisord 20 | sudo update-rc.d supervisord defaults 21 | sudo service supervisord restart 22 | #mysql-server-5.5 23 | 24 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-scrapy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #for ubuntu 3 | apt-get update 4 | apt-get install --yes gcc python-pip build-essential libxml2-dev libxslt1-dev python-dev python-lxml 5 | pip install service_identity 6 | pip install scrapy 7 | pip install beautifulsoup4 8 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-shadowsock-server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo apt-get update 3 | sudo apt-get --yes install python-pip python-m2crypto supervisor build-essential python-dev 4 | sudo pip install shadowsocks gevent 5 | ip=$(curl http://icanhazip.com/) 6 | echo $ip 7 | sudo bash -c "curl -X POST http://template.seaify.com/get_template --data 'template_id=1&server=$ip&password=$1' > /etc/shadowsocks-config.json" 8 | config="\n[program:shadowsocks]\ncommand=ssserver -c /etc/shadowsocks-config.json\nautorestart=true\nuser=root" 9 | echo $config > /tmp/shadowsocks.conf 10 | sudo cp /tmp/shadowsocks.conf /etc/supervisor/conf.d/shadowsocks.conf 11 | #how? 12 | #sudo bash -c "echo -e $config > /etc/supervisor/conf.d/shadowsocks.conf" 13 | sudo service supervisor restart 14 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-simpleserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo apt-get --yes install nginx python-pip python-m2crypto supervisor build-essential python-dev 3 | BASEDIR="$PWD" 4 | CURRENT=$(basename $BASEDIR) 5 | PORT=8080 6 | echo $2 7 | if [ ! -z "$2" ] 8 | then 9 | PORT=$2 10 | fi 11 | echo $CURRENT 12 | sudo bash -c "curl -X POST http://template.seaify.com/get_template --data 'template_id=2&domain=$1&port=$PORT' > /etc/nginx/sites-enabled/$CURRENT.conf" 13 | config="\n[program:$CURRENT]\ncommand=python -m SimpleHTTPServer $PORT\nautorestart=true\ndirectory=$BASEDIR\nuser=root" 14 | echo $config > /tmp/$CURRENT.conf 15 | sudo mv /tmp/$CURRENT.conf /etc/supervisor/conf.d/$CURRENT.conf 16 | sudo service nginx reload 17 | sudo service supervisor restart 18 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-vagrant.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb 3 | sudo dpkg -i vagrant_1.7.2_x86_64.deb 4 | wget http://download.virtualbox.org/virtualbox/4.3.20/virtualbox-4.3_4.3.20-96996~Ubuntu~raring_amd64.deb 5 | sudo dpkg -i virtualbox-4.3_4.3.20-96996\~Ubuntu\~raring_amd64.deb 6 | sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian trusty contrib" >> /etc/apt/sources.list' 7 | sudo apt-get update 8 | sudo apt-get install virtualbox-4.3 9 | -------------------------------------------------------------------------------- /quick-install/ubuntu/install-zsh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo apt-get update 3 | sudo apt-get --yes install git zsh autojump 4 | mkdir ~/opensource 5 | cd ~/opensource 6 | git clone https://github.com/robbyrussell/oh-my-zsh ~/.oh-my-zsh 7 | git clone https://github.com/zsh-users/zsh-syntax-highlighting.git 8 | git clone https://github.com/zsh-users/zsh-history-substring-search.git 9 | git clone https://github.com/olivierverdier/zsh-git-prompt.git 10 | cd ~ 11 | wget https://raw.githubusercontent.com/seaify/tools/master/files/.zshrc -O ~/.zshrc 12 | sudo chsh -s $(which zsh) 13 | zsh 14 | -------------------------------------------------------------------------------- /quick-install/ubuntu/quick-logrotate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sudo apt-get install --yes logrotate 4 | 5 | format=" {\n 6 | copytruncate\n 7 | dateext\n 8 | daily\n 9 | rotate 7\n 10 | compress\n 11 | missingok\n 12 | } "; 13 | 14 | slash="*" 15 | 16 | cpath=$(pwd) 17 | 18 | content="$cpath""/$slash""$1""$format" 19 | file_name=$(basename $cpath) 20 | if [ ! -z "$2" ] 21 | then 22 | file_name=$2 23 | fi 24 | config_path="/etc/logrotate.d/$file_name" 25 | echo $file_name 26 | echo $1 27 | echo $2 28 | echo $content 29 | echo $content > /tmp/test 30 | sudo mv /tmp/test $config_path 31 | sudo /usr/sbin/logrotate -f $config_path 32 | -------------------------------------------------------------------------------- /rules/后台开发经验.md: -------------------------------------------------------------------------------- 1 | # 后台开发原则篇 2 | 3 | 1. 代码里不要直接去写sql语句, 使用orm,如使用python的同学用sqlalchemy 4 | 5 | 2. 假设系统一定会出现异常,不想当然,做一些定时任务,对关键点进行检测,如是否有用户已付款却迟迟未发货,检测到这种情况,发送短信通知给开发者, 开发者提前知道,要比用户,或运营同学察觉到后来告诉你好很多 6 | 7 | 3. 使用nodejs的同学,不要使用console.log, 而且还大量使用,日志大,信息量大的情况下,无法区分出我们想看的日志信息。建议使用[debug](https://github.com/visionmedia/debug), 终端下日志输出有颜色,而且能提供过滤条件,开发者间相互的日志互不干扰 8 | 9 | 4. 对于单个数据库,只应该有一个应用去直接读取该数据库,然后通过api暴露相应的数据。如果多个应用直接去读取数据库,假设某天数据库需要迁移,如换机房,那其它应用全挂,还都得改代码 10 | 11 | 5. 代码里,对于关键点,检查函数返回值,若未正常执行,抛出错误日志,甚至发送邮件提醒(保证实时知道异常情况) 12 | 13 | 6. 使用logrotate来处理压缩日志,别二逼的自己写脚本来删除日志,重点注意nginx的日志,程序的日志如tomcat,nodejs,日志必须处理好,不然因为空间不足,程序无法运行,会很烦人。 14 | 15 | 7. 公司内部,应对各语言建立相应的utils包,避免代码重复。 16 | 17 | 8. 公司内部,建立相应的公共服务,如短信,email,可单独抽离出 18 | 19 | 9. 公司内部,对于项目,应该持续维护wiki -------------------------------------------------------------------------------- /simpletool.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = 'simpletool' 3 | s.version = '0.0.4' 4 | s.date = '2016-10-05' 5 | s.summary = "convience simple tools for ubuntu" 6 | s.description = "provide quick install command for pptp vpn, shadowsocks server, phpmyadmin, oh-my-zsh" 7 | s.authors = ["seaify"] 8 | s.email = 'dilin.life@gmail.com' 9 | s.files = Dir["lib/simpletool.rb", "lib/support/**/**/*"] 10 | s.homepage = 'https://github.com/seaify/simpletool' 11 | s.license = 'MIT' 12 | 13 | s.executables << 'simpletool' 14 | 15 | s.add_development_dependency 'rspec', '~> 3.3' 16 | s.add_dependency 'thor', '~> 0.14' 17 | s.add_dependency 'awesome_print', '~> 1.6' 18 | end 19 | -------------------------------------------------------------------------------- /textexpander/add_sudo_user.textexpander: -------------------------------------------------------------------------------- 1 | sudo useradd %filltext:name=name:default=chuck% 2 | sudo mkdir /home/%filltext:name=name:default=chuck% 3 | sudo chown %filltext:name=name:default=chuck%:%filltext:name=name:default=chuck% /home/%filltext:name=name:default=chuck% 4 | sudo bash -c "echo '%filltext:name=name:default=chuck%:%filltext:name=passwd:default=lsm123%' | /usr/sbin/chpasswd" 5 | sudo adduser %filltext:name=name:default=chuck% sudo 6 | -------------------------------------------------------------------------------- /textexpander/ftime.textexpander: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | import datetime 6 | 7 | arg = int((%clipboard)) 8 | timeArray = time.localtime(arg) 9 | ptime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray) 10 | print ptime 11 | 12 | -------------------------------------------------------------------------------- /textexpander/ip.textexpander: -------------------------------------------------------------------------------- 1 | curl http://icanhazip.com/ 2 | -------------------------------------------------------------------------------- /textexpander/jsonp.textexpander: -------------------------------------------------------------------------------- 1 | jquery.ajax({ 2 | url: "%clipboard", 3 | dataType: "jsonp", 4 | success: function(data){ 5 | console.log(data); 6 | %| 7 | }}); 8 | -------------------------------------------------------------------------------- /textexpander/nginx.textexpander: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | server_name %filltext:name=name:default=proxy%.seaify.com; 5 | access_log /var/log/nginx/%filltext:name=name:default=proxy%_access.log; 6 | error_log /var/log/nginx/%filltext:name=name:default=proxy%_error.log; 7 | 8 | 9 | location / { 10 | proxy_pass http://127.0.0.1:%filltext:name=port:default=5000%; 11 | proxy_set_header Host $host; 12 | proxy_set_header X-Real-IP $remote_addr; 13 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /textexpander/supervisord.textexpander: -------------------------------------------------------------------------------- 1 | [program:%filltext:name=name:default=proxy%] 2 | command=%clipboard 3 | directory=%filltext:name=dir:default=~% 4 | user=%filltext:name=user:default=root% 5 | -------------------------------------------------------------------------------- /textexpander/time.textexpander: -------------------------------------------------------------------------------- 1 | 2 | #!/usr/bin/env python 3 | 4 | import sys, time 5 | 6 | now = int(time.time()) 7 | 8 | print now 9 | 10 | -------------------------------------------------------------------------------- /textexpander/zsh.textexpander: -------------------------------------------------------------------------------- 1 | curl https://raw.githubusercontent.com/seaify/tools/master/quick-install/ubuntu/install-zsh.sh | sh 2 | --------------------------------------------------------------------------------