编程笔记

lifelong learning & practice makes perfect

VSCode从V1.86起对部分服务器不兼容(remote ssh),出现类似报错

1
You are connected to an OS version that is unsupported by Visual Studio Code

原因可参考文档,从报错提示看,
大部分人遇到的情况是GLIBC版本过低,而VSCode要求版本>=2.28,这是vscode的依赖nodejs要求的

1
2
3
4
5
6
# 基本要求 kernel >= 4.18, glibc >=2.28, libstdc++ >= 3.4.25, Python 2.6 or 2.7, tar
# 可以通过如下命令查看glibc版本
ldd --ersion

# 查看libstdc++ 3.4.25 是否可用
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX

可以升级服务器版本或者降低VSCode版本来解决

老版本

VSCode支持Portable Mode,可以同时安装多个版本,多个版本建

下载链接

root密码

启动powershell,使用命令找出需要重置密码的wsl实例:

1
2
3
4
5
6
wsl --list

# 适用于 Linux 的 Windows 子系统分发版:
# Ubuntu-18.04 (默认)
# docker-desktop
# docker-desktop-data

单个wsl

如果只有一个实例,可以直接使用命令切换到root账号,然后就可以重置密码了(passwd root)

1
wsl.exe --user root

输入2次密码就完成了

1
2
root@DESKTOPxxx:/mnt/c/Users/xxx# passwd root
Enter new UNIX password:

多个wsl

使用-d 指定实例切换到root用户,如:

1
wsl -d Ubuntu-18.04 --user root

sudo密码

sudo密码实际和用户的密码是一个,和上面的方法一致,使用passwd 加用户名重置当前用户的sudo密码

PS:
1️⃣ 建议优先提交DA值高且影响力大的平台
2️⃣ 每个平台的提交要求和规则可能不同,请仔细阅读
3️⃣ 保持提交频率的自然性,避免集中提交
4️⃣ 定期检查外链存活状态
5️⃣ 持续维护和更新已发布的内容


常规热门网站

Google Business Profile | DA 100 | MarketPlace | High Impact

Forbes Technology | DA 94 | Media | High Impact

Guardian Technology | DA 94 | Media | High Impact

Huffingtonpost | DA 94 | Media | High Impact

TechCrunch | DA 93 | Media | High Impact

Mashable | DA 93 | Media | High Impact

Engadget | DA 93 | Media | High Impact

Gizmodo | DA 93 | Media | High Impact

Wired | DA 93 | Media | High Impact

Trustpilot | DA 93 | Review Site | High Impact

Behance | DA 92 | Creative | High Impact

BostInno | DA 92 | Media | High Impact

Digg | DA 92 | Media | High Impact

Fastcompany | DA 92 | Media | High Impact

Softonic | DA 92 | Directory | High Impact

Crunchbase | DA 91 | Directory | High Impact

Stripe | DA 91 | Partner Program | High Impact

Android Authority | DA 91 | Media | High Impact

Healthline | DA 91 | Media | High Impact

MakeUseOf | DA 90 | Media | High Impact

ProductHunt | DA 89 | Launch Platform | High Impact

HackerNews | DA 89 | Forum | High Impact

Atlassian | DA 89 | Community | High Impact

The Register | DA 89 | Media | High Impact

Geekwire | DA 88 | Directory | High Impact

HackerNoon | DA 88 | Media | High Impact

FreeCodeCamp | DA 88 | Forum | High Impact

AlternativeTo | DA 87 | Directory | Medium Impact

Angellist | DA 87 | Jobs | High Impact

BuzzFeed News | DA 87 | Blog | High Impact

YourStory | DA 86 | Media | High Impact

Wellfound | DA 86 | Jobs | High Impact

Mac Stories | DA 82 | Media | High Impact

DEV Community | DA 84 | Community | High Impact

Devpost | DA 84 | Community | High Impact

e27 | DA 77 | Media | High Impact

Sitejabber | DA 74 | Directory | High Impact

Vccircle | DA 73 | Directory | High Impact

FinancesOnline | DA 72 | Media | High Impact

All top startups | DA 72 | Directory | Medium Impact

TrustRadius | DA 70 | Review Site | High Impact

Similar Sites | DA 68 | Review Site | High Impact

Growth Hackers | DA 66 | Community | Low Impact

Startup Grind | DA 65 | Slack Community | Medium Impact

Foundr | DA 64 | Media | Medium Impact

Hashnode | DA 61 | Blogging Platform | High Impact

Betalist | DA 60 | Directory | High Impact

All my faves | DA 60 | Tools | High Impact

