based on rage-quit support for bash
Put the files below inside ~/.oh-my-zsh/custom/plugins/fuck
Also chmod a+x
the flip
command.
# -*- coding=utf-8 -*- | |
import feedparser | |
import re | |
import collections | |
import math | |
def info_entropy(words): | |
result = 0 | |
total = sum([val for _, val in words.iteritems()]) | |
for word, cnt in words.iteritems(): |
from django.core.paginator import Paginator, InvalidPage, EmptyPage, PageNotAnInteger | |
def do_paginator( origin_list, page, max_item_per_page=MAX_ITEM_PER_PAGE): | |
""" | |
A paginator like doc says, but using default setting | |
in the views.py, I'd like to put it this way | |
do_paginator(list, request.GET.get('page')) | |
""" | |
try: | |
max_item_per_page = int(max_item_per_page) |
# -*- coding: utf-8 -*-s | |
''' | |
File: bigben.py | |
Author: Meng Zhuo <[email protected]> | |
Description: 大笨钟 | |
''' | |
import time | |
import logging | |
import threading | |
from datetime import datetime |
# encoding: utf-8 | |
__authors__ = (u"Meng Zhuo",) | |
class SimpleLazyObject(object): | |
"""Lazy Object impletement of Python | |
:func: init object or class | |
:returns: SimpleLazyObject | |
""" |
# forms | |
# ... | |
AlbumUpdateForm = model_form(Album, db_session=Session, | |
exclude=[Album.create_at]) | |
#views | |
# .... | |
if request.method == "PUT": | |
form = AlbumUpdateForm(request.form) |
#!/bin/sh | |
synclient TouchpadOff=$((`synclient -l | grep TouchpadOff | awk '{print $3}'`==0)) |
from tornado import gen, ioloop | |
import urllib2 | |
import re | |
tre = re.compile('\<title\>(?P<title>[^<]+)',re.IGNORECASE) | |
from pprint import pformat | |
@gen.coroutine | |
def sleep_bug(url): | |
print 'fetch:'+url | |
r = yield gen.Task(ioloop.IOLoop.current().add_callback) | |
print "callback "+ str(r) |
getprop | |
[DEVICE_PROVISIONED]: [1] | |
[audio.legacy.postproc]: [true] | |
[bluetooth.isEnabled]: [true] | |
[dalvik.vm.heapconcurrentstart]: [2097152] | |
[dalvik.vm.heapidealfree]: [8388608] | |
[dalvik.vm.heapsize]: [128m] | |
[dalvik.vm.heapstartsize]: [5m] | |
[dalvik.vm.heaputilization]: [0.25] | |
[dalvik.vm.stack-trace-file]: [/data/anr/traces.txt] |
based on rage-quit support for bash
Put the files below inside ~/.oh-my-zsh/custom/plugins/fuck
Also chmod a+x
the flip
command.
import weakref | |
class ExpensiveObject(object): | |
def __init__(self, name): | |
self.name = name | |
def __del__(self): | |
print '(Deleting %s)' % self | |
obj = ExpensiveObject('Cake') | |
r = weakref.ref(obj) |