diff --git a/src/content/post/使用github action定时同步obsidian内容到astro博客仓库.md b/src/content/post/使用github action定时同步obsidian内容到astro博客仓库.md deleted file mode 100644 index cc126b6..0000000 --- a/src/content/post/使用github action定时同步obsidian内容到astro博客仓库.md +++ /dev/null @@ -1,296 +0,0 @@ ---- -slug: synchronize-profiles-to-remote-and-local-on-a-regular-basis -title: 使用github action定时同步obsidian内容到博客仓库 -date: 2024-11-29 -author: KazooTTT -type: Post -status: Published -tags: -finished: true -published: true -category: -description: ---- - -## github action - -目标仓库以及具体目录可以根据自己的项目来定 - -``` yaml -name: Update Docs - -on: - push: - paths: - - "content/**" - - "scripts/build_docs.cjs" - workflow_dispatch: - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout source repository - uses: actions/checkout@v2 - with: - token: ${{ secrets.PAT_TOKEN }} - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: "20" - - - name: Install dependencies - run: | - echo "Installing dependencies in source repository..." - npm install - echo "Dependencies installed successfully" - - - name: Build docs - run: | - echo "Starting docs build..." - npm run build:docs:server - echo "Docs built successfully" - - - name: Checkout target repository - uses: actions/checkout@v2 - with: - repository: kazoottt/kazoottt-blog - path: kazoottt-blog - token: ${{ secrets.PAT_TOKEN }} - - - name: Copy built docs to target repository - run: | - echo "Starting copy process..." - echo "Content of astroContent before copy:" - cp -rv astroContent/* kazoottt-blog/src/content/post/ - echo "Content of astroContent copy done" - - - name: Setup target repository - run: | - cd kazoottt-blog - echo "Configuring git..." - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - echo "Installing dependencies in target repository..." - npm install - echo "Running sort..." - npm run sort - - - name: Check for changes and commit - run: | - cd kazoottt-blog - if [[ -n $(git status -s) ]]; then - git add . - git commit -m "Update docs and sort content" - git push - else - echo "No changes to commit" - fi - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - -``` - -PAT_TOKEN申请 -[Sign in to GitHub · GitHub](https://github.com/settings/tokens) - -需要权限:repo, workflow - -![image.png](https://pictures.kazoottt.top/2024/11/20241129-d27ae43fa5ad1344d66dff2e9d79c70e.png) - -## obsidian模板 - -published是true且notAstro不为true的时候,会被发布到另外一个仓库 - -``` ---- -title: {{title}} -date: {{date}} -author: KazooTTT -type: Post -status: Published -tags: [] -finished: false -published: false -category: -slug: -description: -notAstro: ---- - -``` - - ## 脚本 scripts/build_docs.cjs - -依赖安装 - -``` -npm install gray-matter -``` - -可以配置一些不想同步的文件夹 - -``` js -const fs = require("fs").promises -const fsSync = require("fs") -const path = require("path") -const matter = require("gray-matter") -const { execSync } = require("child_process") - -const CONFIG = { - outputDir: "astroContent", - inputDir: "./content", - ignoreList: [ - ".github", - ".obsidian", - "草稿箱", - "模板", - "attachment", - "记录", - "导航用", - "微信读书", - ], - validExtensions: [".md"], - // Local specific config - localDestinationRoot: "", // to edit - localDestination: "", // to edit -} - -/** - * Ensures output directory exists - */ -function initializeOutputDir() { - if (!fsSync.existsSync(CONFIG.outputDir)) { - fsSync.mkdirSync(CONFIG.outputDir, { recursive: true }) - } -} - -/** - * Validates if a file should be processed based on its metadata - */ -function shouldProcessFile(frontMatter) { - return frontMatter.published === true && !frontMatter.notAstro -} - -/** - * Processes a single markdown file - */ -async function processMarkdownFile(fullPath, outputPath) { - try { - const fileContent = await fs.readFile(fullPath, "utf8") - const { data } = matter(fileContent) - - if (shouldProcessFile(data)) { - await fs.copyFile(fullPath, outputPath) - console.log(`✓ Copied: ${path.relative(CONFIG.inputDir, fullPath)}`) - } - } catch (error) { - console.error(`Error processing file ${fullPath}:`, error.message) - } -} - -/** - * Recursively processes directories and files - */ -async function processDirectory(dir) { - try { - const files = await fs.readdir(dir) - - await Promise.all( - files.map(async (file) => { - const fullPath = path.join(dir, file) - const relativePath = path.relative(CONFIG.inputDir, fullPath) - const outputPath = path.join(CONFIG.outputDir, relativePath) - - const stats = await fs.stat(fullPath) - - if (stats.isDirectory()) { - if (CONFIG.ignoreList.includes(file)) return - await fs.mkdir(outputPath, { recursive: true }) - await processDirectory(fullPath) - } else if (path.extname(file) === ".md" && file !== "index.md") { - await processMarkdownFile(fullPath, outputPath) - } - }), - ) - } catch (error) { - console.error(`Error processing directory ${dir}:`, error.message) - } -} - -/** - * Copies processed files to final destination and commits changes - */ -async function copyToLocalDestination() { - try { - // Remove existing content - if (fsSync.existsSync(CONFIG.localDestination)) { - await fs.rm(CONFIG.localDestination, { recursive: true }) - } - - // Create destination directory - await fs.mkdir(CONFIG.localDestination, { recursive: true }) - - // Copy files - const files = await fs.readdir(CONFIG.outputDir) - await Promise.all( - files.map(async (file) => { - const sourcePath = path.join(CONFIG.outputDir, file) - const destPath = path.join(CONFIG.localDestination, file) - await fs.rename(sourcePath, destPath) - }), - ) - - console.log("Content has been successfully copied to the local destination.") - - // Commit changes - execSync(`cd ${path.dirname(CONFIG.localDestination)} && npm run sort`) - execSync(`git add ${CONFIG.localDestination} && git commit -m "update content"`) - // push changes - // execSync(`git push`) - } catch (error) { - console.error("Error copying to destination:", error.message) - } -} - -/** - * Cleans up the temporary output directory - */ -async function cleanupOutputDir() { - try { - if (fsSync.existsSync(CONFIG.outputDir)) { - await fs.rm(CONFIG.outputDir, { recursive: true }) - } - console.log("Cleaned up temporary directory.") - } catch (error) { - console.error("Error cleaning up:", error.message) - } -} - -/** - * Main execution - */ -async function main() { - try { - const isLocalBuild = process.argv.includes("--local") - console.log(`Starting document processing... (${isLocalBuild ? "local" : "server"} build)`) - - initializeOutputDir() - await processDirectory(CONFIG.inputDir) - - if (isLocalBuild) { - await copyToLocalDestination() - await cleanupOutputDir() - } - - console.log("Document processing completed successfully!") - } catch (error) { - console.error("Fatal error:", error.message) - } -} - -main() - -``` \ No newline at end of file diff --git a/src/content/post/编程/AI/01 Perplexity系列产品.md b/src/content/post/编程/AI/01 Perplexity系列产品.md deleted file mode 100644 index f6cd1dc..0000000 --- a/src/content/post/编程/AI/01 Perplexity系列产品.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: 01 Perplexity系列产品 -date: 2024-09-04 -author: KazooTTT -type: Post -status: Published -tags: - - AI - - 搜索引擎 - - Perplexity - - Playground - - 播客 -finished: true -published: true -category: 编程-AI -slug: perplexity-productions-intro -description: 概述Perplexity系列产品,包括搜索引擎、Playground和播客,重点介绍其功能和区别。 -NotionID-notionnext: ae2fba46-af30-4bd5-b6d0-fe751c162800 -link-notionnext: https://kazoottt.notion.site/01-Perplexity-ae2fba46af304bd5b6d0fe751c162800 ---- - -# Perplexity系列产品 - -## 产品1 Perplexity搜索引擎 - -![IMG-20240904094448497](https://pictures.kazoottt.top/2024/10/20241012-IMG-20240904094448497.png) - -https://www.perplexity.ai/ - -### 普通和Pro的区别 - -![IMG-20240904001354592](https://pictures.kazoottt.top/2024/09/20240904-82efc9478928cf3428241d5cdbe1f7e2.png) - -![IMG-20240904001354629](https://pictures.kazoottt.top/2024/09/20240904-b48e87c80c053f5afc32f440ab36959c.png) - -### 频繁人工验证怎么办 - -![IMG-20240904001354676](https://pictures.kazoottt.top/2024/09/20240904-aa07d424f893146a987cccdcf7ae5bcf.png) - -[Perplexity - AI Search - Chrome 应用商店](https://chromewebstore.google.com/detail/perplexity-ai-search/bnaffjbjpgiagpondjlnneblepbdchol) - -![IMG-20240904001354729](https://pictures.kazoottt.top/2024/09/20240904-836c90b245302d2dd60fc14009e8aab1.png) - -### 同类别产品 - -[Devv AI](https://devv.ai/) (编程向) - -![IMG-20240904094534311](https://pictures.kazoottt.top/2024/10/20241012-IMG-20240904094534311.png) - -## 产品2 Perplexity Playground - -体验最新大模型 - -https://labs.perplexity.ai/ - -![IMG-20240904001354800](https://pictures.kazoottt.top/2024/09/20240904-4a2f2948f9bda0d445948efd5d021e8c.png) - -![IMG-20240904001354854](https://pictures.kazoottt.top/2024/09/20240904-9988cdc07d33329b209ee5f44269caef.png) - -[Introducing Llama 3.1: Our most capable models to date](https://ai.meta.com/blog/meta-llama-3-1/) - -![IMG-20240904001354881](https://pictures.kazoottt.top/2024/09/20240904-e5c298074d3edb3aa59b00a86c20ef0e.png) - -[Changelog - Perplexity](https://docs.perplexity.ai/changelog/changelog#introducing-new-and-improved-sonar-models) - -![IMG-20240904001354925](https://pictures.kazoottt.top/2024/09/20240904-6757a9b6e9c488d8faad8ae28a2e48e1.png) - -## 产品3 Perplexity播客 - -[资讯汇总 Discover](https://www.perplexity.ai/discover) - -![IMG-20240904001354996](https://pictures.kazoottt.top/2024/09/20240904-c06edb7427f2885aa1d8b3bd69659719.png) - -Perplexity和eleventlab合作,把Discover的内容转成播客了。 - -![Pasted image 20240308104550 1](https://pictures.kazoottt.top/2024/09/20240904-c2dbdcea85e283af86a34fe244f1b8e4.png) - -![IMG-20240904001355089](https://pictures.kazoottt.top/2024/09/20240904-a904a8102ea53bd3a8619b43f6e4a770.png) - -很适合练习听力以及了解科技资讯。地址:[Discover Daily by Perplexity](https://discoverdaily.ai/) - -[spotify](https://open.spotify.com/episode/1CaSWrm7uUAOkaKjE9KI47?si=WPbA0x73QkGEPm-DFh4big) - -[pca.st](https://pca.st/03qazv0d) - -支持rss - -![IMG-20240904001355142](https://pictures.kazoottt.top/2024/09/20240904-51cb08cfa94e457d09ca0cfbaec6d604.png) diff --git a/src/content/post/软件/00 “git-credential-osxkeychain”想要访问你的钥匙串中的密钥“github.com” 解决方法.md b/src/content/post/软件/00 “git-credential-osxkeychain”想要访问你的钥匙串中的密钥“github.com” 解决方法.md deleted file mode 100644 index 6a80b4a..0000000 --- a/src/content/post/软件/00 “git-credential-osxkeychain”想要访问你的钥匙串中的密钥“github.com” 解决方法.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: “git-credential-osxkeychain”想要访问你的钥匙串中的密钥“github.com” 解决方法 -date: 2024-09-01 -author: KazooTTT -type: Post -status: Published -tags: - - Git - - macOS - - 解决方案 -finished: true -published: true -category: 软件 -slug: git-credential-osxkeychain-solve-method -description: 解决 macOS 弹出 'git-credential-osxkeychain' 访问 GitHub 密钥的问题 -NotionID-notionnext: 462377ea-6b4a-472c-9f55-ca4965dfe5c4 -link-notionnext: https://kazoottt.notion.site/git-credential-osxkeychain-github-com-462377ea6b4a472c9f55ca4965dfe5c4 ---- - -# macos 一直弹出 “git-credential-osxkeychain”想要访问你的钥匙串中的密钥“github.com” 解决方法 - -现在网络上关于这个问题的解决方案大部分都是打开钥匙串访问,然后删除github的密钥,但是这个方法其实并不奏效。具体的解决方法如下(二选一即可) - -## 方法一 使用GitHub CLI - -首先,使用brew安装GitHub CLI: - -```bash -brew install gh -``` - -然后,使用以下命令来登录: - -```bash -gh auth login -``` - -## 方法二 使用Git Credential Manager - -如果没有git,使用brew安装git: - -```bash -brew install git -``` - -然后,安装git-credential-manager - -```bash -brew install --cask git-credential-manager -``` - -最后,使用以下命令来登录: - -```bash -git credential-osxkeychain -``` - -## 参考地址 - -[在 Git 中缓存 GitHub 凭据 - GitHub 文档](https://docs.github.com/zh/get-started/getting-started-with-git/caching-your-github-credentials-in-git) diff --git a/src/content/post/软件/01 我自己常用的ffmpeg批处理.md b/src/content/post/软件/01 我自己常用的ffmpeg批处理.md deleted file mode 100644 index 4eef3ac..0000000 --- a/src/content/post/软件/01 我自己常用的ffmpeg批处理.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: 我自己常用的ffmpeg批处理 -date: 2024-10-14 -author: KazooTTT -type: Post -status: Published -tags: - - 视频处理 - - ffmpeg -finished: false -published: true -category: 软件 -slug: >- - 01-my-own-commonly-used-ffmpeg-batch-processingmy-own-commonly-used-ffmpeg-batching -description: 转换FLV格式的视频成HDDP,用于弹幕压制。使用FFmpeg来实现该功能,支持多个操作系统,如Windows和macOS。 ---- - -## 720x1080批量转1920x1080(两边黑屏) - -手机直播的时候录播机录出来的分辨率是720x1080,使用ffmpeg转成横屏的1920x1080。这样xml转ass弹幕的时候,就不需要另外处理了,看起来很更舒服。 - -macos的写法: - -```bash -input_folder="" # 要转化的录播的文件夹路径 -output_folder="" # 要输出的文件夹路径 - -# Create the output folder if it does not exist -mkdir -p "$output_folder" - -for f in "$input_folder"/*.flv; do - ffmpeg -i "$f" -vf "scale=720:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -c:a copy "$output_folder/$(basename "${f%.*}.mp4")" -done -``` - -windows的写法: - -```powershell -$input_folder = "Z:\\rec\\48743-hanser\\20240731-又来画画了!" # 要转化的录播的文件夹路径 -$output_folder = "Z:\\rec\\48743-hanser\\20240731-又来画画了!" # 要输出的文件夹路径 - -# Create the output folder if it does not exist -If (-Not (Test-Path $output_folder)) { - New-Item -ItemType Directory -Path $output_folder | Out-Null -} - -Get-ChildItem -Path $input_folder -Filter *.flv | ForEach-Object { - $input_file = $_.FullName - $output_file = Join-Path $output_folder ($_.BaseName + ".mp4") - $ffmpeg_args = @("-i", $input_file, "-vf", "scale=720:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2", "-c:a", "copy", $output_file) - & ffmpeg $ffmpeg_args -} -``` - -效果 - -![image.png](https://pictures.kazoottt.top/2024/10/20241014-20241014224347.png) - -## 弹幕压制 - -### windows版(使用cuda) - -```bash -@echo off -set input_folder=YourInputFolderPath -set output_folder=YourOutputFolderPath - -for %%a in ("%input_folder%\\*.flv") do ( - ffmpeg -hwaccel cuda -c:v h264_cuvid -i "%%a" -vf subtitles="%%~na.ass" -c:v h264_nvenc -b:v 6000k -c:a copy "%output_folder%\\%%~na_压制.mp4" -y -) -``` - -### macOS版 - -```bash -#!/bin/bash - -input_folder="/path/to/input" # Replace with your input folder path -output_folder="/path/to/output" # Replace with your output folder path - -mkdir -p "$output_folder" # Create the output folder if it doesn't exist - -for f in "$input_folder"/*.mp4; do - subtitle_file="${f%.*}.ass" # Assumes subtitle file name is same as video file name but with .ass extension - output_file="$output_folder/$(basename "${f%.*}_压制.mp4")" # Output file name with _ass suffix - - ffmpeg -i "$f" -vf "ass=$subtitle_file" "$output_file" -done -```