Skip to content

Instantly share code, notes, and snippets.

View ayonliu's full-sized avatar

Lyon Liu ayonliu

View GitHub Profile
@ayonliu
ayonliu / gist:28f0742b500e2669016a
Created October 26, 2015 12:18 — forked from hzopak/gist:9573928
nginx config for scrapyd deployment to implement basic auth protection
# Scrapyd local proxy for basic authentication.
# Don't forget iptables rule.
# iptables -A INPUT -p tcp --destination-port 6800 -s ! 127.0.0.1 -j DROP
server {
listen 6801;
location ~ /\.ht {
deny all;
}
@ayonliu
ayonliu / middlewares.py
Created October 27, 2015 03:52 — forked from pkmishra/middlewares.py
Scrapy middlewares for random agent list and proxy server usage.
import os
import random
from scrapy.conf import settings
class RandomUserAgentMiddleware(object):
def process_request(self, request, spider):
ua = random.choice(settings.get('USER_AGENT_LIST'))
if ua:
request.headers.setdefault('User-Agent', ua)
class ProxyMiddleware(object):
@ayonliu
ayonliu / nginx.conf
Created November 27, 2015 09:12
my nginx configure
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
@ayonliu
ayonliu / mydomain.conf
Last active November 27, 2015 09:29
nginx configure for mydomain.com, include by nginx.conf
# Upstream to abstract backend connection(s) for php
upstream php {
# server unix:/tmp/php-cgi.socket;
server 127.0.0.1:9000;
}
server {
## Your website name goes here.
server_name mydomain.com www.mydomain.com ;
## Your only path reference.
@ayonliu
ayonliu / Vagrantfile
Created December 6, 2016 06:44
Vagrantfile for vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@ayonliu
ayonliu / setting_up_vagrant.md
Last active December 7, 2016 06:00
vagrant getting started

INSTALLING A BOX

vagrant box add ubuntu/xenial64

执行上面命令后可以看到 ubuntu/xenial64 对应的下载地址,可以复制下来用下载工具下载并存储到 D:/vagrant/boxes/xenial-server-cloudimg-amd64-vagrant.box

可以改成下面通过添加本地 box 的方式:

vagrant box add ubuntu/xenial64 D:/vagrant/boxes/xenial-server-cloudimg-amd64-vagrant.box

查看系统已经有的 box:

@ayonliu
ayonliu / Install-php5.6-on-Centos7.md
Last active February 3, 2023 22:56
Install php5.6 on Centos 7
@ayonliu
ayonliu / Install-MySQL-on-CentOS7.md
Last active December 8, 2016 11:34
Install MySQL on CentOS 7

Install MySQL on CentOS 7

Install MySQL on CentOS 7 How to Install MySQL on CentOS 7

rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm,
yum install mysql-community-server
mysql_secure_installation

Failed! Error: Your password does not satisfy the current policy requirements

@ayonliu
ayonliu / mysql_reference.md
Last active February 28, 2018 08:53
mysql 的一些参考

The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed.

LOAD DATA LOCAL INFILE '/tmp/merchant.log' 
REPLACE INTO TABLE `log` 
FIELDS TERMINATED BY ',' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\n' 
@ayonliu
ayonliu / who-am-i-cn.md
Last active August 9, 2018 10:04
介绍我是谁

我是一名生活在上海的程序员