skip to content
声控烤箱 | KazooTTT 博客

Notes(102) RSS feed
flow

51. “git-credential-osxkeychain”想要访问你的钥匙串中的密钥“github.com” 解决方法

Updated:

macos 一直弹出 “git-credential-osxkeychain”想要访问你的钥匙串中的密钥“github.com” 解决方法

现在网络上关于这个问题的解决方案大部分都是打开钥匙串访问,然后删除 github 的密钥,但是这个方法其实并不奏效。具体的解决方法如下(二选一即可)

方法一 使用 GitHub CLI

首先,使用 brew 安装 GitHub CLI:

Terminal window
brew install gh

然后,使用以下命令来登录:

Terminal window
gh auth login

方法二 使用 Git Credential Manager

如果没有 git,使用 brew 安装 git:

Terminal window
brew install git

然后,安装 git-credential-manager

Terminal window
brew install --cask git-credential-manager

最后,使用以下命令来登录:

Terminal window
git credential-osxkeychain

参考地址

在 Git 中缓存 GitHub 凭据 - GitHub 文档

52. 如何在 cursor 中使用 deepseek-coder

Updated:

如何在 cursor 中使用 deepseek-coder

Cursor 是一款智能代码编辑器,可以帮助用户生成代码、修改 Bug、生成测试等,提高编程效率。

可以免费使用,但是具有一定的额度。

Pasted image 20240725133801

但是它也可以使用自己的 key 和模型具体的操作如下。

Pasted image 20240725133037

1. 添加模型:DeepSeek-Coder

在 Cursor 的模型页面,添加新模型,选择 deepseek-coder

2. 配置 OpenAI API Key

在设置中找到 OpenAI API Key 选项,并填写 DeepSeek 提供的 API Key。

3. 配置 Base URL

在设置中找到 Override OpenAI Base URL 选项,并填入以下地址:

https://api.deepseek.com/v1

4. 在侧边栏中选择 deepseek-coder

Pasted image 20240725134803

这样配置就完成了

53. 如何让你的截图更加好看

Updated:

如何让你的截图更加好看

大家好,今天要跟大家分享的是几款截图美化工具。

一、shots.so

Shots - Create Amazing Mockups

Untitled

目前仅支持电脑端,移动端正在开发中。

这款截图工具提供了很全面的功能,包括但不限于:改变背景色、修改边框、添加阴影、模拟截图在设备上的展示效果等等。

效果:

Untitled

二、jellylade

Turn your screenshots into beautiful posts

Untitled

与 shots.so 类似,都可以体验一下看看效果。

Untitled

三、Arc 浏览器

目前仅适用于 macos 平台

没错 arc 浏览器自带截图美化功能。

使用方式有两种:

  1. cmd + t 然后搜索选择 capture in portrait mode 即可
Untitled
  1. 另外一种方式是开启 developer mode,
Untitled

然后在右侧点击按钮

Untitled

触发后你可以选择背景色以及要不要带上 arc 浏览器的水印

Untitled

最终效果

Untitled

55. Reasons Not to Recommend Purchasing Focusee for macOS Users

Updated:

Reasons Not to Recommend Purchasing Focusee for macOS Users

Why I Purchased Focusee

  1. Need to Record Both Camera and Screen Simultaneously: Often need to show both myself and the computer screen while recording videos.
  2. Need to Use Zoom Function: Occasionally need to zoom in on specific areas during recording, and Focusee conveniently adds this effect.
  3. Supports Both macOS and Windows: Additionally, there was a discount for purchasing for two devices.

Based on these three reasons, I purchased Focusee.

Why I Don’t Recommend It

Severe Color Discrepancy

This is the most serious issue.

The recorded videos on macOS have significant color discrepancies compared to the actual screen, to the extent that I find it almost unusable. Here’s a specific comparison:

8c214f3f-65f7-49d6-8abd-7011886b3392-spark-clipboard

After discovering this issue, I contacted their team:

On May 27th, I reported the issue for the first time. They responded that macOS 12.3 and below didn’t have this problem, but versions above 12.3 did, and they were looking for a solution.

CleanShot 2024-06-20 at 14.48.02

By June 18th, there was still no reply, so I sent another email asking for progress. They replied:

  1. This is an issue caused by higher versions of macOS (but no other screen recording software has such severe color discrepancies).
  2. Fixing this specific issue might sacrifice other color gamuts in the software.
  3. The current software configuration provides the best solution for balancing various colors (meaning this issue will not be resolved).
CleanShot 2024-06-20 at 14.55.42

Very Slow Export Speed

The slowness is quite noticeable. My configuration is a Mac Mini M2 Pro, and whether adding effects to the recorded video or exporting it directly without any changes, the speed is very slow.

