Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
import scrapy
from uuid import uuid1
import logging
logger = logging.getLogger(__name__)
class TiebaSpider(scrapy.Spider):
name = "facebook"
allowed_domains = ['www.facebook.com']
@mugbya
mugbya / oss_post_policy.py
Last active August 11, 2017 02:48
get oss policy for python3
import datetime
import time
import base64
import json
import hmac
from hashlib import sha1 as sha
expire_time = 30
upload_dir = settings.ALIYUN_OSS_DIRECTORY_PREFIX
@mugbya
mugbya / sanic-jinja2.py
Created March 3, 2017 08:37
sanic support jinja2
from sanic.response import html
from jinja2 import Environment, PackageLoader
from config.settings import PACKAGE_NAME, TEMPLATES
class SanicJinja2:
def __init__(self, loader=None, **kwargs):
self.env = Environment(**kwargs)
if not loader:
loader = PackageLoader(PACKAGE_NAME, TEMPLATES)
# coding: utf-8
import xlsxwriter
from weixin.tools.db import queryMany
from weixin.tools.table_fields import TABLE_FIELDs
from openpyxl.writer.excel import ExcelWriter
from openpyxl import load_workbook
class FileHandler(object):
'''
@mugbya
mugbya / phantom.js
Last active August 29, 2015 14:09
phantomJS学习代码
console.log('Loading a web page');
var fs = require('fs');
var page = require('webpage').create();
page.open('http://cd.house.qq.com/', function() {
var links = page.evaluate(function() {
var links = new Array();
var len = document.body.getElementsByTagName("object").length;
for( var i = 0; i < len; i++ ){
@mugbya
mugbya / Extjs_Grid_Button.js
Last active December 19, 2016 12:32
Add button to Extjs GridPanel cell using renderer (解藕)
/**
* Created by mugya on 14-8-25.
* 参考链接: http://www.techmix.net/2010/11/25/add-button-to-extjs-gridpanel-cell-using-renderer/
*/
Ext.define("YCTrade.module.process.personal.HandlerProcess", {
extend: 'Ext.panel.Panel',
layout: 'border',
title: '个人代办',
rec : 'none',
requires: [
@mugbya
mugbya / Activiti_Simple.java
Created September 2, 2014 07:01
activit与spring集成的最简单demo,不设计业务,用户等其他复杂的东西
package com.mugbya.cjtrade.activiti.test;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.springframework.context.support.ClassPathXmlApplicationContext;