Skip to content

Instantly share code, notes, and snippets.

hackerxu taizilongxu

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
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):
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
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()
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"]}
You can’t perform that action at this time.