This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pylab as pl | |
import pandas as pd | |
from sklearn import svm | |
from sklearn import linear_model | |
from sklearn import tree | |
from sklearn.metrics import confusion_matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
o o o | |
o x | |
o x x x | |
x o | |
x x x o | |
x | |
o o | |
o | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Author: Yuande Liu <miracle (at) gmail.com> | |
import socket | |
import time | |
import requests | |
import lxml.html | |
def wrapper(url, timeout=20, retries=5, sleep=10, encoding ='gbk', text=False, errurl=None, errfunc=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************************************** | |
* 感知器判断数字奇偶性 | |
* | |
* 关键点,阈值应该怎么定? | |
****************************************/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# | |
# Table name: admins | |
# | |
# id :integer not null, primary key | |
# username :string(255) not null | |
# encrypted_password :string(255) not null | |
# salt :string(255) not null | |
# created_at :datetime | |
# updated_at :datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Resolve hostnames concurrently, exit after 60 seconds. | |
Under the hood, this might use an asynchronous resolver based on | |
c-ares (the default) or thread-pool-based resolver. | |
You can choose between resolvers using GEVENT_RESOLVER environment | |
variable. To enable threading resolver: | |
GEVENT_RESOLVER=thread python dns_mass_resolve.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Author: Liu Yuande | |
# https://jakevdp.github.io/blog/2012/12/01/a-primer-on-python-metaclasses/ | |
# http://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python | |
# http://stackoverflow.com/questions/17801344/python-understanding-metaclass-and-inheritance | |
# give a name, create a new car class. define the class in a more dynamic way. | |
# classes can inherit properties from parents and add or specialize attributes and methods. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''.join(map((lambda d: lambda i: str(d[i]))([5,9,1,0,3]), [2,0,3,3,3,2,0,2,1,2,4])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Author: Yuande Liu <miraclecome (at) gmail.com> | |
from __future__ import print_function, division | |
from gevent import monkey; monkey.patch_all() | |
import gevent | |
import time |