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 | |
# -3- coding: utf-8 -3- | |
from __future__ import print_function | |
import sys | |
thismodule = sys.modules[__name__] | |
class BPUGBaseException(Exception): |
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
" map the leader key to , | |
let mapleader = "," | |
" Note: Skip initialization for vim-tiny or vim-small. | |
if !1 | finish | endif | |
if has('vim_starting') | |
set nocompatible " Be iMproved |
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
import instapush | |
app = instapush.App(appid="52eed96ea2a8f0f", secret="9a96794fec44481de5") | |
app.notify(event_name="search", "trackers"={"term": "new term"}) |
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
from django.test.client import Client | |
#方法1: 构造实例的时候传入headers中的key value, 以后请求方法自动传递headers | |
client = HttpClient(REMOTE_ADDR='127.0.0.1') | |
#方法2: 请求的时候附带额外参数声明headers | |
client.get('/path/', {'param':'foo'}, **{'HTTP_USER_AGENT':'firefox-22', 'REMOTE_ADDR':'127.0.0.1'}) |
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
class Singleton(object): | |
def __new__(cls, *args, **kwds): | |
it = cls.__dict__.get("__it__") | |
if it is not None: | |
return it | |
cls.__it__ = it = object.__new__(cls) | |
it.init(*args, **kwds) | |
return it | |
def __init__(self, *args, **kwds): | |
pass |
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 -* | |
class Operation: | |
a = "Press A;" | |
paste = "Press Ctrl+V;" | |
copy_and_paste = "Press Ctrl+A; Press Ctrl+C; Press Ctrl+V; Press Ctrl+V;" | |
def create_operation_list(): | |
operation_list = [(i, Operation.a) for i in range(0, 5)] | |
return operation_list |