Startupxplore | DA 59 | Directory | Medium Impact

Webrazzi | DA 58 | Media | Medium Impact

Slant | DA 58 | Community | Medium Impact

People Ops & HR | DA 58 | Slack Community | Medium Impact

AlphaDigits | DA 57 | Review Site | Medium Impact

Alternative.me | DA 55 | Directory | High Impact

KillerStartup | DA 55 | Media | Medium Impact

Tech directory | DA 55 | Directory | Medium Impact

NextBigWhat | DA 55 | Media | Medium Impact

Venture Village | DA 54 | Media | Medium Impact

Product School | DA 54 | Slack Community | Medium Impact

Changelog | DA 54 | Media | Medium Impact

SoftwareSuggest | DA 52 | Review Site | Medium Impact

CoFoundersLab | DA 51 | Community | Medium Impact

DevDojo | DA 50 | Dev Community | Medium Impact

Betabound | DA 49 | Beta testing | Medium Impact

Serchen | DA 49 | Directory | Medium Impact

Netted | DA 49 | Media | Medium Impact

Lobsters | DA 48 | Launch Platform | Medium Impact

devRant | DA 48 | Community | Medium Impact

Elpha | DA 47 | Community | Medium Impact

eCommerceFuel | DA 47 | Community | Medium Impact

One Thing Well | DA 47 | Blog | Medium Impact

CrozDesk | DA 46 | Review Website | Medium Impact

Fastlane Forum | DA 45 | Community | Medium Impact

Venture Radar | DA 45 | Directory | Low Impact

There’s An AI For That | DA 44 | Directory | Medium Impact

Land Book | DA 44 | Design | Medium Impact

Startupbeat | DA 44 | Media | Medium Impact

Startup Buffer | DA 44 | Directory | Medium Impact

Real World Beta Testing | DA 43 | Beta testing | Medium Impact

Online Geniuses | DA 42 | Slack Community | Medium Impact

Web3Canvas | DA 41 | Blog | Medium Impact

Future Startup | DA 41 | Publication | Medium Impact

SaasGenius | DA 41 | Directory | Medium Impact

Superb Crew | DA 41 | Media | Medium Impact

SaaSHub | DA 40 | Directory | Medium Impact

SaaSworthy | DA 40 | Review Site | Medium Impact

TechPluto | DA 40 | Media | Medium Impact

Futurepedia | DA 40 | AI directory | Medium Impact

Startup Resources | DA 39 | Newsletter | Medium Impact

Tech Tools Directory | DA 38 | Directory | Medium Impact

buildspace | DA 38 | Platform | Medium Impact

Supertools | DA 38 | AI directory | Medium Impact

Web Tools Weekly | DA 37 | Directory | Medium Impact

Submit A Startup | DA 37 | Media | Medium Impact

TopAI.tools | DA 37 | AI directory | Medium Impact

Women in Technology | DA 35 | Slack Community | Medium Impact

Romanian Startups | DA 34 | Directory | Medium Impact

Toolify | DA 34 | AI directory | Low Impact

No Code Founders | DA 33 | Slack Community | Medium Impact

Robin Good’s Tools | DA 33 | Directory | Medium Impact

New Startups | DA 33 | Media | Medium Impact

Promotehour | DA 33 | Directory | Low Impact

iOS Developers | DA 32 | Slack community | Medium Impact

Peerlist | DA 32 | Directory | Medium Impact

Product-Led Alliance | DA 32 | Slack Community | Low Impact

Growmance | DA 32 | Slack Community | Low Impact

GenZ VCs | DA 31 | Slack Community | Medium Impact

Creative Tribes | DA 29 | Community | Low Impact

Startups.watch | DA 29 | MarketPlace | Low Impact

Startuptabs | DA 29 | Directory | Low Impact

Techendo | DA 29 | Directory | Low Impact

founderio | DA 29 | Community | Low Impact

TechLondon | DA 27 | Slack Community | Low Impact

aitools.fyi | DA 27 | AI directory | Low Impact

Easy With AI | DA 27 | AI directory | Low Impact

Landscape | DA 26 | Slack Community | Low Impact

unita | DA 25 | Directory | Low Impact

AI Scout | DA 25 | AI directory | Low Impact

SEOUL Startups | DA 24 | Slack Community | Low Impact

Remotely One | DA 24 | Slack Community | Low Impact

Ai Tool Hunt | DA 24 | AI directory | Low Impact

Postmake | DA 23 | Blog | Low Impact

AppsMirror | DA 22 | Review Site | Low Impact

