Skip to content

Instantly share code, notes, and snippets.

View BiosSun's full-sized avatar
🎯
Focusing

Bios Sun BiosSun

🎯
Focusing
View GitHub Profile
@BiosSun
BiosSun / 修改 mysql 数据库 root 账户的密码
Created September 5, 2013 11:11
该方法适合在忘记 root 密码时使用,需要有服务器的 root 权限。
# 停止当前mysql服务
/etc/init.d/mysqld stop
# ----
# 启动mysql
/etc/init.d/mysqld start
# 使用空密码登录mysql
mysql -u root
@BiosSun
BiosSun / contain.js
Last active September 25, 2019 02:26
矩形缩放算法,JS 版。http://jsfiddle.net/TJjJd/1/
/**
* 将原尺寸缩放使之能够填充目标尺寸,缩放后尺寸小于或等于目标尺寸,
* 且有一边与原尺寸相同。
* @param w1 目标尺寸 - 宽度
* @param h1 目标尺寸 - 高度
* @param w2 原尺寸 - 宽度
* @param h2 原尺寸 - 高度
*/
function contain(w1, h1, w2, h2) {
@BiosSun
BiosSun / 创建数据库用户并授予权限.mysql
Created October 24, 2013 09:14
创建 MySQL 数据库用户,同时为其分配权限。
-- 创建一个用户,并授予其指定数据库的所有权限。
grant all privileges on `user`.* 'username'@'%' identified by 'password' with grant option;
1. 修改 php-fpm.conf 文件,添加(或修改)如下配置:
[global]
error_log = log/error_log
[www]
catch_workers_output = yes
2. 修改 php.ini 文件,添加(或修改)如下配置: