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 To_hex_str(num): | |
| chaDic = {10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f'} | |
| hexStr = "" | |
| if num < 0: | |
| num = num + 2**32 | |
| while num >= 16: | |
| digit = num % 16 | |
| hexStr = chaDic.get(digit, str(digit)) + hexStr | |
| num //= 16 | |
| hexStr = chaDic.get(num, str(num)) + hexStr |
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
| 已知:人群中千分之一的人会得癌症 | |
| 那么假设就是10000个人,10个人会得癌症 | |
| 患癌症检测成阳性概率为 99%,10个人得癌症,9.9个人检测成阳性,0.1个人检测成阴性 | |
| 健康检测成阴性概率为 99%,9990个人健康,9890.1 个人检测成阳性,99.9个人检测成阳性 | |
| 那么就可以计算出,如果检测成阳性,换癌症概率为: |
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
| useradd steam | |
| passwd steam | |
| # 修改 /etc/sudoers 文件 | |
| chmod u+w /etc/sudoers | |
| ''' | |
| 即执行:vi /etc/sudoers |
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
| # 更新源 | |
| yum update -y | |
| yum upgrade -y | |
| yum install glibc.i686 libstdc++.i686 libcurl.i686 vim screen -y | |
| useradd steam | |
| su steam | |
| cd ~ |
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 requests | |
| from concurrent.futures import ThreadPoolExecutor, as_completed | |
| pool = ThreadPoolExecutor(3) | |
| task_list = set() | |
| targets = [ | |
| 'http://xxx', | |
| 'http://xxx', | |
| 'http://xxx' |
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
| # 调用join表示自身优先执行 | |
| import threading | |
| #定义线程要调用的方法,*add可接收多个以非关键字方式传入的参数 | |
| def action(*add): | |
| for arc in add: | |
| #调用 getName() 方法获取当前执行该程序的线程名 | |
| print(threading.current_thread().getName() +" "+ arc) | |
| #定义为线程方法传入的参数 |
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 get_img_name(img_dir, format="jpg"): | |
| """ | |
| 获取文件夹下format格式的文件名 | |
| :param img_dir: str | |
| :param format: str | |
| :return: list | |
| """ | |
| file_names = os.listdir(img_dir) # 列出当前目录下所有文件 | |
| # 使用 list(filter(lambda())) 筛选出 jpg 后缀的文件 | |
| img_names = list(filter(lambda x: x.endswith(format), file_names)) |
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
| In [1]: import numpy as np | |
| In [2]: arr = np.array([1,2,3,4,5,6]) | |
| In [3]: arr = arr.reshape(2,1,3) | |
| In [4]: arr | |
| Out[4]: | |
| array([[[1, 2, 3]], |
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 cv2 | |
| import re | |
| img_ = cv2.imread('./mistery_picture.bmp') | |
| mi_ = ''.join([str(x) for x in (img_ % 2).reshape(-1)]) | |
| for off_ in range(8): | |
| mi_1 = mi_[off_:] | |
| xxx = (''.join([chr(int(mi_1[8*i:8*(i+1)][::-1], 2)) for i in range(len(mi_1) // 8)])) | |
| print(re.findall('(Iron[\s\S]{,66})', xxx)) |
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 | |
| from __future__ import print_function | |
| import sys,os | |
| #declare -A lcasekey | |
| lcasekey = {} | |
| #declare -A ucasekey | |
| ucasekey = {} |