This file contains hidden or 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
# -*- coding: utf-8 -*- | |
''' | |
1. Construct the url with num_iid, eg: http://a.m.tmall.com/i15110720150.htm, 15110720150 is the num_iid. | |
2. Get the html text. | |
3. Parse the img urls and insert the num_iid and img urls into sqlite. | |
''' | |
import requests | |
from pyquery import PyQuery as pq |
This file contains hidden or 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 "MyString.h" | |
MyString::MyString(void) : capacity(INITIAL_CAPACITY), size(0) | |
{ | |
s_ptr = new char[INITIAL_CAPACITY]; | |
*s_ptr = '\0'; | |
} | |
MyString::~MyString(void) | |
{ |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
void qsort_last(int s[], int start_index, int end_index); //select the last element as the pivot | |
void qsort_first(int s[], int start_index, int end_index); //select the first element as the pivot | |
void qsort_mid(int s[], int start_index, int end_index); //select the middle element as the pivot | |
void qsort_rand(int s[], int start_index, int end_index); //select a random index's value as the pivot | |
void qsort_mot(int s[], int start_index, int end_index); //median of three partitioning + insertion sort | |
void qsort_clrs(int s[], int start_index, int end_index); //select the last element as the pivot, CLRS version |
This file contains hidden or 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 time | |
import threadpool | |
starttime = time.time() | |
def job(args): | |
print args[0] | |
print args[1] | |
def main(): |
This file contains hidden or 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 threading | |
import urllib | |
import Queue | |
import time | |
class Mythread(threading.Thread): | |
'''Download pictures.''' | |
def __init__(self, queue): | |
threading.Thread.__init__(self) | |
self.queue = queue |
This file contains hidden or 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 threading | |
import urllib | |
import time | |
class Mythread(threading.Thread): | |
'''Download pictures.''' | |
def __init__(self, url): | |
threading.Thread.__init__(self) | |
self.url = url | |
print 'init thread.' |
NewerOlder