Skip to content

Instantly share code, notes, and snippets.

View zhu327's full-sized avatar
🥰
Out sick

Timmy zhu327

🥰
Out sick
View GitHub Profile
@zhu327
zhu327 / thread_pool.py
Last active September 17, 2019 06:38
简单线程池
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
一个基于thread和queue的线程池,以任务为队列元素,动态创建线程,重复利用线程,
通过close和terminate方法关闭线程池。
"""
import queue
import threading
import contextlib
@zhu327
zhu327 / hugo-blog.py
Created April 18, 2016 13:00
从blog迁移到hugo脚本
# 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()
@zhu327
zhu327 / postEntry.py
Created September 16, 2014 15:11
通过文件发布文章 https://github.com/zhu327/blog
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2, cookielib, hashlib, urllib, json
EMAIL = ''
PWD = ''
URL = 'http://bozpy.sinaapp.com'
def post(filename):
@zhu327
zhu327 / player.py
Last active January 19, 2022 06:05
XBMC 迅雷云播: 直接通过下载地址推送迅雷云播地址到XBMC上
#!/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.