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
""" | |
. | |
├── app1 | |
│ └── parent | |
│ ├── one | |
│ └── two | |
├── app2 | |
│ └── parent | |
│ ├── one | |
│ └── two.py |
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
# ref:https://stackoverflow.com/a/20308693/938077 | |
from timeit import timeit | |
size = 2**10 | |
allkeys = "0% missing keys", dict([(i, 0) for i in range(size)]) | |
somekeys = "50% missing keys", dict([(i*2, 0) for i in range(size//2)]) | |
nokeys = "100% missing keys", dict([]) | |
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
# author: the5fire.com | |
import re | |
import socket | |
from collections import namedtuple | |
RE_URL = re.compile(r'http://(.*)') | |
RE_CONTENT_LENGTH = re.compile(b'.*Content-Length: (\d+)') | |
EOF = '\r\n\r\n' | |
Response = namedtuple('Response', ['header', 'body']) |
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
Traceback (most recent call last): | |
File "/usr/local/bin/powerline-shell", line 11, in <module> | |
sys.exit(main()) | |
File "/usr/local/lib/python2.7/site-packages/powerline_shell/__init__.py", line 191, in main | |
segment.add_to_powerline() | |
File "/usr/local/lib/python2.7/site-packages/powerline_shell/segments/username.py", line 16, in add_to_powerline | |
if pwd.getpwuid(os.getuid())[0] == "root": | |
KeyError: 'getpwuid(): uid not found: 501' |
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 | |
from __future__ import print_function | |
import gc | |
import os | |
import psutil | |
import sys | |
import time | |
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 | |
from __future__ import print_function | |
import gc | |
import os | |
import psutil | |
import sys | |
import time | |
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 time | |
def is_power(c): | |
m = int(c ** 0.5) | |
candidate_list = range(m, 0, -1) | |
for i in candidate_list: | |
pos = c - i ** 2 | |
if pos < 0: | |
continue |
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 | |
data = """ | |
1)1) (integer) 4 | |
2) (integer) 1332222 | |
3) (integer) 13 | |
4) 1) "SET" | |
2) "database" | |
3) "Redis" | |
2)1) (integer) 4 |
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 | |
# @author: the5fire | |
import sys | |
from io import BytesIO | |
import requests | |
from PIL import Image | |
FEATURE = ''.join(map(str, [0, 0, 0, 0, 0])) # 二维码回字边 |
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
d1 = { | |
"a1": 1, | |
"a2": 2, | |
"a3": 3, | |
"a4": 4, | |
"a5": 5, | |
} | |
d2 = { | |
"a4": 90, |
NewerOlder