Sound Card Configuration Conflicts and Lack of Single Application Recording

Focusee’s sound card settings conflict with other virtual sound cards on my system, possibly causing the sound output to be forcibly switched to speakers, and I can’t switch back to headphones.

Issue troubleshooting and solutions: Possible Causes and Solutions for Focusee Switching System Audio to Speaker Playback forcibly

Moreover, it doesn’t support single application sound recording. Competing products like Screen Studio (paid), QuickRecorder (open-source and free), and OBS all support single application sound recording.

Refund Experience

Since they informed me that the color discrepancy issue would not be resolved, and this was a crucial functional defect for me, I decided to request a refund.

I purchased Focusee from 数码荔枝 x 软件商店 - 专注于分享最新鲜优秀的正版软件 Taobao store. After contacting customer service to ask if I could get a refund, they processed it quickly and agreed to it without any issues. This was quite a pleasant surprise. I will consider Litchi Digital for similar purchases in the future.

56. 可以免费领取tokens的大模型服务

Updated:

可以免费领取 tokens 的大模型服务

本文更新时间:2024 年 6 月 20 日

豆包大模型

豆包大模型-火山引擎

” 亲爱的客户,模型提供方将在 5 月 15 日至 8 月 30 日期间,为您提供一次独特的机会,即高达 5 亿 tokens 的免费权益。这是我们对您长期支持的感谢,也是对未来合作的期待。”

在 8 月 30 日之前可以领取 5 亿 tokens

CleanShot 2024-06-20 at 09.58.30 1

DeepSeek | 深度求索

注册获 500 万 tokens(限中国大陆地区)

CleanShot 2024-06-20 at 09.30.27

SiliconCloud

手机号注册,一个手机号可以约 1 亿 token。

目前支持的模型有:

deepseek, qwen 等

CleanShot 2024-06-20 at 09.24.17

小红书输出:

目前可以免费领 tokens 的平台

一、豆包大模型 p1

在 8 月 30 日之前可以领取 5 亿 tokens

二、DeepSeek

注册获 500 万 tokens(限中国大陆地区)

三、SiliconCloud p3

手机号注册,一个手机号可以领约 1 亿 token。

目前支持的模型有:deepseek, qwen 等

57. __dirname is not defined in ES module scope

Updated:

__dirname Is not Defined in ES Module Scope

在 package.json 中的 type = module 的项目中,我创建了一个 ts 文件,类型是 esm 的类型。

这里的报错是因为我们错误的使用了 module 的语法到 esm 的文件中,要解决这个问题的方法有两种,第一种改为 module,另一种是改为 esm 的写法。

首先是第一种改为 module 的写法,那就是把 import 改为 require,然后由于我们这里是 module 的项目,所以需要修改一下 ts 文件的后缀 ts 改为 cts。

一个供参考的例子:GitHub - shawnsparks/typescript-esm: Explore different usage patterns of ES modules with Typescript

然后是第二种,文件、路径相关的改为 esm 的写法。

import { fileURLToPath } from "url"
import path from "path"
// 获取当前模块的目录路径
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

58. Possible Causes and Solutions for Focusee Switching System Audio to Speaker Playback forcibly

Updated:

Possible Causes and Solutions for Focusee Switching System Audio to Speaker Playback Forcibly

On macOS, when I wanted to use Focusee to record system audio, I followed its guide to install Gemoo Speaker.

Although switching the output device to Gemoo Speaker allowed me to record the system audio, it played the sound directly through the speakers.

Later, I found out that it was because I had installed BlackHole2ch. After uninstalling this virtual sound card, Focusee was able to record the sound through the headphones properly using Gemoo Speaker.

Uninstallation method:

Navigate to the folder /Library/Audio/Plug-Ins/HAL and delete the corresponding BlackHole2ch folder.

image.png

By the way, the reason I installed BlackHole2ch was to record system audio during screen recording or live streaming. Today, I suddenly discovered that OBS now directly supports recording system audio.

Here’s how to do it:

  1. Click the add button below the sources and select macOS Screen Capture. SCR-20240525-qcob-2.png

  2. Choose whether to capture desktop audio or application audio based on your needs. image.png

59. focusee录制系统声音被强制切换为扬声器播放的可能原因和解决方法

Updated:

Focusee 录制系统声音被强制切换为扬声器播放的可能原因和解决方法

在 macOS 上,我想要使用 focusee 录制系统声音的时候我按照它的引导安装了 Gemoo Speaker

虽然输出设备切换到 Gemoo Speaker 输出,这样确实可以录制到系统的声音了,但是是直接用扬声器外放的声音。

