This file contains hidden or 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 cProfile import Profile | |
| from functools import wraps | |
| import atexit | |
| _prof = Profile(builtins=False) | |
| def with_profile(func): | |
| @wraps(func) | |
| def wrapped(*args, **kw): | |
| return _prof.runcall(func, *args, **kw) | |
| return wrapped |
This file contains hidden or 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
| <source> | |
| type forward | |
| port 12345 | |
| </source> | |
| <match **> | |
| type forward | |
| buffer_type memory | |
| buffer_chunk_limit 4m | |
| buffer_queue_limit 128 | |
| flush_interval 1s |
This file contains hidden or 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 | |
| # coding: utf-8 | |
| import os | |
| import subprocess | |
| import sys | |
| def escape(x): | |
| return x.replace("'", "\\'").replace('"', '\\"') |
This file contains hidden or 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
| require 'msgpack' | |
| msg = MessagePack::pack("a" * 1024) | |
| while true do MessagePack::unpack(msg) end |
This file contains hidden or 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
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <cmath> | |
| #include <climits> | |
| #include <cfloat> | |
| #include <map> | |
| #include <utility> | |
| #include <set> | |
| #include <iostream> | |
| #include <memory> |
This file contains hidden or 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/python | |
| # coding: utf-8 | |
| """Copy table from mysql to sqlite. | |
| Require: | |
| * SQLAlchemy | |
| * MySQLdb or PyMySQL | |
| Usage: |
This file contains hidden or 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 | |
| import random | |
| import sys | |
| from glob import glob | |
| import os | |
| BASE = os.path.dirname(__file__) | |
| CHARS = 'ABCDEFGHJKMNPQRSTUVWXYZ23456789' | |
| N = int(sys.argv[1]) |
This file contains hidden or 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 bz2 | |
| import re | |
| import sys | |
| R = re.compile('opensocial_viewer_id=(\w+)') | |
| def count_uu(fn): | |
| f = bz2.BZ2File(fn) | |
| acc = set() | |
| for L in f: |
This file contains hidden or 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
| ############## | |
| 詳説 Python 3 | |
| ############## | |
| タイトル未定 | |
| Python 3.3 ベースの、 Python を使って何かをするのではなく、 Python を使いこなすための本。 | |
| みんPyとの違い => プログラミング自体の入門者向けではない |
This file contains hidden or 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
| def reopen_stdio_with_encoding(encoding='utf-8'): | |
| import io | |
| import sys | |
| def reopen(file): | |
| file.__init__(file.detach(), | |
| line_buffering=file.line_buffering, | |
| encoding=encoding) | |
| reopen(sys.stdout) | |
| reopen(sys.stderr) | |
| reopen(sys.stdin) |