This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > wrk是一款现代HTTP基准测试工具,能够在单个多核CPU上运行时产生显着负载。它将多线程设计与可扩展事件通知系统(如epoll和kqueue)结合在一起。 | |
| #### 基本用法 | |
| 使用12个线程运行30秒的基准测试,并保持400个HTTP连接处于打开状态 | |
| ``` | |
| wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html | |
| ``` | |
| 输出 | |
| ``` | |
| Running 30s test @ http://127.0.0.1:8080/index.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### 查找定位 | |
| ``` | |
| esc 退出编辑模式,进入指令模式 | |
| h 光标左移。或者Backspace | |
| l 光标右移。或者space | |
| k 光标上移一行 | |
| j 光标下移一行 | |
| ) 光标移至句尾 | |
| ( 光标移至句首 | |
| } 光标移至段落开头 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| //须先引用 | |
| use Illuminate\Support\Facades\Validator; | |
| ``` | |
| ``` | |
| //验证栗子 | |
| $validator = Validator::make($request->all(), [ | |
| 'phone_num' => 'required|regex:/^1[34578][0-9]{9}$/', | |
| 'code' => 'required', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##### 安装`hiredis` | |
| * hiredis下载地址:[https://github.com/redis/hiredis/releases](https://github.com/redis/hiredis/releases) | |
| ``` | |
| 编译安装 | |
| ☁ ~ unzip hiredis-0.13.3 | |
| ☁ ~ cd hiredis-0.13.3 | |
| ☁ hiredis-0.13.3 make -j | |
| ☁ hiredis-0.13.3 sudo make install | |
| ``` | |
| ##### 重新编译`swoole`,加入`--enable-async-redis` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 官方文档:https://docs.golaravel.com/docs/5.5/passport/ | |
| > Laravel使用Laravel Passport轻松实现API身份验证,Laravel Passport在几分钟内就可以为Laravel应用程序提供完整的OAuth2服务器实现 | |
| composer安装 | |
| ``` | |
| composer require laravel/passport | |
| ``` | |
| 不过很多时候因为php版本的原因无法安装,就需要在`composer.json`--`require`中添加 | |
| ``` | |
| "laravel/passport": "4.0.3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### 前提 | |
| 1.替换php源代码 | |
| > MAMP里面PHP源码是残缺的,所以需要自己下载PHP源码编译,因为php5.6和7.0都会用到,所以特将这两个版本的源码下载 | |
| php-5.6.链接: http://cn2.php.net/get/php-5.6.34.tar.gz/from/this/mirror | |
| php-7.0链接: http://cn2.php.net/get/php-7.0.28.tar.gz/from/this/mirror | |
| 进入php安装目录,并将原php重命名(以php7.0.27为例) | |
| ``` | |
| ☁ ~ cd /Applications/MAMP/bin/php/php7.0.27/include | |
| ☁ include mv php php.old |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ###### 1、`mysql`加入环境变量 | |
| ``` | |
| ☁ ~ sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql | |
| ``` | |
| ###### 2、`apache`加入环境变量 | |
| ``` | |
| ☁ ~ sudo ln -s /Applications/MAMP/Library/bin/httpd /usr/local/bin/httpd | |
| ``` | |
| ###### 3、`php`加入环境变量 | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 在`/usr/local/bin`目录下新建脚本`item2login.sh` | |
| ``` | |
| #!/usr/bin/expect | |
| set timeout 30 | |
| spawn ssh -p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2] | |
| expect { | |
| "(yes/no)?" | |
| {send "yes\n";exp_continue} | |
| "password:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 以前尝试部署代码到服务器的方式有用到Github Hook或者ftp,但使用起来都有各自的缺陷,然后就发现了git hooks这个方法,查了一些资料再自己尝试过后,觉得还不错,记录下简单流程。 | |
| ### 在服务器初始化一个远程git仓库 | |
| ##### `git init` 和 `git init --bare` 的区别 | |
| 初始化出来的仓库是不一样的,前者初始化的是一个普通的仓库,其中 `.git` 文件夹是隐藏的,并且能看见该仓库下所有的源码。而后者初始化出来的仓库中的文件,就是 `.git` 中的文件夹,但不能像前者那样直接浏览或修改仓库中的代码。 | |
| ##### 使用 `git init --bare` 初始化一个远程仓库。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sublime Text 3(以下简称 ST3)作为轻量级文本编辑器是很不错的,打开速度要比 VS Code 快不少,而且能够自动记住当前打开及尚未保存的文件。VS Code 中有一款通过 GitHub 的 GIST 在不同计算机同步设置与扩展的扩展`Settings Sync`,ST3中也有类似的扩展(但是只能同步设置),以下为安装与配置步骤: | |
| 打开 ST3,按住`Ctrl+Shift+P`,输入`Install`,并选择下图 1 中第一项。 | |
|  | |
| 图 1 |
OlderNewer