Skip to content

Instantly share code, notes, and snippets.

View wwj718's full-sized avatar

wwj718

View GitHub Profile
@wwj718
wwj718 / rpc_demo.py
Created December 30, 2015 02:40
通过XML-RPC实现简单的远程调用(摘自python cookbook)
from xmlrpc.server import SimpleXMLRPCServer
class KeyValueServer:
_rpc_methods_ = ['get', 'set', 'delete', 'exists', 'keys']
def __init__(self, address):
self._data = {}
self._serv = SimpleXMLRPCServer(address, allow_none=True)
for name in self._rpc_methods_:
self._serv.register_function(getattr(self, name))
"""
This is the default template for our main set of AWS servers. This does NOT
cover the content machines, which use content.py
Common traits:
* Use memcached, and cache-backed sessions
* Use a MySQL 5.1 database
"""
# We intentionally define lots of variables that aren't used, and
@wwj718
wwj718 / cx_oracle.md
Created July 11, 2016 09:02 — forked from kimus/cx_oracle.md
Installing python cx_oracle on Ubuntu

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.

Linux

Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need:

@wwj718
wwj718 / 词性标记.md
Created August 5, 2016 09:50 — forked from luw2007/词性标记.md
词性标记: 包含 ICTPOS3.0词性标记集、ICTCLAS 汉语词性标注集、jieba 字典中出现的词性、simhash 中可以忽略的部分词性

词的分类

  • 实词:名词、动词、形容词、状态词、区别词、数词、量词、代词
  • 虚词:副词、介词、连词、助词、拟声词、叹词。

ICTPOS3.0词性标记集

n 名词

nr 人名

@wwj718
wwj718 / github.com.css
Last active August 20, 2016 13:30
github浏览器主题 (配合stylebot使用)
#commit-activity-detail path.path, .traffic-graph g.x.axis g.tick:first-child line {
stroke: #1DB34F ;
}
#contributions-calendar .contrib-details div, .mini-icon-remove-close:hover, .tabnav-tabs a, .time, .gist-item .metadata .datetime, .list-group-item-meta, a.keyboard-shortcuts, button.keyboard-shortcuts, .simple-conversation-list, .simple-conversation-list > li .title .num, .drag-and-drop, .starred-repo .sort-info, .org-stats, .commandbar .choice, .commandbar .loading, .commandbar .description, ul.summary-stats li a, .authorship, .sha-block, .gh-header-meta, #last-edit, .setup-header .lead a, .repository-meta .edit-link a, .api-status a, .meta li, .who_when a, .numbers-summary a, .numbers-summary .octicon:before, .section-heading-title .separator, .blog-aside .rss, .hook-list a, .github-jobs-promotion a.jobs-logo, .org-teams-list .team-meta, .repo-list-item .repo-description, .branch-infobar .lightweight-actions > li a, .repo-leaderboard-list .repo-leaderboard-meta-item a, .changed .moved-up:before, .
@wwj718
wwj718 / upload2qiniu.py
Created February 6, 2017 08:05
将网站/目录整体上传到七牛云
#!/usr/bin/env python
# encoding: utf-8
'''使用:python upload2qiniu.py SITE_DIR
'''
import sys,os
from qiniu import Auth, put_file, etag, urlsafe_base64_encode,BucketManager,CdnManager
import qiniu.config
from path import path # 文档参考# https://pythontips.com/2014/01/23/python-101-writing-a-cleanup-script/
@wwj718
wwj718 / logging_config.yaml
Last active March 22, 2018 03:21
日志配置文件
---
version: 1
disable_existing_loggers: False
formatters:
simple:
format: "%(asctime)s - %(name)s - %(levelname)s- [%(filename)s:%(lineno)d] - %(funcName)s - - %(message)s" #thread #http://blog.csdn.net/yatere/article/details/6655445
handlers:
console:
class: logging.StreamHandler
@wwj718
wwj718 / setup_logging.py
Last active March 22, 2018 03:39
测试脚本,与logging_config.yaml配合使用
#!/usr/bin/env python
# encoding: utf-8
# 参考:https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/
import os
import logging.config
import yaml
@wwj718
wwj718 / aiohttp_test.py
Created March 16, 2017 06:48
python3.5 async http requets
#!/usr/bin/env python
# encoding: utf-8
import aiohttp
import asyncio
'''
最简 异步 http请求
'''
@wwj718
wwj718 / aiohttp_test.py
Created March 16, 2017 06:48
python3.5 async http requets
#!/usr/bin/env python
# encoding: utf-8
import aiohttp
import asyncio
'''
最简 异步 http请求
'''