Skip to content

Instantly share code, notes, and snippets.

"""
.
├── app1
│   └── parent
│   ├── one
│   └── two
├── app2
│   └── parent
│   ├── one
│   └── two.py
# 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([])
@the5fire
the5fire / brower.py
Created April 10, 2018 11:09
简单理解socket模拟浏览器请求
# 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'])
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'
# coding:utf-8
from __future__ import print_function
import gc
import os
import psutil
import sys
import time
# coding:utf-8
from __future__ import print_function
import gc
import os
import psutil
import sys
import time
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
# 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
# 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])) # 二维码回字边
d1 = {
"a1": 1,
"a2": 2,
"a3": 3,
"a4": 4,
"a5": 5,
}
d2 = {
"a4": 90,