Skip to content

Instantly share code, notes, and snippets.

View JingwenTian's full-sized avatar
🎯
Focusing

JingwenTian JingwenTian

🎯
Focusing
View GitHub Profile
@JingwenTian
JingwenTian / gist:8753734
Last active August 29, 2015 13:55
用xcache和memcache做php加速
xcache 是中国人自己写的php加速器.据各种评测资料,xcache是个相当不错的php加速器了:
现在eAccelerator 半死不活的样子,PHPA则需要专利授权,而 APC 又 bug 一大堆,基本上需要完全重写。现在,唯一象样的 PHP 编译/加速器就属 Xcache 了.
它稳定、快速、具有很强的可移植性,并且是开放源代码的,还可以缓存对象。
于是打算试试看,freebsd下最方便的软件安装方式就是ports了.
在/usr/ports/www下没有找到xcache.于是.单独升级www ports树.
caicai# cvsup -L 2 -h cvsup.cn.FreeBSD.org /usr/share/examples/cvsup/ports-supfile
@JingwenTian
JingwenTian / gist:8768865
Created February 2, 2014 14:01
在 Ubuntu 安装git,可以用 apt-get 安装:
apt-get install git
@JingwenTian
JingwenTian / gist:8858458
Created February 7, 2014 07:12
vps新增用户操作
#新增用户并设置home目录
useradd -r -m -s /bin/bash username
#设置密码
passwd username
@JingwenTian
JingwenTian / gist:8858522
Created February 7, 2014 07:19
给普通用户授权使用sudo
#先切换到root用户,然后按照下面的步骤来:
vim /etc/sudoers
#找到这一行:"root ALL=(ALL)ALL"在其后面添加:(username为你的用户名)
username ALL=(ALL) ALL
@JingwenTian
JingwenTian / gist:8858531
Created February 7, 2014 07:20
禁止root用户ssh登陆
vi /etc/ssh/sshd_config
#把 PermitRootLogin yes 改为 PermitRootLogin no
#重启sshd服务
service sshd restart
@JingwenTian
JingwenTian / gist:8875701
Created February 8, 2014 02:21
Git文件删除操作
#删除sth目录下文件
git rm sth/* -r
#然后commit
git commit -a -m 'remove sth'
#再次push就可以了
git push -u origin master
#可以增加忽略文件:
vim .gitignore
#在文件中添加
sth/**/*
@JingwenTian
JingwenTian / gist:8951072
Created February 12, 2014 06:52
linux修改php.ini后重新加载配置文件命令
#PHP的一般默认安装目录是:
/usr/local/php/
#我们用php-fpm来进行重新加载配置文件
/usr/local/php/sbin/php-fpm reload
#注:/usr/local/php/sbin/php-fpm还有其他参数,包括:start|stop|quit|restart|reload|logrotate
#使用PHP-FPM来控制PHP-CGI的FastCGI进程
@JingwenTian
JingwenTian / jQuery 小技巧
Last active August 29, 2015 13:57
开发中可能会用到的几个 jQuery 小提示和技巧
1) 禁止右键
在开发 Web 应用的时候,有些情况需要禁用右键单击功能。使用此代码,jQuery 开发人员可以在网页上禁用鼠标右键点击。代码如下:
$(document).ready(function() {
//catch the right-click context menu
$(document).bind("contextmenu",function(e) {
//warning prompt - optional
alert("No right-clicking!");
@JingwenTian
JingwenTian / ocp.php
Created March 12, 2014 14:33 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://api.map.baidu.com/api?type=quick&ak=22RNa2l6NSorv9rDTbtfp80P&v=1.0"></script>
<title>百度地图的Hello, World</title>
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;} @media (max-device-width: 780px){#golist{display: block!important;}}#golist {display: none;}
</style>