手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表分类:苹果相关

M1芯片MacBook如何恢复系统

 之前苹果系统的重启恢复是按住option键,如果是进入恢复系统就是直接按cmd+r。但M1不一样。如果是你按以前的操作模式,仍然是进入正常的系统。

M1的电脑是先按一下电源进行启动,然后长按电源键,这时候屏幕上会出现(长按,直到启动选项出现)。等到启动 选项出现后就和以前差不多一样了。

为什么会进这个模式是因为新电脑的/usr/local写不进。但我平时composer都是扔在/usr/local/bin目录下。(cat ~/.profile,或者说 echo $PATH,看到的黑夜目录就是/usr/local/bin),进入恢复模式后,运行csrutil disable 关闭掉rootless的管理。再重启进系统后就可以执行:sudo chown -R $(whoami) /usr/local ,就一切都OK了

 

做个小笔记,关于ffmpeg的

 帮别人下载了个视频,原来是m3u8的。我想那好办啊。ffmpeg -i xxx.m3u8 -c copy output.mp4不就完了?结果 发现在处理过程中一直报错,

XML/HTML代码
  1. https://dh5.cntv.lxdns.com/asp/h5e/hls/850/0303000a/3/default/a1a69ffb1d6a449da1daaa93480f3393/850.m3u8: corrupt decoded frame in stream 0  
  2.     Last message repeated 1 times  
  3. [h264 @ 0x7fa2e803b400] top block unavailable for requested intra mode -1  
  4. [h264 @ 0x7fa2e803b400] error while decoding MB 35 0, bytestream 4054  
  5. [h264 @ 0x7fa2e803b400] concealing 920 DC, 920 AC, 920 MV errors in P frame  
  6. [h264 @ 0x7fa2e803ae00] concealing 791 DC, 791 AC, 791 MV errors in B frame  
  7. [h264 @ 0x7fa2d9008e00] top block unavailable for requested intra mode -1  
  8. [h264 @ 0x7fa2d9008e00] error while decoding MB 10 0, bytestream 3439  
  9. [h264 @ 0x7fa2e803f000] top block unavailable for requested intra mode  
  10. [h264 @ 0x7fa2e803f000] error while decoding MB 36 0, bytestream 1375  
  11. [h264 @ 0x7fa2d9008e00] concealing 920 DC, 920 AC, 920 MV errors in P frame  
  12. [h264 @ 0x7fa2e803f000] concealing 920 DC, 920 AC, 920 MV errors in B frame  

 

error while decoding MB,这个错误,大部分是出在rtsp流中,没想到m3u8也有问题。我没细看,感觉是偏移量的问题,因为我即使用vlc直接打开m3u8的文件也是这个样子,那就证明,不是命令有问题,而是确实这个视频有问题。

最后下载了对方的APP,来下载这个视频。然而,视频居然还变成了两个。先偷懒,直接 cat a >> b ,明显没用。文件是变大了,但时间还是2分钟,(2个视频,一个2分钟,一个40秒),最后还是使用ffmpeg,第一次是用 ffmpeg -i "concat:a.mp4|b.mp4" -c copy c.mp4,结果,视频还是2分钟,只能用filelist的方式,即建一个文本文件,每行一个视频文件,

file 'a.mp4'
file 'b.mp4'

用 ffmpeg -f concat -i filelist.txt -c copy c.mp4 运行后,生成了文件。确实是2分40秒。

---EOF---

其实我并没有解决m3u8下载下来不正常的问题,不过我本来对这个也不擅长,上一次用ffmpeg已经是8年前了。现在也就随便看看,能用就行,所以还是先记个笔记

 

更多资料,参考 :https://blog.csdn.net/doublefi123/article/details/47276739 

Ruby SSL Error: certificate verify failed

 安装fastlane的时候报错:

XML/HTML代码
  1. ERROR:  SSL verification error at depth 0: ok (0)  
  2. ERROR:  SSL verification error at depth 0: ok (0)  
  3. ERROR:  SSL verification error at depth 0: ok (0)  
  4. ERROR:  Could not find a valid gem 'rvm' (>= 0), here is why:  
  5.           Unable to download data from https://ruby.taobao.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (certificate rejected) (https://ruby.taobao.org/specs.4.8.gz)  
  6. ERROR:  SSL verification error at depth 0: ok (0)  
  7. ERROR:  SSL verification error at depth 0: ok (0)  
网上很多解决方法,什么重建 pem,之类的,或者临时关闭验证:【http.verify_mode = OpenSSL::SSL::VERIFY_NONE】,但更多人都推荐一句话的命令:rvm osx-ssl-certs update all。然而我运行下来却是:
XML/HTML代码
  1. Selected SSL certs for: curl  
  2. cURL certificate bundle curl is /usr/share/curl/curl-ca-bundle.crt not found  
嗯,这回又是一堆人遇到了同样的问题,看看这个高票答案,居然只是说rvm用stable版?
XML/HTML代码
  1. $ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled  
不过也有人有不同的看法:
XML/HTML代码
  1. To find the location of this file use:  
  2.   
  3.    $ curl-config --ca  
  4.   
  5.    /usr/share/curl/curl-ca-bundle.crt  
  6. Backup your curl-ca-bundle.crt file:  
  7.   
  8. $ cp /usr/share/curl/curl-ca-bundle.crt /usr/share/curl/curl-ca-bundle.crt.old  
  9. Then you want to concatenate the two file using:  
  10.   
  11. $ cat cacert.pem /usr/share/curl/curl-ca-bundle.crt >> curl-ca-bundle-new.crt  
看起来倒是可行。
 
参考 :
1、https://blog.engineyard.com/ruby-ssl-error-certificate-verify-failed
2、https://stackoverflow.com/questions/6414232/curl-certificate-error-when-using-rvm-to-install-ruby-1-9-2/6917309
 
 
 
 

Tags: ruby, rvm

mac 如何将img文件写到 SDCard

 有三篇教程

1、https://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi/4213#4213 ,教你怎样用dd来备份
2、https://raspberrypi.stackexchange.com/questions/9217/resource-busy-error-when-using-dd-to-copy-disk-img-to-sd-card 备份时,如果resource busy怎么办
3、https://unix.stackexchange.com/questions/271471/running-dd-why-resource-is-busy 为什么会出现 resource busy。
 
mac上本来双盘COPY是很简单的,打开diskutil,加载两个磁盘,对着要恢复的盘,右键:选择恢复,可以选择 img/dmg文件,也可以选择已经 mount的磁盘。然而在恢复树莓的时候,一直失败【忘了截图了】
 
于是找到了教程1,教你怎么在命令下行备份,方法很简单,就2步
1、diskutil list,查看你的SD卡对应的是哪个磁盘,
2、备份:sudo dd if=/dev/rdisk1 of=/path/to/backup.img bs=1m
     恢复:sudo dd if=/path/to/backup.img of=/dev/rdisk1 bs=1m
3、如果觉得太大,还可以gzip 
     备份:sudo dd if=/dev/rdisk1 bs=1m | gzip > /path/to/backup.gz
     恢复:gzip -dc /path/to/backup.gz | sudo dd of=/dev/rdisk1 bs=1m
如果你仔细看教程1,你会发现,diskutil list,显示的是当前磁盘,大部分都是直接写的/dev/disk3 之类的,而 上面的备份命令却写的是 rdisk1 。这是什么原因?教程1给了个wiki:https://elinux.org/RPi_Easy_SD_Card_Setup#Copying_an_image_to_the_SD_card_in_Mac.C2.A0OS.C2.A0X_.28command_line.29,有兴趣的话,可以去看看。
 
如果不想深究原因,那么看教程2,他会教你怎么弄,
1、df -h,看一下自己的SD卡是哪个,你会看到这时候显示的又和 diskutil list 不一样,df -h显示的都是 /dev/disk3s1 之类的
2、用diskutil unmount /dev/disk3s1,将它unmount掉
3、df -h 发现没有 /dev/disk3s1了
4、这时候参考 上面的rdisk方法,写入磁盘 /dev/rdisk[n] , 这个 n,就是刚才你 disk[3]s1 中的3,具体情况看你自己的sd卡是哪个盘
 
