Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wenerme committed Mar 6, 2024
1 parent d90fb28 commit 6e203e9
Show file tree
Hide file tree
Showing 74 changed files with 1,185 additions and 250 deletions.
1 change: 1 addition & 0 deletions notes/ai/ai-awesome.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ tags:
- https://github.com/bbycroft/llm-viz
- https://intro-llm.github.io/
- 大规模语言模型:从理论到实践
- https://spreadsheets-are-all-you-need.ai
- [tyxsspa/AnyText](https://github.com/tyxsspa/AnyText)
- by Alibaba
- [janhq/jan](https://github.com/janhq/jan)
Expand Down
11 changes: 9 additions & 2 deletions notes/blockchain/blockchain-awesome.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,21 @@ tags:
- connect a wallet
- [wagmi-dev/wagmi](https://github.com/wagmi-dev/wagmi)
- React Hooks for Ethereum
- API
- API/Blockchain API Provider/Proxy
- [graphprotocol/graph-node](https://github.com/graphprotocol/graph-node)
- Apache-2.0, MIT, Rust
- indexes data from blockchains such as Ethereum and serves it over GraphQL
- [llamanodes/web3-proxy](https://github.com/llamanodes/web3-proxy)
- GPLv3, Rust
- https://eth.wiki/json-rpc/API
- https://stripe.com/zh-cn-hk/use-cases/crypto
- https://api.coingecko.com/api/v3/simple/price
- https://api.etherscan.io/api
- https://sentinel.matic.network/api/v2/validators/metadata/totalStake
- infura.io
- 10w/day
- AWS
- Moralis
- Misc
- [makerdao/multicall](https://github.com/makerdao/multicall)
- [makerdao/awesome-makerdao](https://github.com/makerdao/awesome-makerdao)
Expand Down Expand Up @@ -225,7 +233,6 @@ curl 'https://api.etherscan.io/api?module=stats&action=ethprice&apikey=YourApiKe
| | 11155111 | ETH | Sepolia | | https://sepolia.dev/ | https://sepolia.etherscan.io/ |
| | | | Holesky |


- rETH - rinkeby ETH
- Faucet
- https://faucetlink.to/
Expand Down
5 changes: 5 additions & 0 deletions notes/blockchain/eth/eth-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ tags:
- 混币器
- https://paper.seebug.org/1497/
- https://mirror.xyz/0xd05cFA28Eaf8B4eaFD8Cd86d33c6CeD1a1875417/YLDoqqD756FXh8Ps40c6uCOwpZZBL40V-QRP8qzn_SI

## cannot estimate gas; transaction may fail or may require manual gas limit

- 可能是交易注定会失败 - 例如 assert 失败
- https://docs.ethers.org/v5/troubleshooting/errors/#help-UNPREDICTABLE_GAS_LIMIT
7 changes: 6 additions & 1 deletion notes/db/db-awesome.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ curl --request POST \

## SQLite Awesome


- [dgllghr/stanchion](https://github.com/dgllghr/stanchion)
- Column
- [proofrock/ws4sqlite](https://github.com/proofrock/ws4sqlite)
Expand Down Expand Up @@ -364,6 +363,12 @@ curl --request POST \
- [Open Source SQL Parsers](https://tokern.io/blog/open-source-sql-parsers/)
- [HN](https://news.ycombinator.com/item?id=31107231)
- https://stripe.com/en-gb/sigma
- [runreveal/pql](https://github.com/runreveal/pql)
- Golang
- Pipelined Query Language
- https://news.ycombinator.com/item?id=39539252
- [Azure Kusto Query Language (KQL)](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/)
- Azure appinsights logs

## 迁移/升级/Schema 变更/Migration {#migration}

Expand Down
5 changes: 4 additions & 1 deletion notes/db/design-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@ tags:
- ts 10msec 39bit + machine 16bit + sequence 8bit
- 174 years
- 处理更多的 instance
- UUIDv7
- [UUIDv7](https://www.ietf.org/archive/id/draft-ietf-uuidrev-rfc4122bis-00.html#name-uuid-version-7)
- `{unix_ts_ms:48 bit}{ver:4bit}{rand_a:12bit}{var:2bit}{rand_b:64bit}`
- 兼容 UUID
- 有序 - 时间戳
- 类似于 ULID
- [craigpastro/pg_uuidv7](https://github.com/craigpastro/pg_uuidv7)
- Postgres extension
- [NanoID](https://github.com/ai/nanoid)
- 一般不直接用于 DB, 前端用的多
- `A-Za-z0-9_-`
Expand Down
11 changes: 11 additions & 0 deletions notes/db/relational/mssql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: MSSQL
---

# MSSQL

| port | for |
| ---- | --------------- |
| 1433 | default |
| 1434 | browser service |

4 changes: 3 additions & 1 deletion notes/db/relational/postgresql/postgraphile.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: PostGraphile

# PostGraphile

- [graphile/postgraphile](https://github.com/graphile/postgraphile) 是什么?
- [graphile/crystal](https://github.com/graphile/crystal)
- Crystal Monorepo for Grafast, PostGraphile, pg-introspection, pg-sql2
- postgraphile
- GraphQL over PostgreSQL
- 强调 DB 设计 - 先 DB 后 GraphQL
- TypeScript+NodeJS 实现
Expand Down
42 changes: 31 additions & 11 deletions notes/db/schema/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
## Rules
---
title: Service Schema
---

- singularity
# 数据和结构

## 规则

- 主键 `tagid_ULID``tagid_UUIDv7`
- 表名单数形式 - singularity
- 特殊情况除外 - users, roles - 避免冲突
- table prefix over schema
- wecom.users -> wecom_users
- 把 schema 保留给业务/租户
- 让 schema 更容易迁移
- 避免出错
- 用 表 记录枚举
- 用 表 记录 EntitySchema
- 服务分层为
- Resource - REST, GQL
- EntityService - RPC - 走网络
- Entity - Native
- DB

## i18n

1. multi column
```sql
create table article
(
title text,
title_en text
);
```
```sql
create table article
(
title text,
title_en text
);
```
2. by message id
```sql
create table message
Expand All @@ -31,6 +51,6 @@
id text,
title jsonb
);
insert into message (id, title)
insert into message (id, title)
values ('help','{"zh_CN":"","en":""}'::jsonb);
```
```
104 changes: 52 additions & 52 deletions notes/db/schema/pg-boss/schema.pg.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,83 @@

CREATE TABLE version
(
version int primary key,
maintained_on timestamp with time zone,
cron_on timestamp with time zone
version int primary key,
maintained_on timestamp with time zone,
cron_on timestamp with time zone
);

CREATE TYPE job_state AS ENUM (
'${states.created}',
'${states.retry}',
'${states.active}',
'${states.completed}',
'${states.expired}',
'${states.cancelled}',
'${states.failed}'
)
'${states.created}',
'${states.retry}',
'${states.active}',
'${states.completed}',
'${states.expired}',
'${states.cancelled}',
'${states.failed}'
)
;
CREATE TABLE job
(
id uuid primary key not null default gen_random_uuid(),
name text not null,
priority integer not null default (0),
data jsonb,
state job_state not null default ('${states.created}'),
retryLimit integer not null default (0),
retryCount integer not null default (0),
retryDelay integer not null default (0),
retryBackoff boolean not null default false,
startAfter timestamp with time zone not null default now(),
startedOn timestamp with time zone,
singletonKey text,
singletonOn timestamp without time zone,
expireIn interval not null default interval '15 minutes',
createdOn timestamp with time zone not null default now(),
completedOn timestamp with time zone,
keepUntil timestamp with time zone NOT NULL default now() + interval '14 days',
on_complete boolean not null default false,
output jsonb
id uuid primary key not null default gen_random_uuid(),
name text not null,
priority integer not null default (0),
data jsonb,
state job_state not null default ('${states.created}'),
retryLimit integer not null default (0),
retryCount integer not null default (0),
retryDelay integer not null default (0),
retryBackoff boolean not null default false,
startAfter timestamp with time zone not null default now(),
startedOn timestamp with time zone,
singletonKey text,
singletonOn timestamp without time zone,
expireIn interval not null default interval '15 minutes',
createdOn timestamp with time zone not null default now(),
completedOn timestamp with time zone,
keepUntil timestamp with time zone NOT NULL default now() + interval '14 days',
on_complete boolean not null default false,
output jsonb
);

CREATE TABLE archive
(
LIKE job
LIKE job
);
ALTER TABLE archive
ADD archivedOn timestamptz NOT NULL DEFAULT now();
ADD archivedOn timestamptz NOT NULL DEFAULT now();
-- SINGLETON_QUEUE_KEY_ESCAPED -> __pgboss__singleton_queue
CREATE INDEX archive_archivedon_idx ON archive (archivedon);
CREATE INDEX archive_id_idx ON archive (id);
CREATE UNIQUE INDEX job_singletonKey ON job (name, singletonKey)
WHERE state < '${states.completed}'
AND singletonOn IS NULL
AND NOT singletonKey LIKE '${SINGLETON_QUEUE_KEY_ESCAPED}%';
WHERE state < '${states.completed}'
AND singletonOn IS NULL
AND NOT singletonKey LIKE '${SINGLETON_QUEUE_KEY_ESCAPED}%';
CREATE UNIQUE INDEX job_singleton_queue ON job (name, singletonKey)
WHERE state < '${states.active}'
AND singletonOn IS NULL
AND singletonKey LIKE '${SINGLETON_QUEUE_KEY_ESCAPED}%';
WHERE state < '${states.active}'
AND singletonOn IS NULL
AND singletonKey LIKE '${SINGLETON_QUEUE_KEY_ESCAPED}%';
CREATE UNIQUE INDEX job_singletonOn ON job (name, singletonOn)
WHERE state < '${states.expired}' AND singletonKey IS NULL;
WHERE state < '${states.expired}' AND singletonKey IS NULL;
CREATE UNIQUE INDEX job_singletonKeyOn ON job (name, singletonOn, singletonKey)
WHERE state < '${states.expired}';
WHERE state < '${states.expired}';
CREATE INDEX job_name ON job (name text_pattern_ops);
CREATE INDEX job_fetch ON job (name text_pattern_ops, startAfter) WHERE state < '${states.active}';

CREATE TABLE schedule
(
name text primary key,
cron text not null,
timezone text,
data jsonb,
options jsonb,
created_on timestamp with time zone not null default now(),
updated_on timestamp with time zone not null default now()
name text primary key,
cron text not null,
timezone text,
data jsonb,
options jsonb,
created_on timestamp with time zone not null default now(),
updated_on timestamp with time zone not null default now()
);
CREATE TABLE subscription
(
event text not null,
name text not null,
created_on timestamp with time zone not null default now(),
updated_on timestamp with time zone not null default now(),
PRIMARY KEY (event, name)
event text not null,
name text not null,
created_on timestamp with time zone not null default now(),
updated_on timestamp with time zone not null default now(),
PRIMARY KEY (event, name)
);
15 changes: 15 additions & 0 deletions notes/dev/dev-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,21 @@ tags:
- /health/live
- /health/ready

---

- /ready, /readyz
- 是否准备好接受请求
- /livez, /live
- alive/up and running
- /health, /ping
- 通用的健康检查
- /statusz
- 服务状态信息
- /varz
- 内部变量和 metrics
- /rpcz
- 一般是 RPC 统计

## 什么是边缘计算

个人简单理解,Edge 就是 DataCenter 的反义词。
Expand Down
24 changes: 17 additions & 7 deletions notes/dev/dict.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,21 @@ tags:

## 社交 {#social}

| abbr. | stand for | mean |
| ----- | ----------------- | -------- |
| OTOH | on the other hand |
| TL;TR | Too Long To Read | 简而言之 |
| TBH | To be honest |
> Internet forum
| abbr. | stand for | mean |
| ------ | ----------------------- | ---------------- |
| PM | Private Message | 私信 |
| DM | Direct Message | 私信 |
| OP | Original Poster | 楼主 |
| OTOH | on the other hand |
| TL;TR | Too Long To Read | 简而言之 |
| TBH | To be honest |
| IMO | In My Opinion | 我的看法 |
| IMHO | In My Humble Opinion | 我的谦虚意见 |
| IRL | In Real Life | 现实生活 |
| IYKWIM | If You Know What I Mean | 如果你懂我的意思 |
| TTYL | Talk To You Later | 回头见 |

## 财税 {#taxation}

Expand Down Expand Up @@ -1184,7 +1194,7 @@ tags:

## task vs job vs process vs background process

- job
- job/flow
- 侧重描述可调度性
- 一个 job 可能包含多个 task
- 通常具有连续运行的特点
Expand All @@ -1193,7 +1203,7 @@ tags:
- process
- 类似于 job
- process 更多是自主运行
- task/step
- task/step/activity
- 侧重描述内容
- 通常运行一次
- background process
Expand Down
14 changes: 11 additions & 3 deletions notes/dev/format/format-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ tags:

## Format vs Codec

- Format
- Format/格式 - 决定 **文件** 的组织和结构
- 通常为一种容器
- 容器变化不会导致实际内容变化
- 可能存储多种编码数据
- 可能存储多维度数据 - 音频+视频+字幕
- 提供 兼容性 和 互操作性
- 容器格式
- 脱离于数据
- 提供元信息
- 提供元信息 - 作者、标题、版权 - exif
- 提供不同的访问方式
- Codec
- 提供二次压缩、加密
- 也可能 Codec 也是 Format - 一个容器格式存储单一编码数据
- Codec/编解码器 - 数据的压缩和解压缩
- 软件/设备 - 可能存在 offload
- 编码 或 解码 数字数据流 或 信号
- 压缩和解压数据 -> 以便于存储和传输
- 数据的一种呈现方式 - 此时和 Format 可互换
- JSON、YAML
- 信息 <-> 数据 转化的方式
Expand Down
Loading

0 comments on commit 6e203e9

Please sign in to comment.