Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import multiprocessing | |
from logging.handlers import RotatingFileHandler | |
class SafeRotatingFileHandler(RotatingFileHandler): | |
""" | |
多进程下 RotatingFileHandler 会出现问题 | |
""" | |
_rollover_lock = multiprocessing.Lock() |
From 68bfd9b2ef2da377c65b512451dbfe60be85bc4d Mon Sep 17 00:00:00 2001 | |
From: Serho Liu <serholiu@gmail.com> | |
Date: Sun, 24 May 2015 11:21:58 +0800 | |
Subject: [PATCH] add BasicAuth | |
--- | |
app/GlobalKafkaManager.scala | 75 ++++++++++++++++++++++++++++++++++++++++++++ | |
conf/application.conf | 3 ++ | |
2 files changed, 78 insertions(+) |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: supervisord | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#---author:SErHo----- | |
#---url: https://gist.github.com/2773445 | |
from PyQt4 import QtCore, QtGui | |
from time import sleep | |
class RockPI(QtGui.QWidget): |
#!/usr/bin/env python | |
#-*-coding:UTF-8-*- | |
def f((q, r, t, k)): | |
n = (3 * q + r) / t | |
if (4 * q + r) / t == n: | |
return (10 * q, 10 * (r - n * t), t, k, n) | |
else: | |
return (q * k, q * (4 * k + 2) + r * (2 * k + 1), t * (2 * k + 1), k + 1) |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!