后来我发现是我安装了 BlackHole2ch 的原因,卸载掉这个虚拟声卡之后,focusee 就通过 Gemoo Speaker 可以正常地录制到耳机里的声音了。

卸载方法:

/Library/Audio/Plug-Ins/HAL

在这个文件夹中删除 BlackHole2ch 对应的文件夹即可

image.png

顺带一提,当时安装 BlackHole2ch 的原因是想要在录屏或者直播的时候录制到系统的声音,今天我突然发现 obs 已经支持了直接录制系统声音的功能。

具体的操作是:

  1. 点击来源下方的添加按钮,选择 macOS 音频采集 SCR-20240525-qcob-2.png

  2. 根据你的需求选择是采集桌面音频还是应用音频。 image.png

60. 再次学习History.scrollRestoration

Updated:

再次学习 History.scrollRestoration

2024-05-23-23-52-40

之前在 react.dev 的源代码中了解到了这个 HIstory 的属性,当时写了一篇笔记来记录我对它的理解,现在看来还是一知半解。所以今天打算重新学习一下这个属性,主要从属性以及所属对象的介绍、使用方法,是否开启标准这几个方面来简单展开。

什么是 scrollRestoration

scrollRestoration 是一个属性,它所属的实例是浏览器的 History。

这个属性是做什么的?它用来控制我们在切换历史页面的时候,滚动条的位置会不会恢复到之前的位置。

屏幕录制2024-05-23 10.48.05

如图所示,我们切换历史页面,又切换回最之前的页面,发现滚动条的位置依然保持底部,也就是之前的位置。

什么是切换历史页面,从操作上来讲就是点击浏览器的回退(有的浏览器长按回退键会弹出历史的前面多个页面供选择)、前进按钮

从代码上来讲就是执行下面的这些操作:

history.back()
history.forward()
history.go(page) // page大于0,表示往后面翻对应的页数,反之则是往前翻对应的页数

那么 scrollRestoration 这个属性与是否恢复滚动条的关系是什么?

scrollRestoration 可选的值为 auto 和 manual (如果浏览器支持这个属性,那么它默认是 auto)

scroll restoration mode, a scroll restoration mode, initially “auto”. HTML Standard

如果是 auto:那么在切换历史页面的时候,滚动条会自动地恢复到切换之前的位置。

如果是 manual:那么在切换页面的时候,滚动条会在顶部。

(上述的结果均在未手动修改 state 对应的滚动条位置的情况下)

属性的局限性

我之前觉得这个特性很好,但是为什么要单独地设置一个属性来控制是否要恢复到之前的滚动条位置呢?

History API - 滚动恢复  |  Blog  |  Chrome for Developers 这篇文章中提到:

This often means unsightly jumps as the scroll position changes automatically, and especially so if your app does transitions, or changes the contents of the page in any way. Ultimately this leads to an horrible user experience. To make matters even worse there’s very little you can do about it: Chrome triggers a popState event before the scroll event, which means you can read the current scroll position in popState and then reverse it in the scroll event handler with window.scrollTo (Ewww, but at least it works!). Firefox, however, triggers the scroll event before popState, so you have no idea what the old scroll value was in order to restore it. Bah!

翻译为中文:

这通常意味着当滚动位置自动改变时会出现难看的跳动,尤其是当你的应用程序进行过渡或以任何方式更改页面内容时。这最终会导致糟糕的用户体验。 更糟的是,你几乎无能为力:Chrome 会在 scroll 事件之前触发 popState 事件,这意味着你可以在 popState 中读取当前的滚动位置,然后在 scroll 事件处理程序中使用 window.scrollTo 恢复滚动位置(呃,但至少它能工作!)。然而,Firefox 则是在 popState 事件之前触发 scroll 事件,所以你无法知道旧的滚动位置以便恢复它。唉!

总结一下就是,此文的作者认为这个属性会造成的两个缺点是:

  1. 可能产生不太美观的跳跃:当滚动位置自动改变时,页面内容可能会突然跳动,尤其是在应用程序进行过渡或更改页面内容时,这会导致不好的用户体验。
  2. (在不开启这个属性的时候)非常难以人工地实现恢复滚动位置:由于不同浏览器在触发 popState 和 scroll 事件的顺序上存在差异(如 Chrome 和 Firefox),这使得在所有浏览器中一致地恢复滚动位置变得非常困难。

那么什么时候需要设置为 manual?

参考上面的两个缺点来说,当满足以下的条件的时候,可以考虑设置为 manual

  1. 页面确实会产生了不太美观的跳跃
  2. 不在意历史的滚动条位置,同时更希望全部由手动控制滚动条位置的时候

参考的资料

History: scrollRestoration property - Web APIs | MDN

HTML Standard