#TechMasters | DA 22 | Community | Low Impact

Dev Hunt | DA 22 | Launch Platform | Low Impact

Kernal | DA 22 | Idea platform | Low Impact

SaaS AI Tools | DA 22 | AI directory | Low Impact

Tool Scout | DA 20 | AI directory | Low Impact

10Words | DA 20 | Newsletter | Low Impact

AwesomeIndie | DA 20 | Launch Platform | Low Impact

Firebase | DA 20 | Community | Low Impact

Ben Bites News | DA 20 | AI directory | Low Impact

Igniter AI | DA 19 | AI directory | Low Impact

aiwizard | DA 18 | AI directory | Low Impact

Open Startup List | DA 18 | List | Low Impact

CtrlAltCC | DA 18 | Launch Platform | Low Impact

AI Startups | DA 17 | AI directory | Low Impact

FoundersList | DA 17 | Community | Low Impact

MicroLaunch | DA 17 | Directory | Low Impact

AI Depot | DA 17 | AI directory | Low Impact

AI Tools Directory | DA 28 | AI directory | Low Impact

Startup Europe | DA 16 | Directory | Low Impact

Apprater | DA 16 | Launch Platform | Medium Impact

Indie London | DA 15 | Slack Community | Low Impact

1000 Tools | DA 15 | Directory | Medium Impact

AI Tool Details | DA 15 | AI directory | Low Impact

FeedMyStartup | DA 15 | Media | Low Impact

AI ToolBoard | DA 14 | AI directory | Low Impact

Outreach Desk | DA 14 | Slack Community | Low Impact

Broadwise | DA 14 | Community | Low Impact

SaaS Directory | DA 13 | Directory | Low Impact

The AI Warehouse | DA 12 | AI directory | Low Impact

Hackers Pad | DA 12 | Community | Low Impact

Microsoft Dev Chat | DA 12 | Community | Low Impact

The Ultimate ChatGPT Database | DA 11 | AI directory | Low Impact

Startup Roulette | DA 11 | Directory | Low Impact

Snowball club | DA 10 | Community | Low Impact

Mad Genius | DA 9 | AI directory | Low Impact

Belkins B2B Sales | DA 8 | Slack Community | Low Impact

Future AGI Tools | DA 8 | AI directory | Low Impact

Founderopedia | DA 7 | Slack Community | Low Impact

Silicon Prairie Tech | DA 7 | Community | Low Impact

SaaSBaba | DA 6 | AI directory | Low Impact

AI Marketing Directory | DA 6 | AI directory | Low Impact

Reddit 社区

r/GrowthHacking | Subreddit | High Impact

r/Marketing | Subreddit | High Impact

r/Sales | Subreddit | High Impact

r/startup_resources | Subreddit | High Impact

r/startup | Subreddit | High Impact

r/streetwearstartup | Subreddit | Medium Impact

r/VentureCapital | Subreddit | Medium Impact

r/SweatyStartup | Subreddit | Medium Impact

r/testmyapp | Subreddit | Medium Impact

r/eCommerce | Subreddit | Medium Impact

r/EmailMarketing | Subreddit | Medium Impact

r/NoCodeSaaS | Subreddit | Low Impact

r/Plugyourproduct | Subreddit | Low Impact

r/Retail | Subreddit | Low Impact

r/VenturedCapital | Subreddit | Low Impact

r/WebMarketing | Subreddit | Low Impact

r/Socialpreneur | Subreddit | Low Impact

r/AlphaandBetausers | Subreddit | Low Impact

r/growinpublic | Subreddit | Low Impact

r/GrowMyBusiness | Subreddit | Low Impact

r/DotCom | Subreddit | Low Impact

Discord 社区

Furlough | Discord Community | Medium Impact

Makers HQ | Discord Community | Medium Impact

Tech Startup Community | Discord Community | Low Impact

Stripe Discord Server | Discord Community | Low Impact

OpenAI discord Server | Discord Community | Low Impact

Retool Discord Server | Discord Community | Low Impact

Loqol Startup Community | Discord Community | Low Impact

Makers Community | Discord Community | Low Impact

Startup India | Discord Community | Low Impact

Makerspace | Discord Community | Low Impact

LinkedIn 社区

Entrepreneur’s network | LinkedIn Group | Low Impact

Band of Entrepreneurs | LinkedIn Group | Low Impact

Startup Specialists Group | LinkedIn Group | Low Impact

Executive Suite | LinkedIn Group | Low Impact

On Startups | LinkedIn Group | Low Impact


📌 DA 值会随时间变化,提交前请重新验证。

ref

参与链接