比如我这样:
sudo dd if=/Volumes/documents/2020-05-27-raspios-buster-lite-armhf.img of=/dev/rdisk3 bs=1m 
1768+0 records in
 1768+0 records out
 1853882368 bytes transferred in 24.396307 secs (75990287 bytes/sec)
 
写入成功。
我就只知其然不知其所以然了,也没有过多深究。有兴趣的话,可以看看上面的教程3

Tags: 树莓, dd

Creating root-level directories and symbolic links on macOS Catalina

 这是一篇引用文章,原文来自:https://derflounder.wordpress.com/2020/01/18/creating-root-level-directories-and-symbolic-links-on-macos-catalina/,可能部分用户打不开,毕竟是wordpress.com。。。

 
我简单的COPY一下:

One of the changes which came with macOS Catalina was the introduction of a read-only root volume for the OS. For users or environments which were used to using adding directories to the root level of the boot drive, this change meant they could no longer do that.

To address this need, Apple added a new method for creating directories at the root level which leverages Apple File System’s new firmlink functionality. Firmlinks are new in macOS Catalina and are similar in function to Unix symbolic links, but instead of only allowing travel one way (from source to destination) firmlinks allow bi-directional travel.

The use of firmlinks is exclusively reserved for the OS’s own use, but Apple has also made available what are called synthetic firmlinks. These synthetic firmlinks are how the OS enables folks to create directories and symbolic links on the read-only boot volume. For more details, please see below the jump.

 

To create a synthetic firmlink, you need to do the following:

1. Create a file in the /etc directory named synthetic.conf.
2. Make sure /etc/synthetic.conf has the following permissions:

  • root: read, write
  • wheel: read
  • everyone: read

3. In /etc/synthetic.conf, define the name(s) of the empty directory or symbolic link you want to have appear at the root level.

4. After all desired entries have been made, save the /etc/synthetic.conf file.

5. Restart the Mac to apply the changes.

For example, /etc/synthetic.conf may look like this:

XML/HTML代码
  1. # create an empty directory named "foo" at / which may be mounted over  
  2. foo  
  3.   
  4. # create a symbolic link named "bar" at / which points to  
  5. # "System/Volumes/Data/bar", a writeable location at the root of the data volume  
  6. bar     System/Volumes/Data/bar  
  7.   
  8. # create a symbolic link named "baz" at / which points to "Users/me/baz"  
  9. baz     Users/me/baz  

 

Note: In those cases where you’re creating a symbolic link and are including a path, the start point for the directory path is not /. Instead, it is the next directory level down.

To show how this works, I’ve created a directory containing installer packages located at /Users/Shared/installers.

Screen Shot 2020 01 17 at 10 46 06 PM

To create a symbolic link at the root level named installers which points to /Users/Shared/installers, I would do the following:

1. Create the /etc/synthetic.conf file if it didn’t already exist.
2. Add the following entry to the /etc/synthetic.conf file:

1
installers  Users/Shared/installers

Screen Shot 2020 01 17 at 10 32 45 PM

3. Reboot the Mac.

Note: Whomever designed this came down on the “tabs” side of the “tabs vs. spaces” debate. When creating the separation between installers and Users/Shared/installers in the /etc/synthetic.conf file, you need to use tabs. If you use spaces instead, the synthetic firmlink won’t be created.

After the reboot, you should see a symbolic link named installers at the root level of the boot volume. When you navigate to it, you should see the contents of /Users/Shared/installers.

Screen Shot 2020 01 17 at 10 33 30 PM

To remove the symbolic link, remove the relevant entry from /etc/synthetic.conf and then restart. After the reboot, the installers symbolic link should be missing from the root level of the boot volume.

Screen Shot 2020 01 17 at 10 46 15 PM

For more information, please see the synthetic.conf man page. This is available by entering the following command in Terminal on macOS Catalina:

man synthetic.conf,可以看到内容大致这样:

XML/HTML代码
  1. SYNTHETIC.CONF(5)           BSD File Formats Manual          SYNTHETIC.CONF(5)  
  2.   
  3. NAME  
  4.      synthetic.conf  
  5.   
  6. SYNOPSIS  
  7.      synthetic.conf -- synthetic symbolic link and directory manifest  
  8.   
  9. DESCRIPTION  
  10.      synthetic.conf describes virtual symbolic links and empty directories to  
  11.      be created at the root mount point. Because the root mount point is read-  
  12.      only as of macOS 10.15, physical files may not be created at this loca-  
  13.      tion. All writeable paths must reside on the data volume, which is  
  14.      mounted at /System/Volumes/Data.  
  15.   
  16.      synthetic.conf provides a mechanism for some limited, user-controlled  
  17.      file-creation at /.  The synthetic entities described in this file are  
  18.      synthesized by the kernel during early system boot. They are not physi-  
  19.      cally present on the disk, but when the system is booted, they behave as  
  20.      if they were within certain parameters.  
  21.   
  22.      synthetic.conf is intended to be used for creating mount points at /  
  23.      (e.g. for use as NFS mount points in enterprise deployments) and symbolic  
  24.      links (e.g. for creating a package manager root without modifying the  
  25.      system volume).  synthetic.conf is read by apfs.util(8) during early sys-  
  26.      tem boot.  
  27.   
  28. FORMAT  
  29.      synthetic.conf specifies a single synthetic entity per line. Each line  
  30.      may have one or two columns, separated by a tab character. If a line has  
  31.      a single column, it denotes a virtual empty directory to be created at /.  
  32.      If a line has two columns, it denotes a symbolic link at / whose link  
  33.      target is given in the second column.  
  34.   
  35.      In either case, the first column denotes the name of the entity to be  
  36.      created at /.  
  37.   
  38.      A line beginning with the # character indicates a comment that is not  
  39.      parsed.  
  40.   
  41. SYNTHETIC ENTITIES  
  42.      Synthetic entities may not be deleted at runtime. In order to delete a  
  43.      synthetic entity, it must be removed from synthetic.conf, and the host  
  44.      must be rebooted.  
  45.   
  46.      New files and directories may not be created within a synthetic empty  
  47.      directory.  
  48.   
  49. EXAMPLES  
  50.            # create an empty directory named "foo" at / which may be mounted over  
  51.            foo  
  52.   
  53.            # create a symbolic link named "bar" at / which points to  
  54.            # "System/Volumes/Data/bar", a writeable location at the root of the data volume  
  55.            bar     System/Volumes/Data/bar  
  56.   
  57.            # create a symbolic link named "baz" at / which points to "Users/me/baz"  
  58.            baz     Users/me/baz  
  59.   
  60. FILES  
  61.      /etc/synthetic.conf  
  62.   
  63. SEE ALSO  
  64.      apfs.util(8) shutdown(8) reboot(2)  
  65.   
  66. Darwin/macOS                      2 July 2019                     Darwin/macOS  

 

 

参考 一下上面的内容,可以简单的试用一下。其实还行吧。(如果图片看不到。。就忍忍吧。)
---------
说白了就是几个事
1、在/etc目录下建一个 synthetic.conf 文件
2、设定的权限是:root 读写 wheel 读 everyone 读 ,权限值为:644
3、每行一条记录,目录名和目标引用的目录 
     比如你要在根目录下映射 一个 server,对应的是 /Users/gouki/Desktop,那就直接: server /Users/gouki/Desktop 就完事了
4、重要:改完得重启。。。。
--EOF
说白了,现在不支持根目录下的ln了。只能通过这个办法。如果有特别需要就试试吧。。。
     
 
 ----
::划重点::
1、权限是644
2、两个目录之间的间隔用tab,不是空格。原例子里用的是nano编辑 ,我用vim编辑的时候,tab居然无法输入(崩溃 )
3、对应的目录前好象不需要 / 
4、多测试几次吧。我重启了三次才搞定
 
Records:22412345678910»