macOS Gemini CLI 安装

1.安装npm

# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"

# Download and install Node.js:
nvm install 22

# Verify the Node.js version:
node -v # Should print "v22.17.0".
nvm current # Should print "v22.17.0".

# Verify npm version:
npm -v # Should print "10.9.2".

2.设置terminal环境 使用API模式

# https://aistudio.google.com/app/apikey  google账户Gemini api
 echo 'export GEMINI_API_KEY="AIzaSyAO0qfzddYCzoPXdRdnXadsDEMP10cOXiw"' >> ~/.zshrc
 source ~/.zshrc      

3.安装Gemini CLI 并选择API模式

npm install -g @google/gemini-cli                                                 
gemini

4.运行

#terminal内之间执行 
gemini

如何关闭iOS“快捷指令”运行时的横幅通知

在执行某些 iOS 快捷指令(Shortcut)时,手机顶部总是会弹出“轻点以回应”的提示消息,非常烦人,而且在系统设置中的通知设置界面根本找不到快捷指令相关的通知设置(目前使用 iOS 15.7.1),所以无法直接关闭。

在网上反复查找关闭的方法,花了接近 2 小时,终于借助 网上的一篇攻略文章 把这个问题解决了。

  1. iOS 快捷指令的通知设置界面藏得很深,在屏幕使用时间相关设定中
  2. 首先需要在系统设置中打开“屏幕使用时间”功能
  3. 打开之后,需要运行一些带有通知的快捷指令
  4. 再之后,通知占用的时间会出现在屏幕使用时间的日统计中
  5. 点击日统计中与快捷指令相关的通知时间记录,会进入一个隐藏的通知设定界面 (与一般 iOS App 的通知管理设置界面非常相似,但是你在系统设置界面根本找不到这个通知设置入口)
  6. 在这个设置界面,里可以调整快捷指令相关通知
  7. 设置完成后,可以彻底关闭“屏幕使用时间”功能,相关通知设置将会保持,不会再次看到“轻点以关闭”通知信息

OpenWRT 实现HP1020打印机网络共享

1、下载HP1020固件文件sihp1020.dl文件至/etc目录

2、在USB热拔插触发目录下建立触发脚本:VI /etc/hotplug.d/usb/Printer-HP1020

#!/bin/sh set -e # 固件路径 FIRMWARE=/etc/sihp1020.dl # 打印机路径,可以从OpenWRT的USB打印机界面中中查看 DEVICE=/dev/usb/lp0 # Debug Log File LOGFILE=/tmp/hp1020 if [ "$PRODUCT" = "3f0/2b17/100" -a "$ACTION" = "bind" -a "$DEVTYPE" = "usb_device" ]; then echo "$(date): USB printer binded. Trying to upload firmware..." >> $LOGFILE cat $FIRMWARE > $DEVICE echo "$(date): Success. Done." >> $LOGFILE exit fi

加入首次启动 local startup /etc/rc.local

cat /etc/sihp1020.dl >> /dev/usb/lp0

3、实现效果:

打印机开机后触发USB热插拔事件,HP1020打印机绿灯常亮并立即进行自检,然后红灯绿灯交替闪烁再次自检,随后绿灯常亮

出处: https://www.pizzayy.com/openwrt-实现hp1020打印机网络共享.html?doing_wp_cron=1714973122.5799219608306884765625

How to Resolve “Package crypto/ecdh is not in GOROOT” Error in Linux

Have you encountered the “Package crypto/ecdh is not in GOROOT” error while working with Go in Linux? This error can be frustrating, but it’s typically due to misconfigurations or outdated Go installations. In this quick guide, we’ll walk you through the steps to resolve this issue.

Uninstall Go

If you suspect that your current Go installation is causing the problem, you can uninstall it before re-installing the latest version. Use the following commands:

  1. Remove the golang-go package:

$ sudo apt-get remove golang-go

2. Remove the golang-go dependencies:

$ sudo apt-get remove — auto-remove golang-go

3. Uninstall the existing Go package:

$ sudo rm -rvf /usr/local/go

Install the New Go Version

Now, let’s install the latest Go version:

  1. Download the Go archive:

$ wget https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz

2. Extract the archive file:

$ sudo tar -xvf go1.21.3.linux-amd64.tar.gz

3. Place the extracted Go directory in the desired location (e.g., /usr/local):

$ sudo mv go /usr/local

Set Up Go Environment Variables

To configure Go properly, you need to set up environment variables:

  1. Set GOROOT to the Go installation location:

$ export GOROOT=/usr/local/go

2. Define GOPATH as your Go workspace directory:

