February 8, 2018
Docker Machine 简介
"\u003cp\u003e一句话概括的话就是 Docker Machine是一个可以方便对多个宿主服务器中的多个容器进行管理的工具。\u003c/p\u003e\n\u003cp\u003eDocker 与 Docker Machine 的区别 \u003ca href=\"https://www.cnblogs.com/sparkdev/p/7066789.html\"\u003ehttps://www.cnblogs.com/sparkdev/p/7066789.html\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eDocker Machine 工具出现的意义 \u003ca href=\"https://www.2cto.com/net/201707/660864.html\"\u003ehttps://www.2cto.com/net/201707/660864.html\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eDocker Machine 用法 \u003ca href=\"http://www.linuxidc.com/Linux/2017-06/145232.htm\"\u003ehttp://www.linuxidc.com/Linux/2017-06/145232.htm\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eDocker Machine 命令 \u003ca href=\"http://blog.csdn.net/warren_1992/article/details/51451522\"\u003ehttp://blog.csdn.net/warren_1992/article/details/51451522\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eMac平台上Docker安装与使用 \u003ca href=\"http://blog.csdn.net/warren_1992/article/details/51451522\"\u003ehttp://blog.csdn.net/warren_1992/article/details/51451522\u003c/a\u003e\u003c/p\u003e"
February 8, 2018
windows平台在dos下执行docker pull 命令出错
"\u003cp\u003e\u003cstrong\u003e这里docker Machine 是安装和管理 Docker 的工具(用来代替Boot2Docker,对于个人玩的话,不建议使用docker Machine,毕竟多了一个虚拟层,不如直接使用当前物理机器作为容器的宿主机)\u003c/strong\u003e\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e$ docker pull gitlab/gitlab-ce:latest\n\u003c/code\u003e\u003c/pre\u003e\u003cblockquote\u003e\n\u003cp\u003eWarning: failed to get default registry endpoint from daemon (error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.33/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the …\u003c/p\u003e\u003c/blockquote\u003e"
January 26, 2018
利用“码云gitee”的钩子实现git仓库自动更新
"\u003cp\u003e使用git时,传统发布方式是手动将新代码 上传到远程仓库,然后在登录服务器执行git pull命令拉取最新的代码,这种操作如果频繁更新的话,我们可以利用git的钩子来实现自动 部署 功能。\u003c/p\u003e\n\u003cp\u003e前提:\nlinux\nphp (gitpull.php)\nnginx 运行用户为 www\u003c/p\u003e\n\u003cp\u003e注意网站 gitpull.php 文件权限问题,还有是否有shell_exec 命令的执行权限\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e一、先创建自动部署用户的密钥\u003c/strong\u003e\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003esudo - www\nssh-keygen -t rsa -C \u0026#34;syadmin@gmail.com\u0026#34;\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e\u003cstrong\u003e二、将用户www生成的公钥添加到码云后台\u003c/strong\u003e\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003ecat ~/.ssh/id_rsa.pub\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e\u003cstrong\u003e三、将码云域名gitee.com 添加到授权白名单\u003c/strong\u003e\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003essh-keyscan -t rsa gitee.com \u0026gt;\u0026gt; ~/.ssh/known_hosts\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e或者以www用户执行一次gitpull命令\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003esudo - www\ncd /data/wwwroot/www\ngit pull\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e根据提示,输入 yes 即可。\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e四、在码云的部署钩子里进行url设置\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eurl …\u003c/p\u003e"
December 14, 2017
vux中实现自定义皮肤
"\u003cp\u003e有时候我们需要根据自己的需要对 weui默认的颜色进行修改,如果在每个单面里修改的过过于麻烦,我们可以使用一个less配置文件来实现对默认配置进行重置。\u003c/p\u003e\n\u003cp\u003e修改 webpack.base.conf.js 文件,找到\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003emodule.exports = vuxLoader.merge(webpackConfig, {\n plugins: [\u0026#39;vux-ui\u0026#39;, \u0026#39;progress-bar\u0026#39;, \u0026#39;duplicate-style\u0026#39;, ]\n})\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e修改如下:\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003emodule.exports = vuxLoader.merge(webpackConfig, {\n plugins: [\u0026#39;vux-ui\u0026#39;, \u0026#39;progress-bar\u0026#39;, \u0026#39;duplicate-style\u0026#39;, {\n name: \u0026#39;less-theme\u0026#39;,\n path: \u0026#39;src/theme.less\u0026#39;\n }]\n})\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e然后在项目的 src 目录里创建文件 theme.less, …\u003c/p\u003e"
December 13, 2017
CSS3 利用@media screen实现网页布局的自适应,样式顺序
"\u003cp\u003e利用@media screen可以适应不同屏幕大小,做出相应的界面调整;\u003c/p\u003e\n\u003cp\u003e在css中@media (min-width: 768px)表示最小是768也就是\u0026gt;=768;\u003c/p\u003e\n\u003cp\u003e@media (min-width: 768px){ //\u0026gt;=768的设备 }\u003c/p\u003e\n\u003cp\u003e@media (min-width: 992px){ //\u0026gt;=992的设备 }\u003c/p\u003e\n\u003cp\u003e@media (min-width: 1200){ //\u0026gt;=1200的设备 }\u003c/p\u003e\n\u003cp\u003e注意下顺序,如果你把@media (min-width: 768px)写在了下面那么很悲剧,\u003c/p\u003e\n\u003cp\u003e@media (min-width: 1200){ //\u0026gt;=1200的设备 }@media (min-width: 992px){ //\u0026gt;=992的设备 }@media (min-width: 768px){ //\u0026gt;=768的设备 }因为如果是1440,由于1440\u0026gt;768那么你的1200就会失效。\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e所以我们用min-width时,小的放上面大的在下面,同理如果是用max-width那么就是大的在上面,小的在下面\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e@media …\u003c/p\u003e"
November 19, 2017
centos 下安装 certbot 常见问题
"\u003cp\u003e上一篇( \u003ca href=\"https://blog.haohtml.com/archives/17422\"\u003ehttps://blog.haohtml.com/archives/17422\u003c/a\u003e)我们介绍了centos下安装certbot的方法,但有时间服务器环境不一样,总会遇到一些问题,常见问题如下:\u003c/p\u003e\n\u003cp\u003ecentos7.5下安装certbot常见问题\u003c/p\u003e\n\u003cp\u003e一、出错”ImportError: ‘pyOpenSSL’ module missing required functionality. Try upgrading to v0.14 or newer.“\n解决办法:\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003esudo pip uninstall pyOpenssl\nsudo pip install pyOpenSSL==0.14.0\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e查看版本:\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003epip show pyOpenssl\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e一、出错信息为“certbot AttributeError: ‘module’ object has no attribute ‘SSL_ST_INIT’”\u003c/p\u003e\n\u003cp\u003e解决办法:\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003epip uninstall pyOpenSSL\npip install pyOpenSSL==16.2.0\n\u003c/code\u003e\u003c/pre\u003e"
October 17, 2017
php的Pdo扩展实现类似mysql_ping的方法
"\u003cp\u003e在php里Pdo是没有mysql_ping和mysqli_ping函数的,可以使用以下方法来代替它\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003eclass NPDO {\n private $pdo;\n private $params;\n\n public function __construct() {\n $this-\u0026gt;params = func_get_args();\n $this-\u0026gt;init();\n }\n\n public function __call($name, array $args) {\n return call_user_func_array(array($this-\u0026gt;pdo, $name), $args);\n }\n\n // The ping() will try to reconnect once if connection lost.\n public function ping() {\n try {\n $this-\u0026gt;pdo-\u0026gt;query(\u0026#39;SELECT …\u003c/code\u003e\u003c/pre\u003e"
July 11, 2017
几个定时备份mysql的shell脚本
"\u003cp\u003e\u003ca href=\"http://www.cnblogs.com/freespider/p/5425172.html\"\u003ehttp://www.cnblogs.com/freespider/p/5425172.html\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"http://88250.b3log.org/backup-mysql-shell\"\u003ehttp://88250.b3log.org/backup-mysql-shell\u003c/a\u003e\u003c/p\u003e"
June 23, 2017
批量结束linux进程
"\u003cp\u003e这里 `php timer.php`` 进程是使用swoole来搞的一个crond服务,用来定时采集一些数据\u003c/p\u003e\n\u003cp\u003e用ps显示的有以下进程\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003eroot 6583 0.0 0.2 219676 4872 ? Ss 10:46 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)\nwww 7076 2.7 1.0 304928 19920 ? S 11:32 0:05 php-fpm: pool www\nwww 7077 3.0 1.4 312964 26940 ? S 11:32 0:05 php-fpm: pool www\nwww 7117 2.5 1.2 310668 23724 ? S 11:35 0:01 php-fpm: pool www\nroot 7121 0.0 0.2 331188 4500 ? Ssl 11:36 0:00 php timer.php\nroot 7122 0.0 0.2 257012 4168 ? S 11:36 0:00 php timer.php\nroot 7124 0.0 0.2 …\u003c/code\u003e\u003c/pre\u003e"
June 23, 2017
swoole模块及使用场景
"\u003cp\u003e一、多任务及多进程: 用来大量采集数据时使用,再利用多进程提高效率\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"http://blog.csdn.net/koastal/article/details/52871316\"\u003ehttp://blog.csdn.net/koastal/article/details/52871316\u003c/a\u003e \u003ca href=\"http://www.tuicool.com/articles/ZFNFvqm\"\u003ehttp://www.tuicool.com/articles/ZFNFvqm\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e二、定时任务\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://github.com/LinkedDestiny/swoole-doc/blob/master/src/03/swoole_timer_server.php\"\u003ehttps://github.com/LinkedDestiny/swoole-doc/blob/master/src/03/swoole_timer_server.php\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eswoole新版本已经废除掉了 timer 指令,请使用 swoole_timer_tick 代替。参考:\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://wiki.swoole.com/wiki/page/480.html\"\u003ehttps://wiki.swoole.com/wiki/page/480.html\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e或\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://wiki.swoole.com/wiki/page/414.html\"\u003ehttps://wiki.swoole.com/wiki/page/414.html\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e三、执行异步任务(耗时任务处理)\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://wiki.swoole.com/wiki/page/162.html\"\u003ehttps://wiki.swoole.com/wiki/page/162.html\u003c/a\u003e \u003ca href=\"https://wiki.swoole.com/wiki/page/481.html\"\u003ehttps://wiki.swoole.com/wiki/page/481.html …\u003c/a\u003e\u003c/p\u003e"
June 20, 2017
使用Let’s Encrypt 给网站加 HTTPS
"\u003cblockquote\u003e\n\u003cp\u003e2017.03.27更新:\u003ccode\u003e/usr/bin/letsencrypt\u003c/code\u003e 被 \u003ccode\u003e/usr/bin/certbot\u003c/code\u003e 替代,更新文章中所用到的命令。参考: \u003ca href=\"https://wiki.archlinux.org/index.php/Let%E2%80%99s_Encrypt\"\u003eArchlinux Let’s Encrypt Wiki\u003c/a\u003e\u003c/p\u003e\u003c/blockquote\u003e\n\u003cp\u003e\u003cem\u003eLet’s Encrypt\u003c/em\u003e 证书生成不需要手动进行,官方推荐 \u003ca href=\"https://certbot.eff.org/\"\u003ecertbot\u003c/a\u003e 这套自动化工具来实现。3步轻松搞定:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e下载安装 certbot (Let’s Encrypt项目的自动化工具)\u003c/li\u003e\n\u003cli\u003e创建配置文件\u003c/li\u003e\n\u003cli\u003e执行证书自动化生成命令\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003e环境:\ncentos7 64位\nnginx\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e一、安装certbot\u003c/strong\u003e\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e$yum -y install certbot\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e#检查安装是否成功\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e$certbot --help\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e如果安装过程中遇到python的问题,解决办法请参考: \u003ca href=\"https://blog.haohtml.com/archives/17491\"\u003ehttps://blog.haohtml.com/archives/17491\u003c/a\u003e\n\u003cstrong\u003e二、生成域名证书\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e这里使用的域名为 blog.haohtml.com, 网站根目录为 \u003cstrong\u003e/data/wwwroot/haohtml/blog\u003c/strong\u003e\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003e#为一个已经存在的站点生成证书文件,一个证书可以多个域名共用,一次也可以生成多个域名谈证书(内容放在了同一个文件里), …\u003c/p\u003e\u003c/blockquote\u003e"
May 18, 2017
pushState + Ajax 技术
"\u003cp\u003e有时间我们要实现动态修改URL地址,同时更新部分页面内容,但不刷新整个页面,这种情况下用就需要用到一些pjax技术了。\u003c/p\u003e\n\u003cp\u003ewindow.history.replaceState 和 window.history.pushState 类似,不同之处在于replaceState不会在window.history里新增历史记录点,其效果类似于window.location.replace(url),都是不会在历史记录点里新增一个记录点的。当你为了响应用户的某些操作,而要更新当前历史记录条目的状态对象或URL时,使用replaceState()方法会特别合适, 两者的参数是完全一样的。\u003c/p\u003e\n\u003cp\u003ewindow.history.replaceState(state, title , url) // “页面标题”目前浏览器暂不支持\u003c/p\u003e\n\u003cp\u003estate:一个与指定网址相关的状态对象{},popstate事件触发时,该对象会传入回调函数。如果不需要这个对象,此处可以填null。\u003c/p\u003e\n\u003cp\u003etitle:新页面的标题,但是所有浏览器目前都忽略这个值,因此这里可以填null。\u003c/p\u003e\n\u003cp\u003eurl:新的网址,必须与当前页面处在同一个域。浏览器的地址栏 …\u003c/p\u003e"
April 13, 2017
MongoDB中字段的添加与删除
"\u003cp\u003emongoDB添加和删除表中一个字段\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e使用update命令\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eupdate命令格式:\u003c/p\u003e\n\u003cp\u003edb.collection.update(criteria,objNew,upsert,multi)\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e参数说明:\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003ecriteria:查询条件\u003c/p\u003e\n\u003cp\u003eobjNew:update对象和一些更新操作符\u003c/p\u003e\n\u003cp\u003eupsert:如果不存在update的记录,是否插入objNew这个新的文档,true为插入,默认为false,不插入。\u003c/p\u003e\n\u003cp\u003emulti:默认是false,只更新找到的第一条记录。如果为true,把按条件查询出来的记录全部更新。\u003c/p\u003e\n\u003cp\u003e//例如要把User表中address字段删除\ndb.User.update({},{$unset:{‘address’:”}},false, true)\u003c/p\u003e\n\u003cp\u003e参考: \u003ca href=\"https://docs.mongodb.com/manual/reference/method/db.collection.update/#update-parameter\"\u003ehttps://docs.mongodb.com/manual/reference/method/db.collection.update/#update-parameter\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e==================\u003c/p\u003e\n\u003cp\u003e添加一列 $set\u003c/p\u003e\n\u003cp\u003e//字符类型\ndb.User.update({},{$set:{‘app_id’:’1′}}, …\u003c/p\u003e"
March 29, 2017
git无法pull仓库refusing to merge unrelated histories的解决办法
"\u003cp\u003e在本地有一个很久的项目,需要上传到远程git仓库中,先在远程创建了一个仓库,在本地配置好后,发现上传的时候,提示先git pull 一下,但git pull的时候提示这个错误,主要是因为目前两个git仓库信息不一致问题,我们要将两个项目合并在一起,需要添加一个 –allow-unrelated-histories 参数即可。\u003c/p\u003e\n\u003cp\u003e先进入cli命令行模式,执行\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003egit pull origin master --allow-unrelated-histories\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e然后再执行git pull origin master 即可。\u003c/p\u003e\n\u003cp\u003e参考: \u003ca href=\"http://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories\"\u003ehttp://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories\u003c/a\u003e\u003c/p\u003e"
February 7, 2017
理解B+树算法和Innodb索引
"\u003cp\u003e\u003ca href=\"http://www.ruzuojun.com/topic/420.html\"\u003ehttp://www.ruzuojun.com/topic/420.html\u003c/a\u003e\u003c/p\u003e"