Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env python
# coding=utf-8
__author__ = 'Kingson zhou'
import requests
import os
import time
from bs4 import BeautifulSoup
import random
"""
说明:
#! /usr/bin/env python
# coding=utf-8
__author__ = 'Kingson zhou'
import requests
import os
import time
from bs4 import BeautifulSoup
import random
"""
说明:
@668
668 / filter_tags.py
Created January 29, 2014 22:50
filter_tags
# -*- coding: utf-8-*-
import re
##过滤HTML中的标签
#将HTML中标签等信息去掉
#@param htmlstr HTML字符串.
def filter_tags(htmlstr):
#先过滤CDATA
re_cdata=re.compile('//<!\[CDATA\[[^>]*//\]\]>',re.I) #匹配CDATA
re_script=re.compile('<\s*script[^>]*>[^<]*<\s*/\s*script\s*>',re.I)#Script
re_style=re.compile('<\s*style[^>]*>[^<]*<\s*/\s*style\s*>',re.I)#style
@668
668 / factorization.py
Created February 5, 2014 11:26
# Prime factorization - list 因数分解
# Prime factorization - list 因数分解
def primes(n):
primfac = []
d = 2
while d*d <= n:
while (n % d) == 0:
primfac.append(d) # supposing you want multiple factors repeated
n /= d
d += 1
if n > 1:
@668
668 / pyImage_example.py
Created March 8, 2014 21:37
PIL 例子
#coding:utf-8
'''
python图片处理
'''
from PIL import Image as image
#等比例压缩图片
def resizeImg(**args):
args_key = {'ori_img':'','dst_img':'','dst_w':'','dst_h':''}
@668
668 / dama2.py
Created March 17, 2014 07:58
自封装的打码类, windows下建议用打码兔(调用的官方dll),linux下建议超人打码(http api)
# coding:utf-8
"""
自封装的打码类, windows下建议用打码兔(调用的官方dll),linux下建议超人打码(http api)
"""
from ctypes import *
import requests
import json
import random
import binascii
from config import config
@668
668 / daemon.py
Created March 26, 2014 08:53 — forked from jamiesun/daemon.py
#! /usr/bin/env python2.7
#encoding:utf-8
#@description:一个python守护进程的例子
#@tags:python,daemon
import sys
import os
import time
import atexit
from signal import SIGTERM
# -*- coding: utf-8 -*-
class MagicDict(dict):
def __init__(self, **kwargs):
dict.__init__(self, kwargs)
self.__dict__ = self
def __getattr__(self, name):
self[name] = MagicDict()
return self[name]
@668
668 / sublime_text3_crack.md
Created November 28, 2015 22:30 — forked from sublime-crack4/sublime_text3_crack.md
Sublime Text crack 3095 3083 Win64 Win32 Linux64 Linux32 OSX Mac MacOS latest

cat

For pupil: all binary can be downloaded http://pan.baidu.com/s/1ntCChyp

After overwriting, maybe need to run chmod +x /path/to/sublime_text. For linux default installation, need to add sudo.

For programmer:

VERSION PLATFORM OFFSET ORIGINAL CRACKED
@668
668 / python
Created August 29, 2016 20:50 — forked from 582033/python
多线程获取并验证代理
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, re
import requests
import Queue
import threading
class Proxy():
def __init__(self, proxy_url, target_url, ver_keyword, timeout):