$ export GOPATH=$HOME/go

3. Add Go binary paths to your PATH:

$ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

4. Reload environment variables:

$ source ~/.profile

Verify Your Go Installation

Finally, verify your Go installation to ensure it’s working correctly:

$ go version

With these steps, you should have successfully resolved the “Package crypto/ecdh is not in GOROOT” error and updated your Go installation to the latest version. Your Go environment should now be correctly configured and ready for your projects. Happy coding!

warp-cli 解决chatGPT访问限制

https://developers.cloudflare.com/warp-client/get-started/linux/

参考: https://github.com/willoong9559/XrayWarp

现在机场大多数使用的是Dnsmasq将网站解析劫持到SNI proxy反向代理的页面上。

这里是使用WARP Client进行代理解锁Netflix等。 可以去cloudfalre官方页面有详细的安装流程和原理,不赘述。 个人认为官方socks这种代理方式更灵活且优雅。 https://developers.cloudflare.com/warp-client/setting-up/linux

这里写下我的配置过程

1.注册客户端

warp-cli register
2.设置WARP代理模式

warp-cli set-mode proxy
3.连接WARP

warp-cli connect
此时WARP会使用socks5本机代理127.0.0.1:40000 4.打开warp always-on

warp-cli enable-always-on
6.测试socks代,理检查ip是否改变

export ALL_PROXY=socks5://127.0.0.1:40000
curl ifconfig.me
7.修改v2ray/xray outbounds和分流规则,这里给出我的配置可自由发挥。

vim /usr/local/etc/xray/config.json
inbounds要启动sniffing

“sniffing”: {
“enabled”: true,
“destOverride”: [“http”, “tls”]
}
“outbounds”: [
{
“tag”: “default”,
“protocol”: “freedom”
},
{
“tag”:”socks_out”,
“protocol”: “socks”,
“settings”: {
“servers”: [
{
“address”: “127.0.0.1”,
“port”: 40000
}
]
}
}
],
“routing”: {
“rules”: [
{
“type”: “field”,
“outboundTag”: “socks_out”,
“domain”: [“geosite:netflix”]
},
{
“type”: “field”,
“outboundTag”: “default”,
“network”: “udp,tcp”
}
]
}
8.重新启动v2ray/xray

systemctl restart v2ray/xray
systemctl status v2ray/xray
xray可能需要下载geosite和geoip, google github上就能找到,下载后放在 /usr/local/bin

注意routing的位置顺序

cat /etc/v2ray/config.json
{
“log”: {
“access”: “/var/log/v2ray/access.log”,
“error”: “/var/log/v2ray/error.log”,
“loglevel”: “warning”
},
“inbounds”: [
{
“port”:12026,
“listen”: “127.0.0.1”,
“tag”: “vmess-in”,
“protocol”: “vmess”,
“settings”: {
“clients”: [
{
“id”:”b9d6e3c5-dea4-4cac-8c0e-30fb1ccbe906″,
“alterId”: 64
}
]
},
“streamSettings”: {
“network”: “ws”,
“wsSettings”: {
“path”:”/fb4e/”
}
}
}
],
“outbounds”: [
{
“protocol”: “freedom”,
“settings”: { },
“tag”: “direct”
},
{
“protocol”: “blackhole”,
“settings”: { },
“tag”: “blocked”
},
{
“tag”:”socks_out”,
“protocol”: “socks”,
“settings”: {
“servers”: [
{
“address”: “127.0.0.1”,
“port”: 40000
}
]
}

}
],
“dns”: {
“servers”: [
“https+local://1.1.1.1/dns-query”,
“1.1.1.1”,
“1.0.0.1”,
“8.8.8.8”,
“8.8.4.4”,
“localhost”
]
},
“routing”: {
“domainStrategy”: “AsIs”,
“rules”: [
{
“type”: “field”,
“outboundTag”: “socks_out”,
“domain”: [“geosite:openai”]

},

{
“type”: “field”,
“inboundTag”: [
“vmess-in”
],
“outboundTag”: “direct”
}
]
}
}

chatGPT登录(Google账户)流程

chatGPT登录(Google账户)流程:
1.先不翻墙,保持网络干净。并清除浏览器有关openai的内容。
2.打开 https://chat.openai.com ,login in /显示谷歌账户登录
3.翻墙 全局
4.谷歌账户登录 直到显示IP被ban
5.关闭翻墙 是完全关闭 不是pac模式 也不要用浏览器翻墙插件
6.刷新显示ban的页面
7.此步应该已经正常登录了。如果依然不行,尝试浏览器禁用quic