活动连接

限制

需要账号是RDS首购才能拿到奖励,不清楚的可进钉钉群问,需要购买7天的Mysql套餐(54元)

奖励

限首购用户】前2000名完成阶段二的:【任务1-产品开通】、【任务2-动手实验】、【任务3-动手实验】,可获得价值200元的冬日暖心礼盒:100元电话充值卡+定制办公礼(保温杯、笔记本、签字笔),任务1开通的产品7天到期自动会释放,鼓励根据学习内容多进行产品体验实践,若用户提前手动释放,则视为放弃领奖资格(入群填写信息,活动结束后统一发放)

任务

任务1-产品开通

购买54这款即可,不需要做为何更改

购买54这款即可,不需要做为何更改

任务2/3-动手实验

按照实验手册一步步操作即可,官方会提供资源,页面上的浏览器有点卡顿需要耐心操作

概念

大语言模型(LLM)

大语言模型(英文:Large Language Model,缩写LLM)是一种人工智能模型,旨在理解和生成人类语言。它们在大量的文本数据上进行训练,可以执行广泛的任务,包括文本总结、翻译、情感分析等等。LLM的特点是规模庞大,包含数十亿的参数。

LangChain

LangChain是一个强大的框架,旨在帮助开发人员使用语言模型构建端到端的应用程序。它提供了一套工具、组件和接口,可简化创建由大型语言模型 (LLM) 和聊天模型提供支持的应用程序的过程。LangChain 可以轻松管理与语言模型的交互,将多个组件链接在一起,并集成额外的资源,例如 API 和数据库。

组件和链(Components and Chains)

  • 组件(Component) 是模块化的构建块,可以组合起来创建强大的应用程序。
  • 链(Chain) 是组合在一起以完成特定任务的一系列组件(或其他链)。

例如,一个链可能包括一个提示模板、一个语言模型和一个输出解析器,它们一起工作以处理用户输入、生成响应并处理输出。

提示模板和值(Prompt Templates and Values)

  • 提示模板(Prompt Template) 负责创建提示值,这是最终传递给语言模型的内容。
  • 提示值(Prompt Values) 是具有方法的类,这些方法可以转换为每个模型类型期望的确切输入类型(如文本或聊天消息)。

输出解析器(Output Parsers)

负责将语言模型响应构建为更有用的格式。

LlamaIndex

LlamaIndex 使用 LangChain 的 LLM 模块并允许自定义底层 LLM。LlamaIndex 是一个强大的工具,它提供了一个中央接口来将 LLM 与外部数据连接起来,并允许你根据你提供的数据创建一个聊天机器人。使用 LlamaIndex,您无需成为 NLP 或机器学习专家。您只需要提供您希望聊天机器人使用的数据,LlamaIndex 会处理剩下的事情。

Hugging Face

Hugging Face 是一个提供预训练模型和工具的平台,帮助开发者更轻松地使用和部署大语言模型。

嵌入(Embedding)

嵌入是将文本数据转换为数值向量的过程,这些向量可以被机器学习模型理解和处理。嵌入技术在大语言模型中起着关键作用,因为它允许模型在向量空间中表示和比较文本。

方案

Google NotebookLM

Google NotebookLM,上传文档与LM交互,可直接在线体验

阿里云 DashVector x LLM

DashVector 是阿里云推出的一个高性能向量数据库,专门用于存储和检索大规模的向量数据。它能够高效地支持嵌入向量的存储和相似度搜索,非常适合与大语言模型结合使用,实现基于本地知识库的问答系统。

集成步骤

安装依赖:首先需要安装 DashVector SDK 和 LangChain 相关的库。

1
pip install dashvector langchain

使用 DashVector SDK,你可以轻松地使用 DashVector 存储和检索向量数据。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 初始化 DashVector 客户端:创建一个 DashVector 客户端实例,用于与 DashVector 数据库进行交互。
from dashvector import Client

client = Client(api_key="your_api_key", host="your_host")

# 创建向量索引:根据你的知识库内容,创建相应的向量索引。
index = client.create_index(name="knowledge_base", dimension=768)

# 插入数据:将知识库中的文档转换为嵌入向量,并插入到 DashVector 中。
from transformers import AutoTokenizer, AutoModel
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = AutoModel.from_pretrained("bert-base-uncased")

