- MacOSX
- Useful Commands
- 打开文件数 / 最大链接数
- 性能测试
- 内网传输速度测试
- 传输速度测试方案2: speedtest
- launchd (Ventura)
- check SSD lifespan
- screen capture to clipborad
- screen video capture
- copy wifi password to clipboard
- open finder where specific file exists
- Easily Find Forgotten Commands from History (bck-i-search)
- software update issue
- v2rayA
$ echo -n 'R1BSVwI=' | base64 -D | hexdump -v -e '/1 "%02x" '
4750525702
xxd <filename>
以16进制显示文件内容xxd -i <filename>
转成c数组
unsigned char note_txt[] = {
0x0a, 0x0a, 0x0a, 0x35, 0x30, 0x30, 0x30, 0x20, 0x2b, 0x20, 0x37, 0x35,
0x30, 0x20, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x0a, 0x31, 0x32, 0x30, 0x20,
0x20, 0xe5, 0x96, 0x9c, 0xe7, 0xb3, 0x96, 0xe9, 0xa2, 0x84, 0xe4, 0xbb,
0x98, 0x0a, 0x35, 0x30, 0x30, 0x30, 0x20, 0xe5, 0xb0, 0x8f, 0xe5, 0x8d,
0x97, 0xe5, 0x9b, 0xbd, 0x20, 0xe5, 0xae, 0x9a, 0xe9, 0x87, 0x91, 0x0a,
0x0a
};
unsigned int note_txt_len = 61;
$ man ascii
The hexadecimal set:
00 nul 01 soh 02 stx 03 etx 04 eot 05 enq 06 ack 07 bel
08 bs 09 ht 0a nl 0b vt 0c np 0d cr 0e so 0f si
...
cal
当月cal -y
当年-j
参数, day 显示为 当年的第几天
launchctl limit
sudo launchctl limit maxfiles 100000 500000
sysctl kern.maxfiles
sysctl -w kern.maxfiles=20480 (or whatever number you choose)
# will lost , for centos : /etc/security/limits.conf
ulimit -a
ulimit -n 8192
# memory speed
$ dd if=/dev/zero of=/dev/null bs=1m count=32768
32768+0 records in
32768+0 records out
34359738368 bytes transferred in 0.988451 secs (34761195414 bytes/sec)
# explain
# Memory Bandwidth (GB/s)=Memory Clock Frequency (MHz)×Bus Width (bytes)×Transfers per Clock Cycle×10 −3
# for example, 2667MHz, 8bytes, 2 transfers per clock cycle
# Memory Bandwidth(GB/s) = 2667 * 8 * 2 * 10^-3 = 42.672GB/s # 理论内存带宽
1台机器上 开启 iperf3 server
iperf3 -s
另一台机器上 发包测试
iperf3 -c 192.168.1.8 -R
docker run -d --name speedtest -p 0.0.0.0:81:80 adolfintel/speedtest:latest
webpage
http://10.192.89.89:81/
About crond : "“The cron utility is launched by launchd(8) when it sees the existence of /etc/crontab or files in /usr/lib/cron/tabs. There should be no need to start it manually.”"
There are three main directories you can use with launchd:
- /Library/LaunchDaemons
- job needs to run even when no users are logged in.
- /Library/LaunchAgents
- if the job is only useful when users are logged in.
- I learned that this has the side-effect of your job being run as 'root' after a system reboot.)
- $HOME/Library/LaunchAgents
- your job will be run under your username.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.launchVM</string>
<key>ProgramArguments</key>
<array>
<string>/Volumes/WORK/VBoxVDIs/openwrt/launchVM.sh</string>
</array>
<key>Nice</key>
<integer>1</integer>
<key>StartInterval</key>
<integer>60</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Volumes/WORK/VBoxVDIs/openwrt/err.log</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
</dict>
</plist>
trouble shooting
# list
VBoxManage list runningvms
# stop vm
VBoxManage controlvm openwrt poweroff
# unlock session
vboxmanage startvm openwrt --type emergencystop
# restart
sh /Volumes/WORK/VBoxVDIs/openwrt/launchVM.sh
cp ./launchVM.plist ~/Library/LaunchAgents/
cd ~/Library/LaunchAgents/
sudo chown root ./launchVM.plist
sudo chgrp wheel ./launchVM.plist
sudo launchctl bootstrap system ~/Library/LaunchAgents/launchVM.plist
or just test whether it works:
launchctl load ~/Library/LaunchAgents/launchVM.plist
brew install smartmontools
smartctl -a /dev/disk0
# you may need do some test on disk
smartctl -t short /dev/disk0
cmd + ctl + shift + 4
cmd + ctl + shift + 5
$ security find-generic-password -wa "ChinaNet-Mebusy" | pbcopy
e.g. find github password
security find-internet-password -s github.com -a your_github_username -w
open -R <path-to-file>
- Open up Terminal.
- Type
Ctrl-r
. - type letters you remember...
- As you type, the terminal keeps suggesting a command that matches what you’ve typed.
softwareupdate -l : to see a list of the current updates (to make sure I was updating the same things)
sudo softwareupdate -i -a -R : to install the updates, and restart the computer if required
softwareupdate --list-full-installers
sudo softwareupdate --fetch-full-installer --full-installer-version 14.7.2 --agree-to-license
-
install
brew tap v2raya/v2raya brew install v2raya/v2raya/v2raya brew services start v2raya
-
create server
- localhost:2017
- Create a new Server
- select it in
Operations
column - click
start
at the top-left corner of the page
- select it in
-
Settings
- Transparent Proxy
- change to
Proxy except CN Sites
orProxy only GFWList
- change to
- Mode when Update Subscrition
- Update all servers and GFWList
- change to
Depend on Rule Port
- change to
- Update all servers and GFWList
- Address and Ports
- Port of HTTP(with Rule)
- change to
3128
- change to
- Port of HTTP(with Rule)
- Transparent Proxy
-
QA
- 更新 GFWList 失败
- 查看日志
- e.g.
Downloading https://github.com/v2rayA/dist-v2ray-rules-dat/raw/202412312211/geosite.dat to /Users/xxoo/Library/Application Support/v2ray/LoyalsoldierSite.dat.new
- e.g.
- 手动下载
- ``wget -O "/Users/xxoo/Library/Application Support/v2ray/LoyalsoldierSite.dat" https://github.com/v2rayA/dist-v2ray-rules-dat/raw/202412312211/geosite.dat
- 注: 下载的文件不需要 .new 后缀
- 再次点击更新
- 查看日志
- 更新 GFWList 失败
sudo route add -net 127.0.0.0/8 127.0.0.1
sudo route add -net 192.168.0.0/16 $(route -n get default | grep 'gateway' | awk '{print $2}')
huggingface 换源
$ cd /Applications/LM Studio.app/Contents/Resources/app/.webpack
$ cat mirror.sh
#!/bin/sh
set -e
# find all .js file in the current directory, and repace 'huggingface co' with 'hf-mirror.com'
find . -type f -name "*.js" -exec sed -i '' 's/huggingface.co/hf-mirror.com/g' {} \;
sudo mkdir -p /mnt/hgfs
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
如果手动挂载 /mnt/hgfs/ 成功,但重启后消失,可以在 /etc/fstab 里添加:
.host:/ /mnt/hgfs fuse.vmhgfs-fuse defaults,allow_other 0 0
- remove old version
sudo rm -rf /Library/Developer/CommandLineTools
- download correct CommandLine Tools
- check CLTools version:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables