macwk新站
之前的macwk由于OSS成本问题,关站了,后面几个管理重新建了个新站,名叫macpedia。 目前站点还比较简陋,但是可以给站长慢慢提软件,都会慢慢加上的。 新站地址:(macpedia.xyz) 交流群:@MacPedia_Chat 需 […]
macos删除磁盘|删除所有分区
在macOS系统中,并没有像diskgenius这种神器,有时候自带的磁盘工具并不好用,比如,外接磁盘有时候无法合并分区等。 这时,需要使用diskutil这个工具。 首先diskutil list,找到要删除的分区,比如这里的disk2 […]
Python版解答银行排队问题
一道笔试题: 过几天再批准发布。 本文最后更新于2022年10月31日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
Python替换txt文件中的某一行数据
直接上代码:
1 2 3 4 5 6 7 8 9 10 11 12 |
with open("./test.txt","r",encoding="utf-8") as f: lines = f.readlines() with open("./fileread.txt","w",encoding="utf-8") as f_w: for line in lines: if "taste" in line: line = line.replace("taste","tasting") f_w.write(line) |
思想: 读一行写一行。 本文最后更新于2022年10月31日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
Warning: No available formula with the name “wimlib-imagex”
下载ARM版WIN10的时候提示:
1 2 3 4 5 6 7 8 9 |
Check the readme.unix.md for details [/Volumes/Elements/个人资料盘备份/01 软件相关/03 系统镜像/WIN10/ARM版]$ brew install wimlib-imagex Warning: No available formula with the name "wimlib-imagex". ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching taps on GitHub... Error: No formulae found in taps. |
这是因为包的名字不对,改为: brew install wimlib 即可。 本文最后更新于2022年10月27日,已超过 1 年没有更新 […]
[mcj]Ubuntu 18.04配置VNC进行远程桌面连接
请注意:本文的安装环境是Ubuntu下的容器,而不是宿主机。如果需要在宿主机上安装vnc的同学,请参考: 1 安装环境 系统: ubuntu18.04 显卡: GTX2080Ti 显卡驱动: 418.56 cuda: release 10. […]
Error: Current platform “darwin 21” does not match expected platform “darwin 19”
升级系统之后,提示:
1 2 3 4 5 6 7 8 |
[~]$ sudo port -v install e2fsprogs Password: Error: Current platform "darwin 21" does not match expected platform "darwin 19" Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration OS platform mismatch while executing "mportinit ui_options global_options global_variations" Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch |
按照要求,重新安装Macport即可。 本文最后更新于2022年9月25日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处 […]
lxc.apparmor.allow_incomplete = 1
更新内核之后,容器如法启动,提示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
sipl@sipl-4Xp:~$ lxc info --show-log dln Name: dln Remote: unix:// Architecture: x86_64 Created: 2019/06/02 15:25 UTC Status: Stopped Type: persistent Profiles: default Log: lxc dln 20220930130750.859 WARN conf - conf.c:lxc_setup_devpts:1616 - Invalid argument - Failed to unmount old devpts instance lxc dln 20220930130750.859 WARN apparmor - lsm/apparmor.c:apparmor_process_label_set:221 - Incomplete AppArmor support in your kernel lxc dln 20220930130750.859 ERROR apparmor - lsm/apparmor.c:apparmor_process_label_set:223 - If you really want to start this container, set lxc dln 20220930130750.859 ERROR apparmor - lsm/apparmor.c:apparmor_process_label_set:224 - lxc.apparmor.allow_incomplete = 1 lxc dln 20220930130750.859 ERROR apparmor - lsm/apparmor.c:apparmor_process_label_set:225 - in your container configuration file lxc dln 20220930130750.859 ERROR sync - sync.c:__sync_wait:62 - An error occurred in another process (expected sequence number 5) lxc dln 20220930130750.860 WARN network - network.c:lxc_delete_network_priv:2589 - Operation not permitted - Failed to remove interface "eth0" with index 27 lxc dln 20220930130750.860 ERROR lxccontainer - lxccontainer.c:wait_on_daemonized_start:842 - Received container state "ABORTING" instead of "RUNNING" lxc dln 20220930130750.860 ERROR start - start.c:__lxc_start:1939 - Failed to spawn container "dln" lxc 20220930130750.861 WARN commands - commands.c:lxc_cmd_rsp_recv:132 - Connection reset by peer - Failed to receive response for command "get_state" |
按照提示,设置即可: lxc config set xxx raw.lxc “lxc.apparmor.allow_incomplete […]
Warning: The macOS 12 SDK does not appear to be installed. Ports may not build correctly.
使用port安装程序的时候,提示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
Warning: The macOS 12 SDK does not appear to be installed. Ports may not build correctly. Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'. ---> Fetching archive for libiconv ---> libiconv-1.17_0.darwin_21.x86_64.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified ---> Attempting to fetch libiconv-1.17_0.darwin_21.x86_64.tbz2 from https://packages.macports.org/libiconv % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:01:01 --:--:-- 0 ---> Attempting to fetch libiconv-1.17_0.darwin_21.x86_64.tbz2 from https://nue.de.packages.macports.org/libiconv % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1523k 100 1523k 0 0 482k 0 0:00:03 0:00:03 --:--:-- 482k ---> Attempting to fetch libiconv-1.17_0.darwin_21.x86_64.tbz2.rmd160 from https://nue.de.packages.macports.org/libiconv % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 512 100 512 0 0 2273 0 --:--:-- --:--:-- --:--:-- 2275 ---> Installing libiconv @1.17_0 ---> Cleaning libiconv ---> Removing work directory for libiconv ---> Deactivating libiconv @1.16_1 ---> Cleaning libiconv ---> Removing work directory for libiconv ---> Activating libiconv @1.17_0 x ./ x ./+PORTFILE x ./+CONTENTS x ./+DESC x ./+STATE x ./opt/ x ./+COMMENT x ./opt/local/ x ./opt/local/bin/ x ./opt/local/include/ x ./opt/local/lib/ x ./opt/local/share/ x ./opt/local/share/man/ x ./opt/local/share/doc/ x ./opt/local/share/doc/libiconv/ x ./opt/local/share/doc/libiconv/iconv_close.3.html x ./opt/local/share/doc/libiconv/iconv.3.html x ./opt/local/share/doc/libiconv/iconvctl.3.html x ./opt/local/share/doc/libiconv/iconv_open_into.3.html x ./opt/local/share/doc/libiconv/iconv_open.3.html x ./opt/local/share/doc/libiconv/iconv.1.html x ./opt/local/share/man/man3/ x ./opt/local/share/man/man1/ x ./opt/local/share/man/man1/iconv.1.gz x ./opt/local/share/man/man3/iconv_open.3.gz x ./opt/local/share/man/man3/iconv.3.gz x ./opt/local/share/man/man3/iconvctl.3.gz x ./opt/local/share/man/man3/iconv_close.3.gz x ./opt/local/share/man/man3/iconv_open_into.3.gz x ./opt/local/lib/libcharset.a x ./opt/local/lib/libcharset.1.dylib x ./opt/local/lib/libiconv.2.dylib x ./opt/local/lib/libiconv.dylib x ./opt/local/lib/libcharset.dylib x ./opt/local/lib/libiconv.a x ./opt/local/include/libcharset.h x ./opt/local/include/localcharset.h x ./opt/local/include/iconv.h x ./opt/local/bin/iconv ---> Cleaning libiconv ---> Removing work directory for libiconv Warning: The macOS 12 SDK does not appear to be installed. Ports may not build correctly. Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'. ---> Fetching archive for ncurses ---> ncurses-6.3_0.darwin_21.x86_64.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified ---> Attempting to fetch ncurses-6.3_0.darwin_21.x86_64.tbz2 from https://packages.macports.org/ncurses % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:15 --:--:-- 0^C |
解决: 先下载对应的command line工具,打开:More – Downloads – Apple Deve […]
macOS扫描坏道的工具
1. fsck_hfs macOS上扫描坏道的工具不多,并且大部分只支持查看内置磁盘,所以我们可以使用命令行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
[~]$ sudo fsck_hfs -dylS /dev/disk11 ** /dev/rdisk11 (NO WRITE) Using cacheBlockSize=32K cacheTotalBlock=98304 cacheSize=3145728K. Scanning entire disk for bad blocks Executing fsck_hfs (version hfs-583.100.10). Block 2 is not an MDB or Volume Header Block 15646718 is not an MDB or Volume Header /dev/rdisk11 0000: fab8 0000 8ed0 bc00 7c8b f450 0750 1ffb |...........P.P..| /dev/rdisk11 0010: fcbf 0006 b900 01f3 a5ea 1e06 0000 bebe |................| /dev/rdisk11 0020: 0780 3c80 7402 cd18 5653 06bb 007c b901 |....t...VS......| /dev/rdisk11 0030: 00ba 0000 b801 02cd 1307 5b5e b280 720b |..............r.| /dev/rdisk11 0040: bfbc 7d81 3d55 5375 02b2 00bf eb06 8815 |.....USu........| /dev/rdisk11 0050: 8a74 018b 4c02 8bee eb15 be9b 06ac 3c00 |.t..L...........| /dev/rdisk11 0060: 740b 56bb 0700 b40e cd10 5eeb f0eb febb |t.V.............| /dev/rdisk11 0070: 007c b801 02cd 1373 05be b306 ebdf bed2 |.......s........| /dev/rdisk11 0080: 06bf fe7d 813d 55aa 75d3 bf24 7cbe eb06 |......U.u.......| /dev/rdisk11 0090: 8a04 8805 8bf5 ea00 7c00 0049 6e76 616c |...........Inval| /dev/rdisk11 00a0: 6964 2070 6172 7469 7469 6f6e 2074 6162 |id.partition.tab| /dev/rdisk11 00b0: 6c65 0045 7272 6f72 206c 6f61 6469 6e67 |le.Error.loading| /dev/rdisk11 00c0: 206f 7065 7261 7469 6e67 2073 7973 7465 |.operating.syste| /dev/rdisk11 00d0: 6d00 4d69 7373 696e 6720 6f70 6572 6174 |m.Missing.operat| /dev/rdisk11 00e0: 5632 2e30 7379 7374 656d 0000 0000 0000 |V2.0system......| /dev/rdisk11 00f0: 0000 0000 0000 0000 0000 0000 0000 0000 |................| . . . /dev/rdisk11 01b0: 0000 0000 0000 0000 942b 0000 0000 0000 |................| /dev/rdisk11 01c0: 0900 0be6 7ca2 0800 0000 f0af 6600 0000 |............f...| /dev/rdisk11 01d0: 0000 0000 0000 0000 0000 0000 0000 0000 |................| . . . /dev/rdisk11 01f0: 0000 0000 0000 0000 0000 0000 0000 55aa |..............U.| unknown volume type primary MDB is at block 0 0x00 alternate MDB is at block 0 0x00 primary VHB is at block 0 0x00 alternate VHB is at block 0 0x00 sector size = 512 0x200 VolumeObject flags = 0x01 total sectors for volume = 15646720 0xeec000 total sectors for embedded volume = 0 0x00 CheckHFS returned 6, fsmodified = 0 |
可以通过指定缓存来加速扫描-c 512m [crayon-68 […]