diff --git a/notes/ai/ai-awesome.md b/notes/ai/ai-awesome.md index 3d58a85f14f..355d75729a4 100644 --- a/notes/ai/ai-awesome.md +++ b/notes/ai/ai-awesome.md @@ -303,6 +303,12 @@ tags: - [outlines-dev/outlines](https://github.com/outlines-dev/outlines) - Apache-2.0 +## Client + +- Web + - [vercel/ai](https://github.com/vercel/ai) + - https://sdk.vercel.ai/docs + ## SelfHost - [BerriAI/litellm](https://github.com/BerriAI/litellm) diff --git a/notes/db/kv/foundationdb.md b/notes/db/kv/foundationdb.md index 9baf49a3fb1..34cccc9846d 100644 --- a/notes/db/kv/foundationdb.md +++ b/notes/db/kv/foundationdb.md @@ -6,8 +6,14 @@ title: FoundationDB - [FoundationDB](https://github.com/apple/foundationdb) - Apache-2.0, C++ + - by Apple + - Cassandra -> FDB - 分布式、事务、KV + - 作为 DynamoDB, Cassandra, HBase 的替代 + - 可以作为别的服务的存储底层: 上层实现 SQL、Document - 参考 + - https://apple.github.io/foundationdb/ + - https://apple.github.io/foundationdb/architecture.html - [FoundationDB/awesome-foundationdb](https://github.com/FoundationDB/awesome-foundationdb) - [FoundationDB/fdb-kubernetes-operator](https://github.com/FoundationDB/fdb-kubernetes-operator) - [FoundationDB/fdb-document-layer](https://github.com/FoundationDB/fdb-document-layer) @@ -18,7 +24,7 @@ title: FoundationDB - [FoundationDB Record Layer: A Multi-Tenant Structured Datastore](https://www.foundationdb.org/files/record-layer-paper.pdf) - [QuiCK: A Queuing System in CloudKit](https://www.foundationdb.org/files/QuiCK.pdf) - [How FoundationDB works and why it works](https://blog.the-pans.com/notes-on-the-foundationdb-paper/) - - https://apple.github.io/foundationdb/architecture.html + - https://news.ycombinator.com/item?id=16877395 :::caution diff --git a/notes/dev/dict.md b/notes/dev/dict.md index 0871ae5d52f..86dabfee239 100644 --- a/notes/dev/dict.md +++ b/notes/dev/dict.md @@ -247,13 +247,14 @@ tags: ### 搜索引擎优化 -| 英文 | 含义 | 释义 | -| -------- | ------------ | ---------------------- | -| SEO | 搜索引擎优化 | Search Engin Optimize | -| UTM | 跟踪模块 | Urchin Tracking Module | -| medium | 媒体 | -| campaign | 活动 | -| term | 词组 | +| 英文 | 含义 | 释义 | +| -------------- | ------------ | ---------------------- | +| SEO | 搜索引擎优化 | Search Engin Optimize | +| UTM | 跟踪模块 | Urchin Tracking Module | +| medium | 媒体 | +| campaign | 活动 | +| term | 词组 | +| Event Tracking | 日志埋点 | ## 投融资 diff --git a/notes/dev/editor/README.md b/notes/dev/ide/README.md similarity index 93% rename from notes/dev/editor/README.md rename to notes/dev/ide/README.md index c89e89d1300..0287135fc96 100644 --- a/notes/dev/editor/README.md +++ b/notes/dev/ide/README.md @@ -1,9 +1,10 @@ --- -title: Editor +title: IDE --- -# Editor +# IDE +- IDE - Integrated Development Environment - [VSC](./vsc.md)/monaco based - [Microsoft/monaco-editor](https://github.com/Microsoft/monaco-editor) - [vscodium](./vscodium.md) diff --git a/notes/dev/editor/atom.md b/notes/dev/ide/atom.md similarity index 100% rename from notes/dev/editor/atom.md rename to notes/dev/ide/atom.md diff --git a/notes/dev/editor/che.md b/notes/dev/ide/che.md similarity index 100% rename from notes/dev/editor/che.md rename to notes/dev/ide/che.md diff --git a/notes/dev/editor/coder.md b/notes/dev/ide/coder.md similarity index 100% rename from notes/dev/editor/coder.md rename to notes/dev/ide/coder.md diff --git a/notes/dev/editor/jetbrain.md b/notes/dev/ide/jetbrain/README.md similarity index 91% rename from notes/dev/editor/jetbrain.md rename to notes/dev/ide/jetbrain/README.md index d11ded17f60..fcf0c4fbff4 100644 --- a/notes/dev/editor/jetbrain.md +++ b/notes/dev/ide/jetbrain/README.md @@ -141,18 +141,3 @@ sharedIndex: - https://www.jetbrains.com/help/webstorm/how-to-improve-product-performance.html - https://blog.jetbrains.com/kotlin/2021/06/simple-steps-for-improving-your-ide-performance/ - -## Code Vision hints evaluation - -- 显示使用情况 -- 占用更多 CPU -- https://www.jetbrains.com/help/rider/Code_Vision.html - -## Cannot connect to already running IDE instance. Exception: Process 621 is still running - -```bash -ls "$HOME/Library/Application Support/JetBrains/IntelliJIdea2023.2" - -ls $HOME/Library/Application\ Support/JetBrains/*/.lock -rm $HOME/Library/Application\ Support/JetBrains/*/.lock -``` diff --git a/notes/dev/ide/jetbrain/jetbrain-faq.md b/notes/dev/ide/jetbrain/jetbrain-faq.md new file mode 100644 index 00000000000..fe64d5e89d9 --- /dev/null +++ b/notes/dev/ide/jetbrain/jetbrain-faq.md @@ -0,0 +1,28 @@ +--- +tags: + - FAQ +--- + +# Jetbrain FAQ + +## macOS 获取 datasource 的密码 + +- 复制 datasource - 实际为 XML +- 粘贴出来,获取到 UUID +- 打开 Keychain Access,在 login 里 搜索 UUID +- 查看密码即可 + +## Code Vision hints evaluation + +- 显示使用情况 +- 占用更多 CPU +- https://www.jetbrains.com/help/rider/Code_Vision.html + +## Cannot connect to already running IDE instance. Exception: Process 621 is still running + +```bash +ls "$HOME/Library/Application Support/JetBrains/IntelliJIdea2023.2" + +ls $HOME/Library/Application\ Support/JetBrains/*/.lock +rm $HOME/Library/Application\ Support/JetBrains/*/.lock +``` diff --git a/notes/service/dev/jetbrain-gateway.md b/notes/dev/ide/jetbrain/jetbrain-gateway.md similarity index 100% rename from notes/service/dev/jetbrain-gateway.md rename to notes/dev/ide/jetbrain/jetbrain-gateway.md diff --git a/notes/dev/editor/theia.md b/notes/dev/ide/theia.md similarity index 100% rename from notes/dev/editor/theia.md rename to notes/dev/ide/theia.md diff --git a/notes/dev/editor/vsc.md b/notes/dev/ide/vsc.md similarity index 100% rename from notes/dev/editor/vsc.md rename to notes/dev/ide/vsc.md diff --git a/notes/dev/editor/vscodium.md b/notes/dev/ide/vscodium.md similarity index 100% rename from notes/dev/editor/vscodium.md rename to notes/dev/ide/vscodium.md diff --git a/notes/devops/web/apisix.md b/notes/devops/web/apisix.md index 303f9862f5c..c5051ac0e20 100644 --- a/notes/devops/web/apisix.md +++ b/notes/devops/web/apisix.md @@ -4,6 +4,14 @@ title: Apache APISIX # Apache APISIX + +:::caution + +- 默认 3 etcd 会占用非常多资源,非常不划算 +- apisix 依赖 etcd 容易出问题 + +::: + - [apache/apisix](https://github.com/apache/apisix) - Apache-2.0, Lua+Nginx/openresty+etcd - 支持 Golang 插件 diff --git a/notes/mgmt/marketing/README.md b/notes/mgmt/marketing/README.md new file mode 100644 index 00000000000..820ac9791c0 --- /dev/null +++ b/notes/mgmt/marketing/README.md @@ -0,0 +1,7 @@ +--- +title: 市场营销 +--- + +# 市场营销 + +- https://en.wikipedia.org/wiki/Marketing diff --git a/notes/reference/growth/LessIsMoreFormula.js b/notes/mgmt/marketing/growth/LessIsMoreFormula.js similarity index 100% rename from notes/reference/growth/LessIsMoreFormula.js rename to notes/mgmt/marketing/growth/LessIsMoreFormula.js diff --git a/notes/reference/growth/formula.mdx b/notes/mgmt/marketing/growth/formula.mdx similarity index 100% rename from notes/reference/growth/formula.mdx rename to notes/mgmt/marketing/growth/formula.mdx diff --git a/notes/mgmt/marketing/marketing-glossary.md b/notes/mgmt/marketing/marketing-glossary.md new file mode 100644 index 00000000000..4c4bcb62db1 --- /dev/null +++ b/notes/mgmt/marketing/marketing-glossary.md @@ -0,0 +1,90 @@ +--- +tags: +- Glossary +--- + + +# 市场营销 + + +- AARRR + - 根据所处时间和场景不同排列也不同 + +| 英文 | 含义 | 释义 | +| ----------------- | ---------------------------- | ----------------------------------------------------- | +| DAU | 日活用户 | Daily Active User | +| WAU | 周活用户 | Monthly Active User | +| MAU | 月活用户 | Monthly Active User | +| YAU | 年活用户 | Yearly Active User | +| active | 活跃 | 一般定义为发生过某个事件 | +| AARRR | 获客、激活、留存、引荐、盈利 | Acquisition、Activation、Retention、Referral、Revenue | +| acquisition | 获客 | 拉入新用户 | +| activation | 激活、活跃 | 初次印象影响 | +| retention | 留存 | 用户持续使用 | +| referral | 引荐 | 推荐给其他人,带来新用户或成交 | +| revenue | 收益 | +| funnel | 漏斗 | +| LTV | 生命周期价值 | Lifetime Value | +| CLV | 客户生命周期价值 | Customer Lifetime Value | +| CAC | 获客成本 | Customer Acquisition Cost | +| segment | 人群、分片 | 以一定的纬度划分用户 | +| magic number | 魔法数字 | 零界点 | +| metric | 指标 | +| KPI | 关键绩效指标 | Key Performance Indicators | +| North star metric | 北极星指标 | +| critical path | 关键路径 | +| behavior | 行为 | +| behavior analysis | 行为分析 | +| behavior event | 行为事件 | +| portrait | 画像 | 尝试理解用户 | +| cluster | 聚类 | 画像方式、使用相似性来定义用户 | +| event | 事件 | +| AB Test | A/B 测试 | 实验验证 | + +- Growth hacking - 增长黑客 + - 专注于快速增长的营销方法 + - 适用于初创公司和快速发展的企业 + - 结合传统的营销策略、产品开发和数据分析,以最小的成本实现最快的增长。 + - 特点 + - 数据驱动 + - 迭代试验 + - 创新思维 + - 用户聚焦 + - 跨职能协作 + - 步骤 + - 设定增长目标 + - 分析和理解用户 - 深入了解目标用户群体,包括他们的需求、行为和痛点。 + - 构建增长团队 - 跨职能团队,集合不同领域的专业知识。 + - 实施增长实验 + - 数据分析和优化 + - 规模化成功策略 + +## 客户生命周期 + +- 意识阶段:消费者开始了解品牌或产品。 +- 考虑阶段:消费者考虑是否购买。 +- 购买阶段:消费者进行首次购买。 +- 保持阶段:保持客户的持续购买和兴趣。 +- 忠诚阶段:客户变成品牌的忠实支持者。 +- 倡导阶段:客户推荐产品给其他人。 + +--- + +- Reach - 触达 +- Acquisition - 获客 +- Conversion - 转化 +- Retention - 留存 +- Loyalty - 忠诚 + +关注于品牌的行为和策略,以及客户在每个阶段的行动。 + +--- + +- Awareness - 意识 +- Interest - 兴趣 +- Desire - 欲望 +- Action - 行动 +- Loyalty - 忠诚 +- Advocacy - 倡导 + +侧重于理解和影响消费者的心理过程,从了解到购买,再到成为品牌的倡导者。 diff --git a/notes/mgmt/mgmt-glossary.md b/notes/mgmt/mgmt-glossary.md new file mode 100644 index 00000000000..1d447956391 --- /dev/null +++ b/notes/mgmt/mgmt-glossary.md @@ -0,0 +1,10 @@ +--- +tags: + - Glossary +--- + +# 管理术语 + +| abbr. | en | cn | +| ----- | ------------------------- | -------------- | +| PMO | Project Management Office | 项目管理办公室 | diff --git a/notes/mgmt/pmp/pmbok.md b/notes/mgmt/pmp/pmbok/README.md similarity index 100% rename from notes/mgmt/pmp/pmbok.md rename to notes/mgmt/pmp/pmbok/README.md diff --git a/notes/mgmt/pmp/pmbok-5th.md b/notes/mgmt/pmp/pmbok/pmbok-5th.md similarity index 100% rename from notes/mgmt/pmp/pmbok-5th.md rename to notes/mgmt/pmp/pmbok/pmbok-5th.md diff --git a/notes/mgmt/pmp/pmbok-summary.md b/notes/mgmt/pmp/pmbok/pmbok-summary.md similarity index 100% rename from notes/mgmt/pmp/pmbok-summary.md rename to notes/mgmt/pmp/pmbok/pmbok-summary.md diff --git a/notes/network/lb.md b/notes/network/lb.md deleted file mode 100644 index 95ed52d1f72..00000000000 --- a/notes/network/lb.md +++ /dev/null @@ -1,29 +0,0 @@ -# Load Balance - -## Tips -* [DPDK](https://en.wikipedia.org/wiki/Data_Plane_Development_Kit) - Data Plane Development Kit - * 直接在网卡开发应用实现抓发,绕过内核处理,做到性能最大化 -* 绕过内核 -* [Netfilter](https://en.wikipedia.org/wiki/Netfilter) - * Linux 提供的内核机制,用于网络相关处理 -* [OpenOnload](https://www.openonload.org/) - * 网络栈 -* [FDio/vpp](https://github.com/FDio/vpp) - [fd.io](https://fd.io/) 的项目 - The Fast Data Project - * open source version of Cisco's Vector Packet Processing (VPP) technology -* 参考 - * [Kernal bypass](https://blog.cloudflare.com/kernel-bypass/) - * 如何绕过内核以提高性能 - * PACKET_MMAP - Linux 接口,快速网络嗅探 - * PF_RING - 加速包捕获,不在 linux 主干 - * Snabbswitch - L2,使用 Lua 编写的框架,对网卡编程,绕过内核网络栈 - * DPDK - * Netmap - * [10 Open Source Load Balancer for HA and Improved Performance](https://geekflare.com/open-source-load-balancer) - * [iqiyi/dpvs](https://github.com/iqiyi/dpvs) - high performance Layer-4 load balancer based on DPDK - * [Building a Billion User Load Balancer](https://news.ycombinator.com/item?id=13354546) - -## NOTE -* LB 需要考虑 - * 支持的协议层级 - * 支持的应用协议 - * 支持的负载权重因子 diff --git a/notes/network/loadbalance.md b/notes/network/loadbalance.md new file mode 100644 index 00000000000..d136fc1d597 --- /dev/null +++ b/notes/network/loadbalance.md @@ -0,0 +1,33 @@ +--- +title: Load Balance +--- + +# Load Balance + +- [DPDK](https://en.wikipedia.org/wiki/Data_Plane_Development_Kit) - Data Plane Development Kit + - 直接在网卡开发应用实现抓发,绕过内核处理,做到性能最大化 +- 绕过内核 +- [Netfilter](https://en.wikipedia.org/wiki/Netfilter) + - Linux 提供的内核机制,用于网络相关处理 +- [OpenOnload](https://www.openonload.org/) + - 网络栈 +- [FDio/vpp](https://github.com/FDio/vpp) - [fd.io](https://fd.io/) 的项目 - The Fast Data Project + - open source version of Cisco's Vector Packet Processing (VPP) technology +- 参考 + - [Kernal bypass](https://blog.cloudflare.com/kernel-bypass/) + - 如何绕过内核以提高性能 + - PACKET_MMAP - Linux 接口,快速网络嗅探 + - PF_RING - 加速包捕获,不在 linux 主干 + - Snabbswitch - L2,使用 Lua 编写的框架,对网卡编程,绕过内核网络栈 + - DPDK + - Netmap + - [10 Open Source Load Balancer for HA and Improved Performance](https://geekflare.com/open-source-load-balancer) + - [iqiyi/dpvs](https://github.com/iqiyi/dpvs) - high performance Layer-4 load balancer based on DPDK + - [Building a Billion User Load Balancer](https://news.ycombinator.com/item?id=13354546) + +## NOTE + +- LB 需要考虑 + - 支持的协议层级 + - 支持的应用协议 + - 支持的负载权重因子 diff --git a/notes/platform/aliyun/README.md b/notes/platform/aliyun/README.md index 2c16016f5f3..e999117238b 100644 --- a/notes/platform/aliyun/README.md +++ b/notes/platform/aliyun/README.md @@ -102,6 +102,8 @@ title: 阿里云 - 2C2G 20% - 24 分/小时 - 最多累计 576 +- 年付 7.3 折, 两年付 6.1折, 三年付 4.8折, 四年付 3.9折,五年付 3.3折 +- 年付 8.5 折, 两年付 7.0折, 三年付 5.5折, 四年付 4.6折,五年付 3.9折 ## ACK diff --git a/notes/platform/aws/amplify.md b/notes/platform/aws/amplify.md new file mode 100644 index 00000000000..9dd3fa27e50 --- /dev/null +++ b/notes/platform/aws/amplify.md @@ -0,0 +1,407 @@ +--- +title: amplify +--- + +# amplify + +## Build + +:::caution + +- 构建前尽量注意选择下更新的构建镜像,老的镜像可能出现各种问题 + +::: + +```yaml +version: 1 +frontend: + phases: + preBuild: + commands: + - nvm use 20 + - npm i -g pnpm + - pnpm install + build: + commands: + - nvm use 20 + - pnpm run build + artifacts: + baseDirectory: .next + files: + - '**/*' + cache: + paths: + - node_modules/**/* +``` + +### amazonlinux:2 + +```dockerfile +# Use the standard Amazon Linux base, provided by ECR/KaOS +# It points to the standard shared Amazon Linux image, with a versioned tag. +FROM amazonlinux:2 + +# https://docs.docker.com/engine/reference/builder/#maintainer-deprecated +LABEL maintainer="Amazon AWS" + +# Framework Versions +ENV VERSION_NODE_8=8.12.0 +ENV VERSION_NODE_10=10.16.0 +ENV VERSION_NODE_12=12 +ENV VERSION_NODE_14=14 +ENV VERSION_NODE_16=16 +ENV VERSION_NODE_17=17 +ENV VERSION_NODE_DEFAULT=$VERSION_NODE_14 +ENV VERSION_RUBY_2_4=2.4.6 +ENV VERSION_RUBY_2_6=2.6.3 +ENV VERSION_BUNDLER=2.0.1 +ENV VERSION_RUBY_DEFAULT=$VERSION_RUBY_2_4 +ENV VERSION_HUGO=0.75.1 +ENV VERSION_YARN=1.22.0 +ENV VERSION_AMPLIFY=6.3.1 + +# UTF-8 Environment +ENV LANGUAGE en_US:en +ENV LANG=en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +## Install OS packages +RUN touch ~/.bashrc +RUN yum -y update \ + && yum -y install \ + alsa-lib-devel \ + autoconf \ + automake \ + bzip2 \ + bison \ + bzr \ + cmake \ + expect \ + fontconfig \ + git \ + gcc-c++ \ + GConf2-devel \ + gtk2-devel \ + gtk3-devel \ + libnotify-devel \ + libpng \ + libpng-devel \ + libffi-devel \ + libtool \ + libX11 \ + libXext \ + libxml2 \ + libxml2-devel \ + libXScrnSaver \ + libxslt \ + libxslt-devel \ + libyaml \ + libyaml-devel \ + make \ + nss-devel \ + openssl-devel \ + openssh-clients \ + patch \ + procps \ + python3 \ + python3-devel \ + readline-devel \ + sqlite-devel \ + tar \ + tree \ + unzip \ + wget \ + which \ + xorg-x11-server-Xvfb \ + zip \ + zlib \ + zlib-devel \ + yum clean all \ + && rm -rf /var/cache/yum + +## Install Hugo +RUN wget https://github.com/gohugoio/hugo/releases/download/v${VERSION_HUGO}/hugo_${VERSION_HUGO}_Linux-64bit.tar.gz \ + && tar -xf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz hugo -C / \ + && mv /hugo /usr/bin/hugo \ + && rm -rf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz + +## Install dotnet sdk and host 3.1 +RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm +RUN yum -y install dotnet-host-3.1.4 +RUN yum -y install dotnet-sdk-3.1 + +## Install amazon dotnet tools +RUN dotnet tool install -g Amazon.Lambda.Tools +RUN dotnet tool install -g Amazon.Lambda.TestTool-3.1 + +## Install python3.8 +RUN wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz +RUN tar xvf Python-3.8.0.tgz +WORKDIR Python-3.8.0 +RUN ./configure --enable-optimizations --prefix=/usr/local +RUN make altinstall + +## Install python3.9 +RUN wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz +RUN tar xvf Python-3.9.0.tgz +WORKDIR Python-3.9.0 +RUN ./configure --enable-optimizations --prefix=/usr/local +RUN make altinstall + +## Install Node +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash +RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm install $VERSION_NODE_8 && nvm use $VERSION_NODE_8 && \ + nvm install $VERSION_NODE_10 && nvm use $VERSION_NODE_10 && \ + npm install -g yarn@${VERSION_YARN} sm grunt-cli bower vuepress gatsby-cli && \ + nvm install $VERSION_NODE_12 && nvm use $VERSION_NODE_12 && \ + npm install -g yarn@${VERSION_YARN} sm grunt-cli bower vuepress gatsby-cli && \ + nvm install $VERSION_NODE_14 && nvm use $VERSION_NODE_14 && \ + npm install -g yarn@${VERSION_YARN} sm grunt-cli bower vuepress gatsby-cli && \ + nvm install $VERSION_NODE_16 && nvm use $VERSION_NODE_16 && chown -R root:root /root/.nvm && \ + npm install -g yarn@${VERSION_YARN} sm grunt-cli bower vuepress gatsby-cli && \ + nvm install $VERSION_NODE_17 && nvm use $VERSION_NODE_17 && chown -R root:root /root/.nvm && \ + npm install -g yarn@${VERSION_YARN} sm grunt-cli bower vuepress gatsby-cli && \ + nvm alias default ${VERSION_NODE_DEFAULT} && nvm cache clear" + +# Handle yarn for any `nvm install` in the future +RUN echo "yarn@${VERSION_YARN}" > /root/.nvm/default-packages + +## Install Ruby 2.4.x and 2.6.x +## https://github.com/rvm/rvm/issues/5096 | https://rvm.io/rvm/security#install-our-keys - The old keyserver is no longer available +RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - && curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && curl -sL https://get.rvm.io | bash -s -- --with-gems="bundler" + +ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +RUN /bin/bash --login -c "\ + rvm install $VERSION_RUBY_2_4 && rvm use $VERSION_RUBY_2_4 && gem install bundler -v $VERSION_BUNDLER && gem install jekyll && \ + rvm install $VERSION_RUBY_2_6 && rvm use $VERSION_RUBY_2_6 && gem install bundler -v $VERSION_BUNDLER && gem install -N jekyll && \ + rvm cleanup all" + +## Install awscli +RUN /bin/bash -c "pip3.8 install awscli && rm -rf /var/cache/apk/*" +RUN /bin/bash -c "pip3.9 install awscli && rm -rf /var/cache/apk/*" + +## Install SAM CLI +RUN /bin/bash -c "pip3.8 install aws-sam-cli" +RUN /bin/bash -c "pip3.9 install aws-sam-cli" + +## Installing Cypress +RUN /bin/bash -c ". ~/.nvm/nvm.sh && \ + nvm use ${VERSION_NODE_DEFAULT} && \ + npm install -g --unsafe-perm=true --allow-root cypress" + +## Install AWS Amplify CLI for all node versions +RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_8} && \ + npm config set user 0 && npm config set unsafe-perm true && \ + npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}" +RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_10} && \ + npm config set user 0 && npm config set unsafe-perm true && \ + npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}" +RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_12} && \ + npm config set user 0 && npm config set unsafe-perm true && \ + npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}" +RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_14} && \ + npm config set user 0 && npm config set unsafe-perm true && \ + npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}" +RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_16} && \ + npm config set user 0 && npm config set unsafe-perm true && \ + npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}" +RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_17} && \ + npm config set user 0 && npm config set unsafe-perm true && \ + npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}" + +## Environment Setup +RUN echo export PATH="/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}/bin:\ +/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}@global/bin:\ +/usr/local/rvm/rubies/ruby-${VERSION_RUBY_DEFAULT}/bin:\ +/usr/local/rvm/bin:\ +/root/.nvm/versions/node/${VERSION_NODE_DEFAULT}/bin:\ +$(python3 -m site --user-base)/bin:\ +$(python3.8 -m site --user-base)/bin:\ +$(python3.9 -m site --user-base)/bin:\ +$PATH" >> ~/.bashrc \ + && echo export GEM_PATH="/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}" >> ~/.bashrc \ + && echo "nvm use ${VERSION_NODE_DEFAULT} 1> /dev/null" >> ~/.bashrc \ + && echo "export PATH=$PATH:/root/.dotnet/tools" >> ~/.bashrc + +ENTRYPOINT [ "bash", "-c" ] +``` + +### amazonlinux:2023 + +```dockerfile +FROM public.ecr.aws/amazonlinux/amazonlinux:2023 + +LABEL maintainer="Amazon AWS" + +###################################################################### +# Environment variable to identify the image version at runtime # +###################################################################### + +ENV AWS_AMPLIFY_BUILD_IMAGE_VERSION=2023-11 + +########################### +# Install OS packages # +########################### + +RUN yum -y update \ + && yum -y install --allowerasing \ + alsa-lib-devel \ + autoconf \ + automake \ + bzip2 \ + bison \ + cmake \ + expect \ + fontconfig \ + gawk \ + gcc-c++ \ + git \ + gnupg2 \ + gtk3-devel \ + libnotify-devel \ + libpng \ + libpng-devel \ + libffi-devel \ + libtool \ + libX11 \ + libXext \ + libxml2 \ + libxml2-devel \ + libXScrnSaver \ + libxslt \ + libxslt-devel \ + libwebp \ + libwebp-devel \ + libyaml \ + libyaml-devel \ + make \ + nss-devel \ + openssl-devel \ + openssh-clients \ + patch \ + procps \ + readline-devel \ + sqlite-devel \ + sudo \ + tar \ + tree \ + unzip \ + vi \ + wget \ + which \ + xorg-x11-server-Xvfb \ + zip \ + zlib \ + zlib-devel \ + bzip2-devel \ + && yum clean all \ + && rm -rf /var/cache/yum + +USER root +ENV HOME=/root + +RUN echo '# Aliases to allow running commands without `sudo`,\n''# pretending to be running as root\n''alias yum="sudo yum"\n''alias dfn="sudo dnf"\n''alias rpm="sudo rpm"\n''alias amazon-linux-extras="sudo amazon-linux-extras"\n''\n''# Load NVM when the shell is initialized\n''export NVM_DIR="$HOME/.nvm"\n''[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"\n''\n' \ + > $HOME/.bashrc + +########################### +# Create Amplify user # +########################### + +RUN adduser --system --uid 900 --create-home --home-dir $HOME amplify \ + && echo "amplify ALL = NOPASSWD : /usr/bin/yum, /usr/bin/dnf, /bin/rpm, /usr/bin/amazon-linux-extras" >> /etc/sudoers \ + && chown -R amplify:amplify $HOME \ + && chmod -R u+w $HOME + +RUN chown root:root /usr/bin +RUN usermod -aG root amplify +RUN chmod 775 /usr/bin + +USER amplify + +##################################### +# Change base working directory # +##################################### + +WORKDIR $HOME +RUN mkdir -p $HOME/bin + +############################################### +# Install NPM, Node, and default packages # +############################################### + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash +ENV NVM_DIR=$HOME/.nvm + +RUN echo \ + '@aws-amplify/cli\n''bower\n''cypress\n''grunt-cli\n''hugo-extended\n''vuepress\n''yarn' \ + > $NVM_DIR/default-packages + +RUN chown amplify:amplify $NVM_DIR/default-packages + +RUN [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" \ + && nvm install 14 \ + && nvm install 16 \ + && nvm install 18 \ + && nvm install 20 \ + && nvm alias default 18 \ + && nvm cache clear + +################################################### +# Install Pyenv, Python, and default packages # +################################################### + +ENV PYENV_ROOT=$HOME/.pyenv +ENV PATH="$PYENV_ROOT/bin:$PATH" + +RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash \ + && git clone https://github.com/jawshooah/pyenv-default-packages.git $PYENV_ROOT/plugins/pyenv-default-packages \ + && echo 'eval "$(pyenv init -)"' >> $HOME/.bashrc + +RUN echo \ + 'awscli >= 1\n''aws-sam-cli >= 1.90.0' \ + > $PYENV_ROOT/default-packages + +RUN chown amplify:amplify $PYENV_ROOT/default-packages + +RUN pyenv install 3.8 \ + && pyenv install 3.9 \ + && pyenv install 3.10 \ + && pyenv install 3.11 \ + && pyenv global 3.10 + +################################################################### +# Create symlinks for old versions of Python, # +# this keeps backwards compatibility with the previous image. # +################################################################### + +USER root +RUN ln -s $HOME/.pyenv/shims/python3.8 /usr/bin/python3.8 \ + && ln -s $HOME/.pyenv/shims/pip3.8 /usr/bin/pip3.8 +USER amplify + +############################################### +# Install RVM, Ruby, and default packages # +############################################### + +ENV RVM_ROOT=$HOME/.rvm/ +ENV PATH="$RVM_ROOT/bin:$PATH" + +RUN command curl -sSL https://rvm.io/mpapis.asc | gpg --import - \ + && command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - \ + && curl -sSL https://get.rvm.io | bash -s stable + +RUN echo \ + 'bundler\n''jekyll\n''jekyll-sass-converter' \ + > $RVM_ROOT/gemsets/default.gems + +RUN chown amplify:amplify $RVM_ROOT/gemsets/default.gems + +RUN rvm install 3.0.6 \ + && rvm install 3.1.4 \ + && rvm install 3.2.2 --default \ + && rvm cleanup all + +ENV PATH="$HOME/bin:$PATH" +RUN echo 'export PATH="$PATH"' >> $HOME/.bashrc +ENTRYPOINT [ "bash", "-c" ] +``` diff --git a/notes/platform/vercel/README.md b/notes/platform/vercel/README.md index 3c141af1cf7..07045646562 100644 --- a/notes/platform/vercel/README.md +++ b/notes/platform/vercel/README.md @@ -4,22 +4,31 @@ title: Vercel # Vercel -- [价格](https://vercel.com/pricing)/[限制](https://vercel.com/docs/concepts/limits/overview) - - Free - - 100 部署/天 - - Serverless Functions 12/部署 - - Serverless Functions 10s 执行时间 - - 没有后台执行概念 - - Pro 60s Enterprise 900s - - 3 Git Repository/Vercel Project - - 内存 1024 MB - - 50 自定义域名 - - 100 GB 带宽每月 +:::tip + +- Free + - 100 部署/天 + - Serverless Functions 12/部署 + - Serverless Functions 10s 执行时间 + - 没有后台执行概念 + - Pro 60s Enterprise 900s + - 3 Git Repository/Vercel Project + - 内存 1024 MB + - 50 自定义域名 + - 100 GB 带宽每月 - Serverless Function - 单个 < 50MB - 解压后 < 250MB - 消息体 5MB - 并发 1000 +- EdgeFunction + - Hobby gzip 1 MB + - Pro gzip 2 MB + - https://vercel.com/docs/functions/edge-functions/limitations + +::: + +- [价格](https://vercel.com/pricing)/[限制](https://vercel.com/docs/concepts/limits/overview) - [Fair Use Policy](https://vercel.com/docs/platform/fair-use-policy) - JAM 站点和应用 - 前端 @@ -44,6 +53,7 @@ title: Vercel - 添加额外包 `yum install jq -y` - [Extras library](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library) + ```bash # 全局安装 npm i vercel -g diff --git a/notes/queue/nats/nats-service.md b/notes/queue/nats/nats-service.md index a8147ccaa17..cfdcdbf5ac4 100644 --- a/notes/queue/nats/nats-service.md +++ b/notes/queue/nats/nats-service.md @@ -13,7 +13,6 @@ $SRV.. $SRV... ``` - - https://github.com/nats-io/nats.deno/blob/main/nats-base-client/service.ts - 标准操作 - `$SRV.PING|STATS|INFO` @@ -131,5 +130,74 @@ type EndpointStats = { - https://github.com/nats-io/nats-architecture-and-design/issues/220 - https://github.com/nats-io/nats-architecture-and-design/issues/206 - https://github.com/nats-io/nats-architecture-and-design/issues/184 - - multiple endpoints on services [#187](https://github.com/nats-io/nats-architecture-and-design/issues/187) + - multiple endpoints on services [#187](https://github.com/nats-io/nats-architecture-and-design/issues/187) - https://github.com/nats-io/nats.go/blob/main/micro/README.md + +```ts +import { Type, Static } from '@sinclair/typebox'; +import { Value } from '@sinclair/typebox/value'; +import { firstOfAsyncIterator } from '@wener/utils'; +import { polyfillWebSocket } from '@wener/utils/server/ws'; +import { connect } from 'nats.ws'; +import { test } from 'vitest'; + +test( + 'nats-service', + async () => { + await polyfillWebSocket(); + + const nc = await connect({ + servers: ['wss://demo.nats.io:8443'], + }); + + console.log(`nats ttl ${await nc.rtt()}ms`); + + const svc = await nc.services.add({ + name: 'test_Service', + version: '1.0.0', + statsHandler: async (ep) => { + console.log(`[STATS] ${ep.subject} ${ep.queue} ${JSON.stringify(ep.metadata)}`); + return null; + }, + queue: 'SVC', + }); + + type HelloRequest = Static; + const HelloRequest = Type.Object({ + name: Type.String(), + }); + + const queue = svc.addEndpoint('hello', { + subject: `test_Service.hello`, + metadata: { + schema: JSON.stringify({ + request: HelloRequest, + }), + }, + }); + Promise.resolve(null).then(async () => { + for await (const msg of queue) { + const str = msg.string(); + const req = Value.Cast(HelloRequest, JSON.parse(str)); + console.log(`[RECV] ${msg.subject}: ${str}`); + msg.respond( + JSON.stringify({ + message: `hello ${req.name}`, + }), + ); + } + }); + + const sc = nc.services.client(); + console.log(await firstOfAsyncIterator(sc.ping('test_Service'))); + console.log(await firstOfAsyncIterator(sc.stats('test_Service'))); + console.log(await firstOfAsyncIterator(sc.info('test_Service'))); + console.log( + (await nc.request('test_Service.hello', JSON.stringify({ name: 'wener' }), { timeout: 1000 * 60 * 60 })).string(), + ); + }, + { + timeout: 60_000, + }, +); +``` diff --git a/notes/reference/growth/glossary.md b/notes/reference/growth/glossary.md deleted file mode 100644 index 191af7387da..00000000000 --- a/notes/reference/growth/glossary.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: glossary -title: 增长相关词汇 ---- - -* AARRR - * 根据所处时间和场景不同排列也不同 - - -英文 | 含义 | 释义 ---------------------|-----------|---- -DAU | 日活用户 | Daily Active User -WAU | 周活用户 | Monthly Active User -MAU | 月活用户 | Monthly Active User -YAU | 年活用户 | Yearly Active User -active | 活跃 | 一般定义为发生过某个事件 -AARRR | 获客、激活、留存、引荐、盈利 | Acquisition、Activation、Retention、Referral、Revenue -acquisition | 获客 | 拉入新用户 -activation | 激活、活跃 | 初次印象影响 -retention | 留存 | 用户持续使用 -referral | 引荐 | 推荐给其他人,带来新用户或成交 -revenue | 收益 -funnel | 漏斗 -LTV | 生命周期价值 | Lifetime Value -CLV | 客户生命周期价值 | Customer Lifetime Value -CAC | 获客成本 | Customer Acquisition Cost -segment | 人群、分片 | 以一定的纬度划分用户 -magic number | 魔法数字 | 零界点 -metric | 指标 -KPI | 关键绩效指标 | Key Performance Indicators -North star metric | 北极星指标 -critical path | 关键路径 -behavior | 行为 -behavior analysis | 行为分析 -behavior event | 行为事件 -portrait | 画像 | 尝试理解用户 -cluster | 聚类 | 画像方式、使用相似性来定义用户 -event | 事件 -AB Test | A/B 测试 | 实验验证 - diff --git a/notes/service/analytics/matomo/README.md b/notes/service/analytics/matomo/README.md index 34162ef46a0..0b66a9952d4 100644 --- a/notes/service/analytics/matomo/README.md +++ b/notes/service/analytics/matomo/README.md @@ -12,6 +12,27 @@ title: Matomo - 插件 - [log-analytics](https://github.com/piwik/piwik-log-analytics) - [how-to](http://piwik.org/docs/log-analytics-tool-how-to/) +- 限制 + - Custom Dimensions 100个 +- 付费功能 - On-Premise 独立付费 + - Activity Log + - WooCommerce Analytics + - Search Engine Keywords Performance + - Funnels + - Users Flow + - White Label + - Heatmap & Session Recording + - A/B Testing + - Custom Reports + - Forms + - Media Analytics + - Roll-Up Reporting + - Advertising Conversion Export + - SEO Web Vitals + - Crash Analytics + - Multi-Channel Conversion Attribution + - Cohorts + - SAML integration :::caution diff --git a/notes/service/api/graphql/graphql-awesome.md b/notes/service/api/graphql/graphql-awesome.md index ca4046877aa..faa51445d96 100644 --- a/notes/service/api/graphql/graphql-awesome.md +++ b/notes/service/api/graphql/graphql-awesome.md @@ -183,9 +183,15 @@ tags: ## Client -- apollo +- graphql + - 164 kB, 41.9 kB +- @apollo/client + - 204kB,60kB - urql -- [graphql-request](https://github.com/prisma-labs/graphql-request) + - @urql/core+wonka + - 40kB,15kB +- [graphql-request](https://github.com/jasonkuhrt/graphql-request) + - 58kB,16kB - fetch + gql - react-query+graphql-request diff --git a/notes/service/api/graphql/graphql-code-generator.md b/notes/service/api/graphql/graphql-code-generator.md index 918f2c0a28a..15a82fe5acc 100644 --- a/notes/service/api/graphql/graphql-code-generator.md +++ b/notes/service/api/graphql/graphql-code-generator.md @@ -8,6 +8,8 @@ title: graphql-code-generator - 基于 GraphQL 的代码生成工具 - 支持的前端框架 urql, apollo, react-query, react, vue, svelte - 支持的后端 Java Resolver, Kotlin, Java, Java Apollo Android +- 参考 + - https://the-guild.dev/graphql/codegen ```bash # 安装 cli - 依赖插件无法 npx diff --git a/notes/service/cms/directus.md b/notes/service/cms/directus.md index 1c8fdef55bf..1d885367c08 100644 --- a/notes/service/cms/directus.md +++ b/notes/service/cms/directus.md @@ -8,8 +8,63 @@ title: Directus - GPL-3.0, NodeJS+Typescript+Vue - Headless CMS - DB -> GraphQL+REST + - 数据库支持 PostgreSQL, MySQL, SQLite, OracleDB, CockroachDB, MariaDB, MS-SQL - [concepts](https://docs.directus.io/concepts/activity/) ```bash -npx create-directus-project example-project +# http://127.0.0.1:8055 +docker run --rm -it \ + -p 8055:8055 \ + -e KEY=replace-with-random-value \ + -e SECRET=replace-with-random-value \ + -e ADMIN_EMAIL=admin@example.com \ + -e ADMIN_PASSWORD=ADMIN_PASSWORD \ + -e DB_CLIENT=sqlite3 \ + -e DB_FILENAME=/directus/database/data.db \ + -e WEBSOCKETS_ENABLED=true \ + -v $PWD/data/database:/directus/database \ + -v $PWD/data/uploads:/directus/uploads \ + -v $PWD/data/extensions:/directus/extensions \ + --name directus directus/directus + +npm init directus-project +``` + +## client + +```bash +npm install @directus/sdk +``` + +```ts +import { createDirectus, rest, graphql } from '@directus/sdk'; + +interface Article { + id: number; + title: string; + content: string; +} + +interface Schema { + articles: Article[]; +} + +// Client with REST support +const client = createDirectus('http://directus.example.com').with(rest()); + +// Client with GraphQL support +const client = createDirectus('http://directus.example.com').with(graphql()); +``` + +## config + +- https://docs.directus.io/self-hosted/config-options.html +- .env +- config.json - KV 同 env +- config.yaml +- config.js - `export default {}`, `export default function(env) {return {}}`, + - env 为 process.env + +```bash +CONFIG_PATH="/path/to/config.js" npx directus start ``` diff --git a/notes/service/cms/keystone.md b/notes/service/cms/keystone.md new file mode 100644 index 00000000000..d7c8fed182b --- /dev/null +++ b/notes/service/cms/keystone.md @@ -0,0 +1,12 @@ +--- +title: keystone +--- + +# keystone + +- [keystonejs/keystone](https://github.com/keystonejs/keystone) + - MIT, TS + - apollo, prisma, React, s3, @hapi/iron, express + - 数据库 PostgreSQL、MySQL、SQLite + - 生成项目,能植入自定义组件和代码 +- https://keystonejs.com/docs/config/config diff --git a/notes/service/cms/strapi.md b/notes/service/cms/strapi.md index 1cff9755fd6..6e8b9b8a150 100644 --- a/notes/service/cms/strapi.md +++ b/notes/service/cms/strapi.md @@ -7,6 +7,7 @@ title: Strapi - [strapi/strapi](https://github.com/strapi/strapi) - MIT+[EE](https://github.com/strapi/strapi/blob/86e0cf0f55d58e714a67cf4daee2e59e39974dd9/packages/strapi-admin/ee/LICENSE) - strapi-admin 包含部分 EE 协议 - Strapi Enterprise Edition + - 生成代码 - 代码在本地 - 半开发半可视化操作的 Headless CMS - 半开发 - 接口、模型、组件、插件均可以代码操作 diff --git a/notes/service/dns/gfwlist.txt b/notes/service/dns/gfwlist.txt index bc72e724f58..62f927dd35e 100644 --- a/notes/service/dns/gfwlist.txt +++ b/notes/service/dns/gfwlist.txt @@ -11,20 +11,32 @@ apache.org api.ai appspot.com arxiv.org +atom.io battle.net bing.com bit.ly blizzard.com +blob.core.windows.net blog blogspot.com cdninstagram.com +cdnjs.com +centos.org +chocolatey.org chrome.com chromecast.com chromestatus.com chromium.org +clojure.org cloudflare.com cloudfront.net +cnpmjs.org +codeberg.org +cygwin.com +cython.org dell.com +deno.land +dependabot.com dev.to digitaloceanspaces.com discord.com @@ -32,6 +44,9 @@ discordapp.net discourse-cdn.com docker.io dribbble.com +elixir-lang.org +elrepo.org +erlang.org f8.com facebook.br facebook.com @@ -42,6 +57,7 @@ facebook.net facebook.nl facebook.se facebookmail.com +fast.com fastly.net fb.com fb.me @@ -50,15 +66,42 @@ fbaddins.com fbcdn.net fbsbx.com fbworkmail.com +ffmpeg.org flxvpn.net +freebsd.org +gentoo.org +getcomposer.org +getzola.org +ghcr.io +git-scm.com +git.io gitbook.com gitbook.io +github-cloud.s3.amazonaws.com +github.blog github.com +github.community +github.dev github.io +githubapp.com githubassets.com +githubhackathon.com +githubnext.com +githubpreview.dev +githubstatus.com +githubuniverse.com githubusercontent.com gle gmail.com +gnu.org +go-lang.com +go-lang.net +go-lang.org +go.dev +godoc.org +golang.com +golang.net +golang.org goog google google.cn @@ -124,6 +167,7 @@ min.io mirror.xyz mozilla.org msecnd.net +myoctocat.com netflix.ca netflix.com netflix.com.au @@ -145,17 +189,22 @@ netlify.app nflxext.com nflximg.com nflximg.net +nflxsearch.net nflxso.net nflxvideo.net nintendo.com nintendo.net nordvpn.com +npm.community +npmjs.com +npmjs.org oculus.com oculuscdn.com onion openai.com openai.io opensource.com +opensource.guide parse.com periscope.tv php.net @@ -174,6 +223,7 @@ reddit.com redditlist.com redditmedia.com redditstatic.com +repo.new rocksdb.org rs slack.com @@ -189,6 +239,7 @@ telegram.org telegramdownload.com telesco.pe thefacebook.com +thegithubshop.com thepiratebay.org tw tweetdeck.com diff --git a/notes/service/geo/geojson.md b/notes/service/geo/geojson.md new file mode 100644 index 00000000000..6065419bba1 --- /dev/null +++ b/notes/service/geo/geojson.md @@ -0,0 +1,109 @@ +--- +title: GeoJSON +--- + +# GeoJSON + +- https://datatracker.ietf.org/doc/html/rfc7946 +- @types/geojson +- 数据类型 + - 包括点(Point) + - 线(LineString) + - 多边形(Polygon) + - 多点(MultiPoint) + - 多线(MultiLineString) + - 多多边形(MultiPolygon) + - 几何集合(GeometryCollection) +- 结构 + - Geometry - 几何 - 描述单个地理空间实体的形状,如点、线或多边形。 + - Feature - 特征 - 包含一个几何对象和一组与之关联的属性。 + - FeatureCollection - 特征集合 +- 坐标系统 WGS 84 + - 先经度后纬度 +- BBox - 边界框 + - 确定对象的地理范围 + - 西南、东北 + - [最小经度, 最小纬度, 最大经度, 最大纬度] +- url + - lat,lon,alt,unc -> latitude, longitude, altitude, uncertainty + +```ts +// Bounding Box +export type BBox = [number, number, number, number] | [number, number, number, number, number, number]; +// x,y,z +export type Position = [number, number] | [number, number, number]; +// 几何对象 +export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection; + +export interface GeoJsonObject { + type: string; + /** + * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. + * The value of the bbox member is an array of length 2*n where n is the number of dimensions + * represented in the contained geometries, with all axes of the most southwesterly point + * followed by all axes of the more northeasterly point. + * The axes order of a bbox follows the axes order of geometries. + * https://tools.ietf.org/html/rfc7946#section-5 + */ + bbox?: BBox | undefined; +} + +export interface Point extends GeoJsonObject { + type: 'Point'; + coordinates: Position; +} + +export interface MultiPoint extends GeoJsonObject { + type: 'MultiPoint'; + coordinates: Position[]; +} + +export interface LineString extends GeoJsonObject { + type: 'LineString'; + coordinates: Position[]; +} + +export interface MultiLineString extends GeoJsonObject { + type: 'MultiLineString'; + coordinates: Position[][]; +} + +export interface Polygon extends GeoJsonObject { + type: 'Polygon'; + coordinates: Position[][]; +} + +export interface MultiPolygon extends GeoJsonObject { + type: 'MultiPolygon'; + coordinates: Position[][][]; +} + +export interface GeometryCollection extends GeoJsonObject { + type: 'GeometryCollection'; + geometries: G[]; +} + +export type GeoJsonProperties = { [name: string]: any } | null; + +export interface Feature extends GeoJsonObject { + type: 'Feature'; + /** + * The feature's geometry + */ + geometry: G; + /** + * A value that uniquely identifies this feature in a + * https://tools.ietf.org/html/rfc7946#section-3.2. + */ + id?: string | number | undefined; + /** + * Properties associated with this feature. + */ + properties: P; +} + +export interface FeatureCollection extends GeoJsonObject { + type: 'FeatureCollection'; + features: Array>; +} +``` diff --git a/notes/service/network/proxy/ghproxy.md b/notes/service/network/proxy/ghproxy.md new file mode 100644 index 00000000000..0f249a53335 --- /dev/null +++ b/notes/service/network/proxy/ghproxy.md @@ -0,0 +1,11 @@ +--- +title: ghproxy +--- + +# ghproxy + +- [hunshcn/gh-proxy](https://github.com/hunshcn/gh-proxy) +- 可用 + - https://ghproxy.com + - https://mirror.ghproxy.com + - https://gh-proxy.com/ diff --git a/notes/service/network/proxy/gost.md b/notes/service/network/proxy/gost.md index fa3efbc61fb..ead54c4a553 100644 --- a/notes/service/network/proxy/gost.md +++ b/notes/service/network/proxy/gost.md @@ -45,6 +45,7 @@ title: gost ::: ```bash +# https://github.com/go-gost/gost/releases/ # macOS curl -LO https://github.com/go-gost/gost/releases/download/v3.0.0-rc10/gost_3.0.0-rc10_darwin_amd64.tar.gz tar zxvf gost*.tar.gz @@ -53,6 +54,8 @@ tar zxvf gost*.tar.gz curl -LO https://github.com/go-gost/gost/releases/download/v3.0.0-rc10/gost_3.0.0-rc10_linux_amd64.tar.gz tar zxvf gost*.tar.gz +mv gost /usr/local/bin/ + # v3 # -L 监听 # -F 转发,支持配置多个,作为转发链 @@ -61,6 +64,9 @@ gost -L http://:8080 -L socks5://:1080 -F http://192.168.1.1:8080 # SNI proxy gost -L sni://:80 -L sni://:443 -F socks5://192.168.1.1:1080 gost -L sni://:8080 -L sni://:8443 +# flag -> config +gost -L sni://:80 -L sni://:443 -F socks5://192.168.1.1:1080 -O yaml > gost.yaml +gost docker run --rm -it \ gogost/gost diff --git a/notes/service/network/proxy/gost.openrc.sh b/notes/service/network/proxy/gost.openrc.sh new file mode 100644 index 00000000000..469583f7266 --- /dev/null +++ b/notes/service/network/proxy/gost.openrc.sh @@ -0,0 +1,26 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon + +name="Gost" +description="GO Simple Tunnel." + +command=/usr/local/bin/gost +command_args="-C /etc/gost/${RC_SVCNAME}.yaml" + +LOGFILE="${LOGFILE:-/var/log/${RC_SVCNAME}.log}" +output_log=${LOGFILE} +error_log=${LOGFILE} + +depend() { + use logger dns + need net +} + +checkconfig() { + # warn this if not found + if [ ! -f "/etc/gost/${RC_SVCNAME}.yaml" ] ; then + eerror "No config ${RC_SVCNAME}.yaml" + return 1 + fi + return 0 +} diff --git a/notes/service/network/vpn/tinc/tinc.openrc.sh b/notes/service/network/vpn/tinc/tinc.openrc.sh new file mode 100644 index 00000000000..68f8444ffe5 --- /dev/null +++ b/notes/service/network/vpn/tinc/tinc.openrc.sh @@ -0,0 +1,42 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon + +name="TincVPN Daemon" +description="tinc is a Virtual Private Network (VPN) daemon that uses tunnelling and encryption to create a secure private network between hosts on the Internet." +description_reload="Reload configuration without exiting" + +# tinc.netname -> netname +NETNAME=${RC_SVCNAME##*.} +: ${TINC_DEBUG:=0} + +command=/usr/sbin/tincd +command_args="-n $NETNAME -d $TINC_DEBUG $TINC_OPTS" +command_args_foreground="-D" + +TINC_LOGFILE="${TINC_LOGFILE:-/var/log/${RC_SVCNAME}.log}" +TINC_ERRFILE="${TINC_ERRFILE:-${TINC_LOGFILE}}" +TINC_OUTFILE="${TINC_OUTFILE:-${TINC_LOGFILE}}" +supervise_daemon_args="--stderr \"${TINC_ERRFILE}\" --stdout \"${TINC_OUTFILE}\"" + +extra_started_commands="reload" +retry="${TINC_RETRY:-TERM/60/KILL/10}" + +depend() { + use logger dns + need net +} + +checkconfig() { + # warn this if not found + if [ ! -f "/etc/tinc/$NETNAME/tinc.conf" ]; then + eerror "No VPN network configured" + return 1 + fi + return 0 +} + +reload() { + ebegin "Reloading configuration" + $supervisor $RC_SVCNAME --signal HUP + eend $? +} diff --git a/notes/web/browser/chrome/chrome-headless.md b/notes/web/browser/chrome/chrome-headless.md index 33f94915bef..4bc660cfc30 100644 --- a/notes/web/browser/chrome/chrome-headless.md +++ b/notes/web/browser/chrome/chrome-headless.md @@ -65,3 +65,18 @@ title: Headless ## playwright vs puppeteer - https://blog.logrocket.com/playwright-vs-puppeteer/ + +## New Headless + +- Chrome 112+ +- 支持 + - --dump-dom + - --screenshot --window-size=412,892 + - --print-to-pdf --no-pdf-header-footer + - --timeout=5000 + - --virtual-time-budget + - 虚拟时间 - setTimeout/setInterval + - 以尽可能快的速度执行任意网页代码,同时使网页相信时间实际上是过去的时间。 +- https://developer.chrome.com/docs/chromium/new-headless +- 实时视图目前仅实现触摸事件 + - https://bugs.chromium.org/p/chromium/issues/detail?id=1410433 diff --git a/notes/web/browser/chrome/puppeteer.md b/notes/web/browser/chrome/puppeteer.md index 7a244871819..69ae26c81b9 100644 --- a/notes/web/browser/chrome/puppeteer.md +++ b/notes/web/browser/chrome/puppeteer.md @@ -13,6 +13,8 @@ title: Puppeteer - Alpine 下有问题 [#7746](https://github.com/puppeteer/puppeteer/issues/7746) - 在 Alpine 下额外安装,然后配置 PUPPETEER_EXECUTABLE_PATH +- 保持浏览器运行 [#8261](https://github.com/puppeteer/puppeteer/issues/8261) + - https://github.com/puppeteer/puppeteer/blob/main/packages/browsers/src/detectPlatform.ts ::: @@ -119,6 +121,17 @@ puppeteer.use( - --disable-extensions-except=/path/to/extension - --load-extension=/path/to/extension +## Notes + +- @puppeteer/browsers + - 安装和启动浏览器 + - 启动 https://github.com/puppeteer/puppeteer/blob/main/packages/browsers/src/launch.ts +- puppeteer-core + - CDP API + - launch & connect + - launch 通过 `@puppeteer/browsers` 启动 + - https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/node/ProductLauncher.ts + # FAQ ## Docker user diff --git a/notes/web/dev/web-dev-awesome.md b/notes/web/dev/web-dev-awesome.md index d9f46ce329e..00e3c1f2a78 100644 --- a/notes/web/dev/web-dev-awesome.md +++ b/notes/web/dev/web-dev-awesome.md @@ -6,7 +6,7 @@ tags: # Web Dev Awesome - bundle size - - https://bundle.js.org/ + - https://bundlejs.com/ - https://bundlephobia.com/ - [privatenumber/minification-benchmarks](https://github.com/privatenumber/minification-benchmarks) - [JamieMason/syncpack](https://github.com/JamieMason/syncpack) diff --git a/notes/web/nodejs/nodejs-awesome.md b/notes/web/nodejs/nodejs-awesome.md index ba47a10e406..095410e5dfb 100644 --- a/notes/web/nodejs/nodejs-awesome.md +++ b/notes/web/nodejs/nodejs-awesome.md @@ -94,6 +94,8 @@ tags: - [Automattic/mongoose](https://github.com/Automattic/mongoose) - object modeling - 有趣 + - [tndrle/node-sqlite3-wasm](https://github.com/tndrle/node-sqlite3-wasm) + - WebAssembly port of SQLite3 for Node.js with file system access - [oguimbal/pg-mem](https://github.com/oguimbal/pg-mem) - [oguimbal/pgsql-ast-parser](https://github.com/oguimbal/pgsql-ast-parser) - [share/sharedb](https://github.com/share/sharedb) @@ -258,9 +260,29 @@ export N_PREFIX=$HOME/n - CUI/Command Line/CLI/Arguement Parser - [minimistjs/minimist](https://github.com/minimistjs/minimist) - [sindresorhus/meow](https://github.com/sindresorhus/meow) - - [tj/commander.js](https://github.com/tj/commander.js) - - yargs - [vercel/arg](https://github.com/vercel/arg) +- CLI Builder + - [tj/commander.js](https://github.com/tj/commander.js) + - [yargs](https://github.com/yargs/yargs) + - MIT, JS + - [oclif](https://github.com/oclif/oclif) + - MIT, TS + - by Salesforce + - 生成 + - used by + - built out of [heroku/cli](https://github.com/heroku/cli) + - [salesforcecli/cli](https://github.com/salesforcecli/cli) + - https://shopify.dev/docs/apps/tools/cli + - https://www.twilio.com/docs/twilio-cli +- CLI Helper/terminal ui/tui/prompt + - [chalk](https://github.com/chalk/chalk) + - execa + - winston + - logging + - [sindresorhus/get-stdin](https://github.com/sindresorhus/get-stdin) + - [sindresorhus/conf](https://github.com/sindresorhus/conf) + - [SBoudrias/Inquirer.js](https://github.com/SBoudrias/Inquirer.js) + - collection of common interactive command line user interfaces - shell/script - [sindresorhus/execa](https://github.com/sindresorhus/execa) - MIT, JS+TS diff --git a/notes/web/nodejs/nodejs-faq.md b/notes/web/nodejs/nodejs-faq.md index 43f950cd261..1b588c5ff98 100644 --- a/notes/web/nodejs/nodejs-faq.md +++ b/notes/web/nodejs/nodejs-faq.md @@ -8,6 +8,15 @@ tags: - NODE_OPTIONS +:::caution + +- 持久化 DB 存储是 NodeJS 的弱项 + - 纯 JS 没有好的存储实现 + - SQLite 依赖 addon + - SQLite over WASM 还不成熟 + +::: + ## Tool Chain - 静态项目 - ViteJS diff --git a/notes/web/react/immer.md b/notes/web/react/immer.md index 47de9501eff..6013f78c833 100644 --- a/notes/web/react/immer.md +++ b/notes/web/react/immer.md @@ -7,6 +7,10 @@ title: immer - [immerjs/immer](https://github.com/immerjs/immer) - 参考 - https://immerjs.github.io/immer/performance/ + - 不支持的场景 https://github.com/unadlib/mutative/blob/main/test/immer-non-support.test.ts + - [unadlib/mutative](https://github.com/unadlib/mutative) + - 类似 immer,但有更多的控制选项 + - 默认不 freeze - 性能更好,能支持更多对象(Map、Set) :::tip diff --git a/notes/web/react/react-faq.md b/notes/web/react/react-faq.md index 17a454bf1e1..315861ba91f 100644 --- a/notes/web/react/react-faq.md +++ b/notes/web/react/react-faq.md @@ -357,3 +357,5 @@ class B extends React.Component { - `<>` - ReactNode - false, null, undefined, true + +## TypeError: Cannot read properties of null (reading 'useRef') diff --git a/notes/web/script/js/js-awesome.md b/notes/web/script/js/js-awesome.md index 4411e4125d3..f3ea95b5afe 100644 --- a/notes/web/script/js/js-awesome.md +++ b/notes/web/script/js/js-awesome.md @@ -103,17 +103,22 @@ tags: - lodash.isEqual - Date & Time - date-fns + - 多错误的容忍度低 + - 可 tree-shaking - dayjs - Fast 2kB alternative to Moment.js + - 接口友好 + - 不可 tree-shaking - Immutable - plugins - duration - - moment + - ~~moment~~ + - 不再维护 - d3-time-format - [chrono-node](https://github.com/wanasit/chrono) - natural language date parser - [moment/luxon](https://github.com/moment/luxon) - - 72kB, 21kB + - 70kB, 21kB - format - number, time, money - [SheetJS/printj](https://github.com/SheetJS/printj) - [numbro](https://github.com/BenjaminVanRyseghem/numbro) @@ -340,6 +345,7 @@ tags: - multiplayer desktop-like workspace - https://news.ycombinator.com/item?id=30983770 - [partykit/partykit](https://github.com/partykit/partykit) + - [streamich/json-joy](https://github.com/streamich/json-joy) - p2p - [hyperhyperspace/hyperhyperspace-core](https://github.com/hyperhyperspace/hyperhyperspace-core) - gnudb diff --git a/notes/web/script/lib/dexie.md b/notes/web/script/lib/dexie.md index e9dfc80554b..753b4df579a 100644 --- a/notes/web/script/lib/dexie.md +++ b/notes/web/script/lib/dexie.md @@ -16,6 +16,14 @@ title: dexie - 参考 - https://dexie.org/docs/DerivedWork +:::caution + +- NodeJS 持久化 [#480](https://github.com/dexie/Dexie.js/issues/480) + - [dumbmatter/fakeIndexedDB](https://github.com/dumbmatter/fakeIndexedDB) + - 内存实现 IndexedDB API - mock 用 + +::: + ```bash npm add dexie dexie-react-hooks ``` @@ -122,3 +130,4 @@ interface ISyncProtocol { - 使用 jQuery 发起 ajax 请求 - [WebSocketSyncProtocol](https://github.com/dexie/Dexie.js/blob/master/samples/remote-sync/websocket/WebSocketSyncProtocol.js) - [WebSocketSyncServer](https://github.com/dexie/Dexie.js/blob/master/samples/remote-sync/websocket/WebSocketSyncServer.js) +- [StorageManager](https://dexie.org/docs/StorageManager) diff --git a/notes/web/spec/web-storage.md b/notes/web/spec/web-storage.md index 2e117c8e6f2..01f0b735900 100644 --- a/notes/web/spec/web-storage.md +++ b/notes/web/spec/web-storage.md @@ -92,6 +92,7 @@ title: WebStorage - spark-md5 - object-path - clone + - https://rxdb.info/nodejs-database.html - [clientdb/clientdb](https://github.com/clientdb/clientdb) - Apache-2.0, Typescript - **in-memory** database, realtime @@ -130,3 +131,9 @@ title: WebStorage - [amark/gun](https://github.com/amark/gun) - syncing decentralized graph data - [isaacs/node-lru-cache](https://github.com/isaacs/node-lru-cache) +- [typicode/lowdb](https://github.com/typicode/lowdb) + - MIT, JS + - Simple and fast JSON database + - 支持 nodejs、browser、memory +- [FrigadeHQ/remote-storage](https://github.com/FrigadeHQ/remote-storage) + - 非常简单的 remoteStorage 实现