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 -*- | |
""" | |
一个基于thread和queue的线程池,以任务为队列元素,动态创建线程,重复利用线程, | |
通过close和terminate方法关闭线程池。 | |
""" | |
import queue | |
import threading | |
import contextlib |
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
# coding: utf-8 | |
import MySQLdb | |
connect = MySQLdb.connect(user='root', passwd='', db='blog', host='127.0.0.1', port=3306) | |
cursor = connect.cursor() | |
cursor.execute('SELECT title, content, tags, created FROM blogs') | |
result = cursor.fetchall() |
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 -*- | |
import urllib2, cookielib, hashlib, urllib, json | |
EMAIL = '' | |
PWD = '' | |
URL = 'http://bozpy.sinaapp.com' | |
def post(filename): |
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 -*- | |
import urllib, urllib2, json | |
RPC_URL = 'http://192.168.1.2/jsonrpc' | |
def pushStream(stream, rpc=RPC_URL): | |
''' | |
Push stream URL to XBMC jsonrpc api, XBMC play the streaming. |
NewerOlder