Skip to content

Instantly share code, notes, and snippets.

View JingwenTian's full-sized avatar
🎯
Focusing

JingwenTian JingwenTian

🎯
Focusing
View GitHub Profile
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
<?php
ini_set("memory_limit","500M");
date_default_timezone_set('Asia/Shanghai');
ini_set('max_execution_time',300000);
echo "<pre />";
$array=array();
$data=array();
$file=fopen('2013-11-19.csv','r');
while($re=fgets($file)){
$arr=explode(",",$re);
@JingwenTian
JingwenTian / Create Code Readme
Last active January 3, 2016 07:48
jingwentian.com 发布代码的方法说明
打开: https://gist.github.com/
选择编程语言(language)
编写或粘贴代码
点击 "Create Public Gist"
将gist页网址粘贴在发布框即可
@JingwenTian
JingwenTian / gist:8516025
Created January 20, 2014 06:48
YAF 在Nginx环境下的Rewrite规则
#Yaf手册提供的Nginx的Rewrite (nginx.conf)
#vi /usr/local/nginx/conf/nginx.conf
server {
listen ****;
server_name domain.com;
root document_root;
index index.php index.html index.htm;
@JingwenTian
JingwenTian / xen.conf
Created January 22, 2014 08:00
Ubuntu下安装配置nginx+php+mysql中, php的配置文件(/etc/php5/fpm/pool.d/xen.conf)
; Start a new pool named 'www'.
[xen]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
@JingwenTian
JingwenTian / nginx.conf
Last active January 4, 2016 04:49
nginx泛域名解析实现二级域名多域名详细说明: http://www.jingwentian.com/t-34
server {
listen 80;
server_name ~^(?<subdomain>.+)\.jingwentian\.com$;
root /home/wwwroot/jingwentian/$subdomain;
index index.html index.htm index.php;
fastcgi_intercept_errors on;
error_page 404 = /404.html;
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't
@JingwenTian
JingwenTian / gist:8572173
Created January 23, 2014 03:08
使用Linux命令行测试网速--安装speedtest_cli 详细说明: http://www.jingwentian.com/t-35
$ wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
$ chmod a+rx speedtest_cli.py
$ sudo mv speedtest_cli.py /usr/local/bin/speedtest-cli
$ sudo chown root:root /usr/local/bin/speedtest-cli
@JingwenTian
JingwenTian / gist:8572349
Created January 23, 2014 03:32
查看DNS解析全过程
root@jing:~# dig +trace jingwentian.com
@JingwenTian
JingwenTian / nginx.conf
Created January 23, 2014 08:32
nginx基本配置与参数说明
#运行用户
user nobody;
#启动进程,通常设置成和cpu的数量相等
worker_processes 1;
#全局错误日志及PID文件
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
@JingwenTian
JingwenTian / gist:8578766
Created January 23, 2014 13:55
DDoS deflate的安装
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod +x install.sh
./install.sh