Skip to content

Instantly share code, notes, and snippets.

View Kingson's full-sized avatar
🎯
Focusing

Kingson Zhou Kingson

🎯
Focusing
  • ButtonSoftware
  • China
View GitHub Profile
@Kingson
Kingson / UIColor+HexString.h
Created November 10, 2015 10:41 — forked from codingrhythm/UIColor+HexString.h
Objective-C class to convert hex string to UIColor. Support #RGB # ARGB #RRGGBB #AARRGGBB Usage: [UIColor colorWithHexString:@"#f5e6a1"];
//
// UIColor+HexString.h
// Class to convert hex string to UIColor
// Support #RGB # ARGB #RRGGBB #AARRGGBB
// Usage: [UIColor colorWithHexString:@"#f5e6a1"];
// Created by Zhu Yuzhou on 1/20/13.
//
#import <UIKit/UIKit.h>
@Kingson
Kingson / pyAPNS.py
Created April 7, 2014 15:34
这是一段使用APNSWrapper实现的发送Apple Push的代码。
#! /usr/bin/env python
# coding=utf-8
"""
1. 这是一段使用APNSWrapper[https://code.google.com/p/apns-python-wrapper/]实现的发送Apple Push的代码,
其中的deviceToken需要替换为自己设备的deviceToken,pem_cert也需要替换为自己应用的P12证书;
2. 具体的获取设备的deviceToken的方法和导出P12证书的方法,
请参考这篇文章[http://www.cnblogs.com/sunnyxx/archive/2012/12/01/2796461.html]
"""
__author__ = 'jszhou'
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
@Kingson
Kingson / simpleddy.py
Created November 20, 2013 09:04
Appium
#! /usr/bin/env python
# coding=utf-8
"""Be sure to use the latest selenium version
as there might be some problems with JSON serialization
Before running the test make sure you started appium server
with TestApp app: grunt appium:TestApp
"""
import unittest
@Kingson
Kingson / create_xml.py
Created August 19, 2013 12:03
分别使用Python自带的xml.etree.ElementTree和第三方lxml来生成一个按首字母归类的城市列表XML文件。
#! /usr/bin/env python
# coding=utf-8
__author__ = 'Kingson.Zhou'
import requests
import string
from pyquery import PyQuery as pq
import xml.etree.ElementTree as ET
from lxml import etree as ET
@Kingson
Kingson / download_ebook.py
Last active January 9, 2022 08:44
下载读远网站电子书 V1.0
#! /usr/bin/env python
# coding=utf-8
__author__ = 'Kingson zhou'
import requests
import os
import time
from bs4 import BeautifulSoup
import random
"""
说明:
@Kingson
Kingson / Douban_movie_query.py
Last active June 16, 2020 07:42
豆瓣电影查询助手V3.0 #增加给新关注的用户自动返回“欢迎关注豆瓣电影,输入电影名称即可快速查询电影讯息哦!”信息的功能 #大力丰富注释和docstring信息,以帮助后来者能快速上手。
#! /usr/bin/env python
# coding=utf-8
__author__ = 'jszhou'
from bottle import *
import hashlib
import xml.etree.ElementTree as ET
import urllib2
# import requests
import json
@Kingson
Kingson / Douban_movie_query.py
Last active October 12, 2016 15:52
豆瓣电影查询助手V2.0 #1.0中通过电影ID来查询电影信息,显然让用户蛋很疼,使用电影名称才是王道,本版本就是使用电影名称,调用豆瓣Movie Search接口和Subject接口,拿到电影海报,Title,Description等信息,以图文信息返给微信用户。 #但,本版本直接返回查询出的第一条数据,有时会不准确,显示的结果不是自己所要查询的,这个问题争取在下一个版本中解决。
#! /usr/bin/env python
# coding=utf-8
__author__ = 'jszhou'
from bottle import *
import hashlib
import xml.etree.ElementTree as ET
import urllib2
# import requests
import json
@Kingson
Kingson / Douban_movie_query.py
Last active December 14, 2015 16:29
豆瓣电影查询助手V1.0 #实现通过电影ID来查询电影信息,返回电影Title和Summary。
#! /usr/bin/env python
# coding=utf-8
__author__ = 'jszhou'
from bottle import *
import hashlib
import xml.etree.ElementTree as ET
import urllib2
# import requests
import json
@Kingson
Kingson / wblogin.py
Created January 6, 2013 08:21 — forked from mrluanma/requirements.txt
自动登录新浪微博脚本。
import re
import json
import urllib
import base64
import hashlib
import requests
import OS
WBCLIENT = 'ssologin.js(v.1.3.18)'