Skip to content

Instantly share code, notes, and snippets.

@misakar
misakar / pytz_patch.py
Created June 12, 2016 14:03 — forked from Xion/pytz_patch.py
Patching pytz with import hook to have usable generic timezones
"""
Import hook extending pytz package with usable, generic timezones:
GMT-14 up to GMT+12.
Note that pytz already has Etc/GMT+X timezones, but
(quoting Wikipedia):
"In order to conform with the POSIX style, those zones beginning with "Etc/GMT"
have their sign reversed from what most people expect. In this style,
zones west of GMT have a positive sign and those east have a negative sign."
@misakar
misakar / tree.md
Created February 17, 2016 14:57 — forked from upsuper/tree.md
一行 Python 实现树

一行 Python 实现树

使用 Python 内置的 defaultdict,我们可以很容易的定义一个树形数据结构:

def tree(): return defaultdict(tree)

就是这样!

@misakar
misakar / tree.md
Created February 17, 2016 14:57 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

00000000 78 03 00 4d 53 57 49 4e 34 2e 31 00 02 08 2a 00 |x..MSWIN4.1...*.|
00000010 02 00 00 00 00 f8 00 00 3f 00 ff 00 00 08 00 00 |........?.......|
00000020 00 f8 0f 00 fd 03 00 00 00 00 00 00 01 01 00 00 |................|
00000030 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 80 00 29 d0 3f 17 96 4e 4f 20 4e 41 4d 45 20 20 |..).?..NO NAME |
00000050 20 20 46 41 54 33 32 20 20 20 00 00 00 00 00 00 | FAT32 ......|
00000060 00 00 00 00 00 00 00 00 60 55 b1 77 35 7f 00 00 |........`U.w5...|
00000070 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000080 00 00 00 00 00 00 00 00 f0 33 00 60 35 7f 00 00 |.........3.`5...|
00000090 ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00 |................|