-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
290 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: 厨艺 | ||
category: 知识分享 | ||
article: false | ||
--- | ||
|
||
## 刀具 | ||
|
||
### 中式 | ||
|
||
推荐"十八子作专业版桑刀" | ||
|
||
### 西式 | ||
|
||
推荐"具良治 Global G-2" | ||
|
||
### 日式 | ||
|
||
推荐“具良治 Global G-81” | ||
|
||
### 斩骨刀 | ||
|
||
推荐“十八子作全尺寸款” | ||
|
||
### 水果刀 | ||
|
||
推荐“具良治 Global GS-36/GS-7” | ||
|
||
## 蛋 | ||
|
||
### 鸡蛋 | ||
|
||
煮鸡蛋: | ||
|
||
1. 鸡蛋一定要冷藏 | ||
2. 煮鸡蛋时更推荐蒸,或者转小火,亦或者半煮半蒸 | ||
3. 一定是水开再下锅 | ||
4. 5 分钟是流心蛋,8 分钟是溏心蛋,11 分钟是全熟蛋 | ||
|
||
镜面鸡蛋羹: | ||
|
||
1. 蛋水比 1:2,1.5 克盐 | ||
2. 使用陶瓷碗 | ||
3. 冷水下锅,锅盖留缝 | ||
4. 中大火预热,上汽后转小火,15 分钟后直接出锅 | ||
|
||
蜂窝鸡蛋羹: | ||
|
||
1. 蛋水比 1:1.2 | ||
2. 使用金属碗 | ||
3. 上汽后再放入鸡蛋 | ||
4. 盖上锅盖,全程大火 10 分钟 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: FFmpeg | ||
category: 知识分享 | ||
article: false | ||
--- | ||
|
||
## 转换视频格式 | ||
|
||
### 无损转换 | ||
|
||
无损转换保留原始文件的质量,不会降低视频和音频的质量,一般使用 FFmpeg 的 copy 模式进行无损转换 | ||
|
||
```sh | ||
ffmpeg -i input.avi -c copy output.avi | ||
``` | ||
|
||
该命令会直接复制输入文件的编解码器和容器格式,生成一个完全相同的输出文件 | ||
|
||
### 有损转换 | ||
|
||
有损转换会降低视频和音频的质量,但可以减小输出文件的大小。FFmpeg 支持使用各种编解码器进行有损转换,例如 H.264、VP9 等。一般使用 FFmpeg 的`-c:v`和`-c:a`选项指定视频和音频的编解码器 | ||
|
||
```sh | ||
ffmpeg -i input.avi -c:v libx264 -c:a aac output.mp4 | ||
``` | ||
|
||
该命令会使用 H.264 编码视频,AAC 编码音频,转换成 MP4 容器格式,可以通过调整编解码器的参数来平衡质量和文件大小 | ||
|
||
码率 (bitrate): | ||
|
||
+ 提高码率可以提高视频质量,但会增大文件大小 | ||
+ 降低码率可以减小文件大小,但会降低质量 | ||
+ 常用参数: -b:v 2000k 设置视频码率为 2Mbps | ||
|
||
分辨率 (resolution): | ||
|
||
+ 降低分辨率可以大幅减小文件大小,但会降低视觉质量 | ||
+ 常用参数: -vf scale=1280:720 设置分辨率为 1280x720 | ||
|
||
帧率 (framerate): | ||
|
||
+ 降低帧率可以减小文件大小,但会使视频看起来更"卡顿" | ||
+ 常用参数: -r 30 设置帧率为 30fps | ||
|
||
CRF (Constant Rate Factor): | ||
|
||
+ CRF 是一种基于质量的恒定码率模式,范围从 0 到 51,0 表示无损 | ||
+ 较低的 CRF 值会得到更高质量但更大文件的视频 | ||
+ 常用参数: -crf 28 设置 CRF 为 28 | ||
|
||
编码模式 (preset): | ||
|
||
+ FFmpeg 提供了一系列预设编码模式,从"ultrafast"到"veryslow"不等 | ||
+ "ultrafast"模式编码速度快,但质量较低;"veryslow"模式质量高,但编码速度慢 | ||
+ 常用参数: -preset medium 设置编码模式为 medium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: Prisma | ||
category: 知识分享 | ||
article: false | ||
--- | ||
|
||
Prisma 是一款非常流行的开源 ORM 工具,它可以让开发者以更简单,安全和高效的方式与数据库进行交互。Prisma 提供了一种声明式的方式来定义数据模型,可以自动生成数据库迁移脚本。Prisma 客户端是一个类型安全的数据库访问层,可以用来查询、插入、更新和删除数据。Prisma 支持多种数据库,包括 PostgreSQL、MySQL、SQLite、SQL Server 和 MongoDB | ||
|
||
## 新的项目 | ||
|
||
### 定义数据源 | ||
|
||
```prisma | ||
datasource db { | ||
provider = "sqlite" | ||
url = env("DATABASE_URL") | ||
} | ||
``` | ||
|
||
```env | ||
DATABASE_URL="file:./dev.db" | ||
``` | ||
|
||
### 数据迁移 | ||
|
||
```prisma | ||
model Post { | ||
id Int @id @default(autoincrement()) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
title String @db.VarChar(255) | ||
content String? | ||
published Boolean @default(false) | ||
author User @relation(fields: [authorId], references: [id]) | ||
authorId Int | ||
} | ||
model Profile { | ||
id Int @id @default(autoincrement()) | ||
bio String? | ||
user User @relation(fields: [userId], references: [id]) | ||
userId Int @unique | ||
} | ||
model User { | ||
id Int @id @default(autoincrement()) | ||
email String @unique | ||
name String? | ||
posts Post[] | ||
profile Profile? | ||
} | ||
``` | ||
|
||
执行 cli 命令,它会做两件事: | ||
|
||
1. 从 scheme 创建新的 SQL 迁移文件 | ||
2. 为数据库运行 SQL 迁移文件 | ||
|
||
```sh | ||
npx prisma migrate dev --name init | ||
``` | ||
|
||
### 生成客户端 | ||
|
||
## 已有项目 | ||
|
||
### 连接数据库 | ||
|
||
```prisma | ||
datasource db { | ||
provider = "sqlite" | ||
url = env("DATABASE_URL") | ||
} | ||
``` | ||
|
||
```env | ||
DATABASE_URL="file:./dev.db" | ||
``` | ||
|
||
### 生成数据模型 | ||
|
||
`npx prisma db pull` | ||
|
||
此命令读取在数据库中定义的环境变量并连接到数据库。一旦建立连接,它就会内省数据库(即读取数据库模式)。然后,它将数据库架构从 SQL 转换为 Prisma 架构中的数据模型 | ||
|
||
## 操作数据库 | ||
|
||
## Prisma Studio | ||
|
||
Prisma Studio 是数据库中数据的可视化编辑器。 在终端中运行`npx prisma studio` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters