使用pyo3调用rust的函数,感觉比pybind11还要简单, 因为rust编译更简单,还有模板工程。 初始化 以下来自官方文档 # (replace string_sum with the desired package name)
在 bash 中 ctrl-u/ctrl-k 是很常用的快捷键,但是 powershell 里没有, notepad $PROFILE 在其中添加以下两行 Set-PSReadLineKeyHandler -Key Ctrl+u -Function BackwardDeleteLine Set-PSReadLineKeyHandler -Key Ctrl+k -Function ForwardDeleteLine 参见这里 和这里
cargo install appimanager appimanager add -n <name> -i <icon> <app-image-file> 如果还想要用到图标,可以把app-image-file先解压了 ./<app-image-file> --appimage-extract 这会在app-image-file旁边建一个squas
Pycharm global config 按两下Shift, 在Searching anything中找到Registry...,将python.debug.asyncio.rep
Ollama介绍 Ollama设计上很像是docker,有一个常驻服务,有一个客户端用来运行命令。 存储也是和docker相似,有很多的层。其中
刚了解下langchain,简单写个 AI助手的langchain版本 Code 安装依赖 pip install langchain langchain-community pyjwt python-dotenv 申请大模型帐号 到这里申请一个智谱AI的帐号,注册就
国内镜像 https://hf-mirror.com/ 具体步骤 创建conda环境,如果不记得,可以参考这里 conda create --name hfd python=3.12.5 conda activate hfd conda install huggingface_hub export HF_ENDPOINT=https://hf-mirror.com # bash $env:HF_ENDPOINT = "https://hf-mirror.com" # pwsh huggingface-cli download --resume-download gpt2 --local-dir gpt2 # 下载模型,gpt2为模型
gpt4free pip install g4f code from typing import List, Any import sys from g4f.client import Client import asyncio if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) def fetch_ai(client: Client, messages: List[Any]) -> str: chunks = [] print("AI: ", end="") stream = client.chat.completions.create( model="gpt-4", messages=messages, stream=True, ) for msg in stream: chunk = msg.choices[0].delta.content if chunk: chunks.append(chunk) print(chunk, end="", flush=True) else: print("") return "".join(chunks) def main(): client = Client() print
git仓库准备 下载我的博客最新版 解压后,到代码根目录执行 git init 删除 themes/LoveIt 文件夹 git submodule add https://github.com/dillonzq/LoveIt.git themes/LoveIt 删除 content/posts 中的所有子文件和子文件夹,但要保留 content/posts 文件 修改 conf
fnm env --use-on-cd | Out-String | Invoke-Expression fnm completions --shell power-shell | Out-String | Invoke-Expression $env:FNM_NODE_DIST_MIRROR="https://npmmirror.com/dist"
conda 使用指南 miniconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda 更改仓库地址: https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/ conda init conda config --set auto_activate_base false 环境管理 conda create --name myenv python=3.9 conda activate myenv conda deactivate conda env list conda remove --name myenv --all 包管理 conda install requests conda list conda update requests conda update all conda list --explicit > a.txt conda install --file a.txt
命令行切换到 system 用户 Windows上默认gitlab-runner是以 system 用户运行的,如果要更改 ci 的运行配置,那就必须要以 system 用户来完成这些设置。
Toga 是一个跨平台的Python GUI库, 支持Android和iOS,有一些简单的控件。它不像kivy那么复杂,kivy要求我们去学习 一种新的脚
下面这个代码是无法编译通过的 class A { public: A(val) : val{val} {} static constexpr A a1{0}; private: int val; }; 不过稍加修改就可以了,参考这里 7.1.5p9 The constexpr specifier [dcl.constexpr] (n3337) A constexpr specifier used in an object declaration declares the object as const. Such an object shall have literal
cargo add 确实挺好用,但是某个crate到底有多少个feature呢,经常连文档都说得不是很清楚。 幸好我们有 cargo feature 可以列出某个crate的所有fea
rust默认的release版仍然挺大的,其实还有改进空间,这里有介绍, 这里有官方文档。简单来说可以在cargo.toml中添加以下内容 strip =
Elm 之前在了解rust的ui时,碰巧了解到了Elm,yew和iced都说参考了它, 而它也标榜自己是 A delightful language for reliable web applications. 昨天终于还是没有忍住,在空闲的
编译安装 说到加密,首先想到的当然是 openssl,但是当我想用mingw64的clang++编译时,发现还需要perl,下载perl发现还是
一般的编译成release之后,找个地方一扔就可以运行了。但是有些时候,我们需要在用户机器上执行个脚本, 然后还要创建几个快捷方式。搞一个安装
说到用Python监控文件夹的变化,大家都是推荐 watchdog, 但是我发现这个工具有的时候会误报,我这里误报之后会执行编译,影响比较大。 然