def encode(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
return outputs.last_hidden_state.mean(dim=1).squeeze().tolist()

documents = ["文档内容1", "文档内容2", ...]
vectors = [encode(doc) for doc in documents]

index.insert(vectors)

# 构建检索链:使用 LangChain 构建一个检索链,结合 DashVector 进行向量检索,并将检索结果作为上下文传递给大语言模型。
from langchain.chains import RetrievalQA
from langchain.vectorstores import DashVectorStore
from langchain.llms import OpenAI

llm = OpenAI(api_key="your_openai_api_key")
vector_store = DashVectorStore(client=client, index_name="knowledge_base")
qa_chain = RetrievalQA(llm=llm, retriever=vector_store.as_retriever())

# 查询示例
question = "你的查询问题"
answer = qa_chain.run(question)
print(answer)

GPT4All + LangChain

FASTGpt + One-api + 阿里云 DashScope

开源项目 FastGpt 构建本地知识库,通过 one-api 调用非 ChatGPT 的大语言模型(为非 OpenAI 的 LLM 提供类似 ChatGPT 接口),阿里的 DashScope 有通义千问、Llmma2、通义万相、姜子牙通用大模型等 LLM 接口可供使用。

工具

参考

为什么有时候mysql不区分大小写

业务要求一个数据必须是唯一的,通过

1
select xx,count(*) from xxx group by xx

发现有重复数据,进一步发现有的其实不是重复,大小写不同,这就引出一个问题:为什么有时候mysql不区分大小写

阅读全文 »

单测

在vscode中,带_test的go源文件里的测试函数有有专门的优化,可点击”run test”,”debug test”一键测试

配置

在settings.json可以指定go buld参数如ldfalgs,gcflags等

1
2
3
4
5
6
7
8
9
10
"go.buildFlags": [
"--ldflags -r=${workspaceRoot}/lib" // works for 'debug test' but not 'run test'
// "-ldflags=-r ${workspaceRoot}/lib" // works for 'run test' but not 'debug test'
],
"go.buildTags": "linux",
"gopls": {
"build.buildFlags": [
"-tags=linux",
]
}
阅读全文 »

gopls

gopls是go官方维护的工具,提供代码提示,补全,格式化等诸多功能,之前的版本在vscode+wsl里使用,内存/cpu占
用都不小,大项目打开时容易卡顿.
在2023.9.8官方发文提到了新版本所做的优化和实现原理,更新
体验了下,确实有明显的体验提升.

使用以下命令更新

1
go install golang.org/x/tools/gopls@latest

目前最新版本是 golang.org/x/tools/gopls v0.13.2

更新内容

Reductions in memory use and startup time

减少内存占用,启动时间,官方测试了28个github上流行的项目大部分可减少60%~80%的内存占用

Across these repos, the savings average around 75%, but memory reductions are non-linear: as projects get larger, so does the relative decrease in memory usage. We’ll explain this in more detail below.

在这些存储库中,平均节省约75%,但内存减少是非线性的:随着项目变大,内存使用的相对减少也是如此

Separate compilation

之前,go原本最小的编译单位是package,为了获取import的package信息,需要将所有import的package提前编译好

在v0.12开始通过使用package summary和file-based cache优化最小编译单元,使gopls可以重用部分已编译的package

Fine-grained invalidation

在之前,对package代码做了变更后,gopls必须重新编译直接或间接import该package的package(增量构建系统的基本原理)

When you make a change in one package, it’s only necessary to recompile the packages that import that one, directly or indirectly. This idea is the basis of all incremental build systems since Make in the 1970s, and gopls has been using it since its inception

从v0.12开始,只要代码变更不影响import summary就不需要重新编译

optimize static anlysis

在此之前,gopls无法实现在内存中做太多static anlysis(会引入大量依赖,内存占用飙升)

v0.12优化内存占用后引入了新的anlysis,实现类似go vet的静态分析

参考

问题

在SpringCloud应用里使用protobuf,通过Maven编译生成对应的类,结果有一个类Idea飘红,无法跳转

1
2
3
message Position{
double x = 1;
}
  • Position正常情况下,应该生成 Position 和 PositionOrBuilder 2个类,出现的问题是Position类飘红,无法跳转

  • 安装了Idea官方插件”Protocol Buffers”,正常能从Protobuf文件中的定义跳转到生成的类上,Position只能跳转到
    PositionOrBuilder上

  • 在Protobuf文件中还定义了多个其他类,都能正常生成

结果

发现是生成的类文件过大,修改Idea配置,解决”The file size exceeds configured limit”
问题后能正常跳转了

file size exceeds configured limit

Idea菜单栏点击”Help”->”Edit custom properties” 添加下面的配置,修改文件大小限制

1
2
# custom IntelliJ IDEA properties
idea.max.intellisense.filesize=50000
阅读全文 »