Lastest

c语言float和bytes array转换

重点:大小端不要搞错 x86是小端,0x123456,对应4个字节,0x12,0x34,0x56,0x78. 在内存中的存储顺序是 0x78, 0x56, 0x34, 0x12 #include <stdio.h> int main(){ unsigned char buffer[] = {0x46, 0x87, 0x92, 0x64}; float a = 17353.195f; float b = 0; printf("zzzzz ....\n"); unsigned int* pa = (unsigned int*)(&a); unsigned int x = *pa; int x1 = (x >> 24) & 0xFF; int x2 = (x >> 16) & 0xFF; int x3 = (x >> 8) & 0xFF; int x4 = x & 0xFF; printf("%x",x1 ); printf("%x", x2); printf("%x", x3); printf("%x", x4); printf("\n"); un...

地图找出口算法python实现

算法描述 代码实现 import copy m = [ [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, ], [1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, ], [0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, ], [0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, ], [0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, ], [0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, ], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, ], [0, 0, 0, 0, 0, 0, 0, 0, ...

使用Vault管理服务器各种密码

vault简介 安装 在centos上安装 $ sudo yum install -y yum-utils $ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo $ sudo yum -y install vault 在ubuntu上安装 $ sudo apt update && sudo apt install gpg $ wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg >/dev/null $ gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint $ echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_relea...

windows环境pip无法安装dlib库的终极解决

问题 机器学习需要安装dlib库,网上搜索 解决方案在最底部 网上搜索的解决方案 pip install cmake pip install boost pip install dlib 然而,在安装dlib的时候,错误原因不仅限于没有安装cmake。 报错如下 Collecting dlib Using cached dlib-19.24.0.tar.gz (3.2 MB) Preparing metadata (setup.py) ... done Building wheels for collected packages: dlib Building wheel for dlib (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [320 lines of output] running bdist_wheel running build running build_py package init file 'tools\python\dlib\__init__.py' no...

Windows WLS2使用本机ss代理访问github

关键问题 WSL每次启动ip不一样,所以不能用静态方法设置http代理。 WSL会把宿主ip地址写入 获得当前宿主ip地址的方法 cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }' 手动设置代理的方法 $ cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }' 172.29.176.1 $ export https_proxy="http://172.29.190.80:10000" # 下载github库 $ wget https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/face_checkpoints.zip --2022-06-05 01:46:58-- https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/releases/download/v1.0/face_checkpoints.zip 正在连接 172.29.176.1:10000... 已连接。 已发出 Proxy 请求,正在等待回应... 302 Found 位置:https://obj...

写个dockerfile自动部署hugo

创建dockerfile FROM golang:1.17-alpine # Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so: # docker build --build-arg HUGO_BUILD_TAGS=extended . ARG HUGO_BUILD_TAGS ARG CGO=1 ENV CGO_ENABLED=${CGO} ENV GOOS=linux ENV GO111MODULE=on ENV HUGO_VERSION=0.93.3 ENV HUGO_USER=hugo ENV BASE_DIRECORY=/home/hugo ENV SITE_NAME=hugosite ENV HUGO_SITE_DIRECORY=${BASE_DIRECORY}/${SITE_NAME} ENV HUGO_URL=https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz #hugo_extended_0.93.3_Linux-64bit.tar.gz ENV GLIBC_...

php中__METHOD__和_FUNCTION__的区别

话不多说,一段代码实验下 <?php class A{ public function a1(){ echo __FUNCTION__; echo "\n"; echo __METHOD__; echo "\n\n"; } public static function a2(){ echo __FUNCTION__; echo "\n"; echo __METHOD__; echo "\n\n"; } } function a3(){ echo __FUNCTION__; echo "\n"; echo __METHOD__; echo "\n\n"; } $a = new A(); $a->a1(); A::a2(); a3(); 输出如下 a1 A::a1 a2 A::a2 a3 a3 结论 对于类成员函数,METHOD会带上类名,FUNCTION 没有类名 对于非类成员函数,没差别

cat命令提取json中的key

cat连用grep进行筛选,筛选出的json还可以提取key 距离提取满足grep筛选条件的记录,并提取MessageID字段内容 cat log-20210326-* | grep xxx | grep MessageID | grep -Po 'MessageID[" :]+\K[^"]+'

自己想到的一些问题整理

mysql中各种有几种索引,区别是什么 mysql事务等级细节 swoole和传统fpm的区别是什么 高并发场景下的锁

一切事物都需要方法论

一切事物都需要方法论 软件开发也做了好些年了,无数次项目或者组件的重构,已经让我在系统设计上有了一定的经验。在一个领域内,反复的犯错,反复的总结,有一天回头看看自己,或许就能看到提升吧。 我还记得18年在Aurora最后一次开会的场景。我说我打算回国了,吴总忽然就眼睛一酸说了句“留下不好么?”,接着又说“也好,人各有志。系统设计上好好练练,大有可为”。 2020年于我是峰回路转的一年,有些事我以为应该成了的,反倒散了;有些事,我以为无法达成的,倒是成了。散了的,直到此刻,想起来我都是久久不能平静,然而我清楚的知道情绪不能带入工作,情绪不能影响我前进。如果情绪可以换回已经逝去的东西,请加倍来,多么难我都可以忍。 越是失败的领域,我越是需要总结方法论。好在这次积攒了不少"资料"可以复查。 阴阳结合 凡事不能走极端,需要同时具备两种情绪混合的能力。脑袋不要长肌肉,种花的态度去过一生 方法论 以自己的方法去应对,不能一味跟着场景走。需要总结。持续从错误的case中整理

执行时间: 1715939512464.7 毫秒