Skip to content

Instantly share code, notes, and snippets.

View taizilongxu's full-sized avatar
😭
I may be slow to respond.

hackerxu taizilongxu

😭
I may be slow to respond.
  • Qunar
  • Beijing
View GitHub Profile
View gist:a3225e702341015f1339d6d49faf2ed3
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.011 000.011: --- NVIM STARTING ---
006.705 006.694: locale set
016.092 009.387: inits 1
016.122 000.030: window checked
@taizilongxu
taizilongxu / scrapy.py
Created September 3, 2016 10:03
scrapy常用
View scrapy.py
# 命令
scrapy startproject tutorial
scrapy crawl dmoz # spider name: dmoz
scrapy shell 'http://www.example.com' # enter shell
# start
start_urls
# fisrt start
def start_requests(self):
@taizilongxu
taizilongxu / music.py
Created August 27, 2016 15:03
163 music
View music.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
import os
import base64
from Crypto.Cipher import AES
from pprint import pprint
@taizilongxu
taizilongxu / requests.py
Created August 27, 2016 10:10
requests
View requests.py
r.requests('http://www.example.com')
r.request.headers # 请求头
r.status_code
r.url # 访问网址
r.headers # 返回头部信息
r.encoding
r.text #内容部分(PS,由于编码问题,建议这里使用r.content)
r.json()
@taizilongxu
taizilongxu / 123
Last active August 29, 2015 14:19
View 123
def timeit(func, *args, **kw):
def wrap():
print time.time()
func(*args, **kw)
print time.time()
return wrap
View test.py
#-*- encoding: UTF-8 -*-
#---------------------------------import------------------------------------
import subprocess
import time
#---------------------------------------------------------------------------
import os
import tempfile
mplayer_controller = os.path.join(tempfile.mkdtemp(), 'mplayer_controller')
os.mkfifo(mplayer_controller)
cmd = 'mplayer -slave -quiet -input file={fifo} {song_url}'
View aboutme.py
#!/usr/bin/env python
class Me(Developer) :
@property
def education(self):
return {
"Undergraduate" : ["Saftey Engineering","Shenyang Aerospace University"],
"Graduate" : ["Soft Engineering","Liaoning University"]}