macOS 13 Ventura SSH报错解决

给 ~/.ssh/config 添加以下两行 1 HostkeyAlgorithms +ssh-rsa 2 PubkeyAcceptedKeyTypes +ssh-rsa 1Host * 2 AddKeysToAgent yes 3 UseKeychain yes 4 ServerAliveInterval 60 5 HostkeyAlgorithms +ssh-rsa 6 PubkeyAcceptedKeyTypes +ssh-rsa

十一月 30, 2022

Go N个协程交替打印1-100

1package main 2 3import ( 4 "fmt" 5 "runtime" 6) 7 8func main() { 9 goroutine := runtime.NumCPU() 10 chanSlice := make([]chan struct{}, 0) 11 chanExit := make(chan struct{}, 1) 12 13 for i := 0; i < goroutine; i++ { 14 chanSlice = append(chanSlice, make(chan struct{}, 1)) 15 } 16 17 max := 100 18 num := 0 19 20 fmt.Println("runtime.NumCPU(): ", runtime.NumCPU()) 21 22 for i := 0; i < goroutine; i++ { 23 go func(x int) { 24 for { 25 <-chanSlice[x] 26 num++ 27 fmt.Println("goroutine: ", x, " chan: ", chanSlice[x], " num: ", num) 28 29 if num == max { 30 chanExit <- struct{}{} 31 break 32 } 33 34 chanSlice[(x+1)%goroutine] <- struct{}{} 35 } 36 }(i) 37 } 38 39 chanSlice[0] <- struct{}{} 40 41 select { 42 case <-chanExit: 43 fmt.Println("exit") 44 } 45 46 fmt.Println("goroutine: ", runtime.NumGoroutine()) 47} Run on Go Playground ...

八月 24, 2022

Intel NUC10 Hackintosh OpenCore EFI

Intel NUC10 Hackintosh OpenCore EFI OpenCore OpenCore 0.8.2 Adapted ꔷ NUC10i7FNH/FNK ꔷ NUC10i5FNH/FNK ꔷ NUC10i3FNH/FNK OS Version Tested ꔷ macOS Monterey 12.x (Default config.plist) ꔷ macOS Big Sur 11.6.x (Replace config.plist with config.BigSur.plist) ꔷ macOS Catalina 10.15.x (Replace config.plist with config.Catalina.plist) Known issue ꔷ Thunderbolt 3 Support very buggy. ꔷ Continuity features not work(EXCEPT HandOff and Universal Clipboard).

一月 19, 2021

OpenCore 设置默认启动项

在启动菜单中选中默认要启动的选项,按Ctrl+Enter或Ctrl+启动项序号即可。 如下要将第 2 项 Mac 设置为默认启动项,则可以通过Ctrl+2或Ctrl+Enter设置。 ...

十二月 27, 2020

黑苹果EFI分区空间占满处理方法

黑苹果 EFI 分区在更新 EFI 文件后,空间会慢慢变小,直到有一天。。。。空间被占满了。 然而,想清理下呢,也没有其它文件,只好格式化了。 搜索了好多资料,也没找到好点的格式化方法,最后自己研究了下进恢复模式格式化了。 下面放上方法。 ...

十一月 24, 2020

macOS 命令行升级

1softwareupdate --install -a

十月 8, 2020

使用docker搭建transmission Client

Transmission A fast, easy, and free BitTorrent client 官网:https://transmissionbt.com/ Docker 镜像:https://hub.docker.com/r/linuxserver/transmission docker-compose.yml 1version: "3" 2services: 3 transmission: 4 image: linuxserver/transmission 5 container_name: transmission 6 environment: 7 - PUID=1000 8 - PGID=1000 9 - TZ=Asia/Shanghai 10 - TRANSMISSION_WEB_HOME=/transmission-web-control/ # 可选 /combustion-release/, /transmission-web-control/, /kettu/ 三个UI主题 11 - USER=username # http简单认证 用户名 12 - PASS=password # http简单认证 密码 13 restart: unless-stopped 14 networks: 15 - web 16 volumes: 17 - ./config:/config # 配置文件(不用管,可以在web ui设置) 18 - ./downloads:/downloads # bt文件下载路径映射 19 - ./watch:/watch # 20 ports: 21 - 9091:9091 # Web UI 端口 22 - 51413:51413 23 - 51413:51413/udp 24 25networks: 26 web: 27 external: true 启动 1docker-compose up -d Tips 建议 openresty(nginx) 做反向代理,用域名访问 webui, 如 bt.torrent.com:80 => transmission:9091 ...

八月 14, 2020

Gio

Immediate mode GUI programs in Go for Android, iOS, macOS, Linux, FreeBSD, OpenBSD, Windows, and WebAssembly (experimental). gioui.org

七月 5, 2020

Docker Compose Container 之间相互通信

Docker Compose Container 之前相互通信 因 links 属性已被废弃,官方建议使用 networks 来将几个 container 划分至一个网络,从而实现 container 之间互通。 创建一个桥接网络 docker network create YOUR_NET_NAME 默认网络方式即为桥接 YOUR_NET_NAME为你自定义的网络名称 ...

十二月 6, 2019

Nginx Hardening Checklist

五月 22, 2019