太行一粟

专注于网站及程序设计

配置

显示配置

1
git config --list

用户名与密码

1
2
git config --global user.name USERNAME
git config --blogal user.email YOUR@EMAIL

命令行开发工具

你也可以在终端中输入命令 xcode-select --install 来开始安装过程。你会看到一个面板,要求你安装 Xcode 命令行工具。

xattr(解决app不能运行的问题)

1
2
3
4
# macOS 15
sudo spctl --master-disable
sudo xattr -r -d com.apple.quarantine appname.app
sudo xattr -cr appname.app

清除DNS缓存

1
sudo killall -HUP mDNSResponder

Finder

显示隐含文件

1
2
defaults write com.apple.finder AppleShowAllFiles -bool true
killall Finder

不显示隐含文件

1
2
defaults write com.apple.finder AppleShowAllFiles -bool false
killall Finder
阅读全文 »

客户端

配置文件

/etc/ssh/ssh_config

1
2
3
TCPKeepAlive=yes
ServerAliveInterval 30
ServerAliveCountMax 10

ServerAliveInterval:30,定期向服务器发送心跳的间隔时间,单位:秒。

ServerAliveCountMax:每个周期向服务器发送心跳的最大重试次数10

每隔30秒,向服务器发出一次心跳。若超过10次请求,都没有发送成功,则会主动断开与服务器端的连接。

阅读全文 »

服务器安装

TLS证书

安装certbot

1
apt install certbot

获取证书

1
2
# certbot certonly --standalone -d $domain --agree-to --email $email
certbot certonly --standalone -d np2.abc.com --agree-to --email admin@email.com
阅读全文 »

服务器安装

1
2
wget https://github.com/SagerNet/sing-box/releases/download/v1.4.1/sing-box_1.4.1_linux_amd64.deb
sudo dpkg -i sing-box_1.4.1_linux_amd64.deb

查看已安装文件

1
dkpg -c sing-box_1.4.1_linux_amd64.deb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
drwxr-xr-x root/root     0 2023-08-06 00:43 ./etc/
drwxr-xr-x root/root 0 2023-08-06 00:43 ./etc/sing-box/
-rw-r--r-- root/root 599 2023-03-26 01:36 ./etc/sing-box/config.json
drwxr-xr-x root/root 0 2023-08-06 00:43 ./etc/systemd/
drwxr-xr-x root/root 0 2023-08-06 00:43 ./etc/systemd/system/
-rw-r--r-- root/root 510 2023-08-05 14:01 ./etc/systemd/system/sing-box.service
-rw-r--r-- root/root 521 2023-08-05 14:01 ./etc/systemd/system/sing-box@.service
drwxr-xr-x root/root 0 2023-08-06 00:43 ./usr/
drwxr-xr-x root/root 0 2023-08-06 00:43 ./usr/bin/
-rwxr-xr-x root/root 23814144 2023-08-05 13:37 ./usr/bin/sing-box
drwxr-xr-x root/root 0 2023-08-06 00:43 ./usr/share/
drwxr-xr-x root/root 0 2023-08-06 00:43 ./usr/share/licenses/
drwxr-xr-x root/root 0 2023-08-06 00:43 ./usr/share/licenses/sing-box/
-rw-r--r-- root/root 791 2023-08-05 14:01 ./usr/share/licenses/sing-box/LICENSE
阅读全文 »

服务器安装

切换至root用户

1
sudo -i

下载安装脚本

1
wget https://raw.githubusercontent.com/imajeason/nas_tools/main/NaiveProxy/do.sh

脚本内容:

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

shell_renew(){
curl -o /root/.naive.sh https://raw.githubusercontent.com/imajeason/nas_tools/main/NaiveProxy/naive.sh
chmod +x /root/.naive.sh
ln -s /root/.naive.sh /usr/bin/naive
echo
echo " naive 命令安装完毕,请使用naive进行操作。"
}

shell_renew
阅读全文 »

AWS安装

安装或更新最新版本的 AWS CLI - AWS Command Line Interface (amazon.com)

Linux平台

1
2
3
4
apt install unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

更新:

1
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update

MacOS平台

1
2
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
阅读全文 »

Python类

静态方法@staticmethod

类方法@classmethod

钉钉机器人

创建钉钉群组机器人

  1. 选中群→点击右上角的群设置→机器人
  2. 添加机器人→自定义→添加
  3. 机器人名称:期货(填写给机器人取的名称)
  4. 安全设置:加签(选中)
  5. 复制:SEC4c4262656fe9585e82ed9004f3688d0ff1257aee8e79de3c1c896db7d2b3f30d,脚本中的secret变量内容。
  6. 我已阅读并同意《自定义机器人服务及免责条款》→完成
  7. 复制Webhook: https://oapi.dingtalk.com/robot/send?access_token=a64487796eb55203949dfb7cbcd5f4cefa30ad718f2069f18bd155f5ae846784,脚本access_token变量为等号后面的内容

注意:access_token与secret的内容需要替换为实际内容,并且需要保密。

阅读全文 »

安装

github库

yt-dlp

macos平台安装

yt-dlp_macos 2023.07.06

也可以使用brew进行安装:

1
2
brew install yt-dlp
brew install ffmpeg

Linux平台安装

yt-dlp_linux 2023.07.06

Windows平台安装

yt-dlp.exe 2023.07.06

跨平台脚本

yt-dlp 2023.07.06

类Unix平台包括Linux与macOS,建立/usr/bin/yt-dlp到上述下载文件的符号链接,或者将将文件复制到/usr/bin目录。

1
sudo cp yt-dlp /usr/bin/
阅读全文 »