Skip to content

Instantly share code, notes, and snippets.

View XingfuY's full-sized avatar

Xingfu Y. XingfuY

View GitHub Profile
@XingfuY
XingfuY / middlewares.py
Created July 20, 2020 02:30 — forked from seagatesoft/middlewares.py
An example of RotateUserAgentMiddleware
from random import choice
from scrapy import signals
from scrapy.exceptions import NotConfigured
class RotateUserAgentMiddleware(object):
"""Rotate user-agent for each request."""
def __init__(self, user_agents):
self.enabled = False
self.user_agents = user_agents
@XingfuY
XingfuY / clone-mysql-db.sh
Created February 11, 2020 23:24 — forked from christopher-hopper/clone-mysql-db.sh
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
#!/bin/bash
DBUSER="root";
DBPASS="";
DBHOST="localhost";
DB_OLD=mydatabase
DB_NEW=clone_mydatabase
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";
@XingfuY
XingfuY / 0.useful.md
Created October 12, 2019 17:13 — forked from felipemoraes/0.useful.md
Machine Learning Interview Questions