Skip to content

Instantly share code, notes, and snippets.

View rayepeng's full-sized avatar
🎯
Focusing

raye peng rayepeng

🎯
Focusing
View GitHub Profile
@rayepeng
rayepeng / 患癌症计算
Last active June 15, 2021 06:47
贝叶斯
已知:人群中千分之一的人会得癌症
那么假设就是10000个人,10个人会得癌症
患癌症检测成阳性概率为 99%,10个人得癌症,9.9个人检测成阳性,0.1个人检测成阴性
健康检测成阴性概率为 99%,9990个人健康,9890.1 个人检测成阳性,99.9个人检测成阳性
那么就可以计算出,如果检测成阳性,换癌症概率为:
@rayepeng
rayepeng / To_hex_str.py
Created June 8, 2021 02:12
python 十进制转十六进制字符串
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
@rayepeng
rayepeng / Work_thread.py
Created June 8, 2021 02:16
海康相机多线程
def Work_thread(self,root,panel):
stOutFrame = MV_FRAME_OUT()
img_buff = None
buf_cache = None
numArray = None
while True:
ret = self.obj_cam.MV_CC_GetImageBuffer(stOutFrame, 1000)
if 0 == ret:
if None == buf_cache:
buf_cache = (c_ubyte * stOutFrame.stFrameInfo.nFrameLen)()
@rayepeng
rayepeng / 计网配置.txt
Created June 15, 2021 01:21
计网配置
# 静态路由协议配置
ip route 202.114.66.0 255.255.255.0 202.114.67.5
ip route 202.114.64.0 255.255.255.0 202.114.67.5
ip route 202.114.65.0 255.255.255.0 202.114.67.5
ip route 192.168.1.0 255.255.255.0 202.114.67.5
# RIP配置
@rayepeng
rayepeng / git命令.txt
Created June 15, 2021 01:43
git相关 #git
# git 只克隆最近的分支
git clone --depth=1 https://github.com/c-smile/sciter-sdk
@rayepeng
rayepeng / mac 配置相关
Last active June 21, 2021 08:53
mac #mac #Linux
# 寻找文件大于100M
sudo find / -type f -size +1000M
# 提示app不安全
sudo spctl --master-disable
@rayepeng
rayepeng / 利用FPU获取EIP.txt
Created June 16, 2021 01:38
shellcode 编写
# 参考 https://bbs.pediy.com/thread-256000.htm
利用FPU获取EIP
section .text
BITS 32
global CMAIN
CMAIN:
fldz
@rayepeng
rayepeng / opencv编译
Last active June 21, 2021 23:39
ubuntu 编译软件
cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.14/modules ..
cmake --build .
sudo make install
详情可以参考 https://docs.opencv.org/4.5.2/d7/d9f/tutorial_linux_install.html
function *fetchHttpBin(){
const data = yield fetch('https://httpbin.org/get'); // 等待返回值
console.log(data);
}
function main2(){
const g = fetchHttpBin(); // 获得生成器
g.next()
.value // 执行到next,此时生成器返回 {done, value}
.then( (data)=> data.json()) // 执行到yield,此时会返回promise
function(require, host) { /* global host */
/* eslint-disable block-spacing, no-multi-spaces, brace-style, no-array-constructor, new-cap, no-use-before-define */
'use strict';
// eslint-disable-next-line no-invalid-this, no-shadow
const global = this;
const local = host.Object.create(null);
local.Object = Object;