执行命令:sudo su -
source ~/.zshrc
compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask

出现:compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask
解决办法:
vim /usr/local/share/zsh/site-functions/_brew_cask



来自:https://blog.csdn.net/shentian885/article/details/115902464
在 Linux 系统中,你可以通过访问 /proc/<PID>/cmdline 文件来查看进程的启动命令和参数,其中 <PID> 是进程的 ID。这个文件包含了进程启动时使用的完整命令行,参数之间用 null 字符(ASCII码值为0)分隔。

例如,你可以使用以下命令来查看特定进程的命令行参数:
cat /proc/<PID>/cmdline

这将输出进程的启动命令及参数列表,以 null 字符分隔。

问:
的确,cat /proc/45063/cmdline
./multiupd-d
这个实际参数-d前面有空格,如何分离出来
答:
在 `/proc/<PID>/cmdline` 中,命令行参数以 null 字符(ASCII码值为0)分隔。你可以通过读取该文件并以 null 字符分割内容来获得参数列表。在某些编程语言中,你可以按照 null 字符(ASCII码值为0)来分割字符串。

例如,在 Bash 中,你可以使用 `tr` 命令来将 null 字符替换成其他分隔符,然后查看参数列表:

```bash
cat /proc/45063/cmdline | tr '\0' '\n'
```

这将把 null 字符替换成换行符,使得参数列表更易于阅读。
ps -ef|grep multi
root     45055     1  0 11:41 ?        00:00:00 ./multiupd -d
root     45063 45055  0 11:41 ?        00:00:00 ./multiupd -d

cat /proc/45055/cmdline | tr '\0' '\n'
./multiupd
-d
cat /proc/45063/cmdline | tr '\0' '\n'
./multiupd
-d





ps只能看到部分:
root      3195  2205  0 Jun19 ?        00:00:13 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/0a8be205faf5aa1500e55e83e36a3027c626ae

cat查看:
#cat /proc/3195/cmdline
containerd-shim-namespacemoby-workdir/var/lib/containerd/io.containerd.runtime.v1.linux/moby/0a8be205faf5aa1500e55e83e36a3027c626aea234747a51c949ffb1a9f95c83-address/run/containerd/containerd.sock-containerd-binary/usr/bin/containerd-runtime-root/var/run/docker/runtime-runc-systemd-cgroup



二、执行程序的软链接:
#ls -lart /proc/3195/exe
lrwxrwxrwx 1 root root 0 Jun 25 10:06 /proc/3195/exe -> /usr/bin/containerd-shim



三、环境变量:
#cat /proc/3195/environ
LANG=en_US.UTF-8PATH=/opt/containerd/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binLD_LIBRARY_PATH=:/opt/containerd/libGOMAXPROCS=2



四、对应的fd编号:
#ls /proc/3195/fd
0  1  10  11  12  13  14  15  16  17  18  19  2  20  3  4  5  6  7  8  9

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions


mac下面sudo su - 后出现:
sudo su
Password:
[Oh My Zsh] Would you like to update? [Y/n]: y
Updating Oh My Zsh
error: 不能变基式拉取:您有未暂存的变更。
error: 请提交或贮藏它们。
There was an error updating. Try again later?

最后我的解决办法是:
cd  ~/.oh-my-zsh/

git status
位于分支 master
您的分支与上游分支 'origin/master' 一致。

尚未暂存以备提交的变更:
  (使用 "git add <文件>..." 更新要提交的内容)
  (使用 "git restore <文件>..." 丢弃工作区的改动)
  类型变更: plugins/fedora/fedora.plugin.zsh
  类型变更: plugins/go/go.plugin.zsh
  类型变更: plugins/gradle/_gradle
  类型变更: plugins/gradle/_gradlew
  类型变更: plugins/per-directory-history/per-directory-history.plugin.zsh

git reset --hard origin/master #强制让本地的代码和远端一致
HEAD 现在位于 08da19e3 emacs: revert cab1ac6e682038b2ceca9d16f8c458c0e79149ca (#7765)

git status
位于分支 master
您的分支与上游分支 'origin/master' 一致。

git pull
remote: Enumerating objects: 9644, done.

root@bogon# upgrade_oh_my_zsh
Note: `upgrade_oh_my_zsh` is deprecated. Use `omz update` instead.
Updating Oh My Zsh
From https://github.com/ohmyzsh/ohmyzsh
* branch              master     -> FETCH_HEAD
Current branch master is up to date.
         __                                     __
  ____  / /_     ____ ___  __  __   ____  _____/ /_
/ __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/
                        /____/

Oh My Zsh is already at the latest version.
To keep up with the latest news and updates, follow us on Twitter: https://twitter.com/ohmyzsh
Want to get involved in the community? Join our Discord: https://discord.gg/ohmyzsh
Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh


参考:https://www.chendalei.com/articles/2018/10/09/1539052284615.html
提示:

Updating Oh My Zsh
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
There was an error updating. Try again later?

这种情况很可能发生,因为您已经在.oh-my-zsh目录中编辑了一些内容但尚未提交。

导航到该目录(.oh-my-zsh/目录)。
运行git status。 它应该显示已更改的文件列表。
使用git add暂存这些文件
使用git commit -m提交这些更改
你现在应该可以升级了。

可选:在步骤2之后,您可以运行git commit -a -m,它应该暂存所有未暂存的文件并提交这些更改(组合步骤3和4)。
然后通过upgrade_oh_my_zsh命令升级zsh。

参考来源:https://github.com/robbyrussell/oh-my-zsh/issues/1984
解决办法:
下载VCRUNTIME140.dll文件;微软官网:下载地址:https://www.microsoft.com/en-us/download/details.aspx?id=52685

下载真实地址及名称:vc_redist.x64.exe
https://download.microsoft.com/download/0/6/4/064F84EA-D1DB-4EAA-9A5C-CC2F0FF6A638/vc_redist.x64.exe
此次学习来源:https://mp.weixin.qq.com/s/YqZI4XUlsyPpaGIjy0pG3A
#cat p.c


#./p
value= 520

cat pp.c

#./pp


cat ppp.c

#./ppp
value0 = 1
value1 = 2
value2 = 3
temp[0] = 1
temp[1] = 2
temp[2] = 3

以前的学习:
https://jackxiang.com/post/7485/
在Centos8环境中配置PHP出现如上报错:
 
原因是没有安装配置oniguruma导致的 
解决方法如下:
1、获取源码,2.并解压

wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz
tar -zxf oniguruma-6.9.4.tar.gz
cd oniguruma-6.9.4
备用下载: http://down.24kplus.com/linux/oniguruma/oniguruma-6.9.4.tar.gz

3、编译安装

./autogen.sh && ./configure --prefix=/usr
make && make install
如果是Centos7环境中的话:
 解决方法如下:

yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-6.7.0-1.el7.x86_64.rpm
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-devel-6.7.0-1.el7.x86_64.rpm
备用下载:

oniguruma:http://down.24kplus.com/linux/oniguruma/oniguruma-6.7.0-1.el7.x86_64.rpm
oniguruma-devel:http://down.24kplus.com/linux/oniguruma/oniguruma-devel-6.7.0-1.el7.x86_64.rpm
————————————————
版权声明:本文为CSDN博主「薄凉小伙」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Kangshuo2471781030/article/details/107241779



python excelsearchKeyList.py k.txt
sys.argv[0] = excelsearchKeyList.py
sys.argv[1] = k.txt

二)判断字符为空:


python excelsearchKeyList.py  k.txt
原创视频
line is null
line is null



三)判断是否传入新的参数:


来自:https://blog.csdn.net/index20001/article/details/74294945#:~:text=Python%E7%A8%8B%E5%BA%8F%E6%9C%89%E4%B8%A4%E7%A7%8D,%E8%A7%A3%E9%87%8A%E5%99%A8%E5%B0%86%E4%BC%9A%E9%80%80%E5%87%BA%E3%80%82
问题:


rpm -qa *langpack*

cat /etc/locale.conf
LC_ALL="zh_CN.utf8"
LC_CTYPE="zh_CN.utf8"
LANG="zh_CN.utf8"

解决办法:
yum install glibc-langpack-zh -y
一、现象


Linux关机或重启时提示A stop job is running for ..


导致关机慢。


二、解决方法


编辑/etc/systemd/system.conf


修改下面两个变量为:


DefaultTimeoutStartSec=10s
DefaultTimeoutStopSec=10s
执行:systemctl daemon-reload



来自:https://blog.csdn.net/penge199761/article/details/79136826
质数定义:只有1和它本身两个约数,除此之外再没有其它约数。

示例1:

make zs
cc     zs.c   -o zs

#./zs
质数

示例2:


for循环介入:


引入scanf:



#./zs
5
质数
#./zs
6
合数

打印出约数:



#./zs
5
质数
#./zs
6
2 3 合数

更快一点,引入break:



#./zs
6
合数
#./zs
1000
合数



任一大于2的偶数都可以写成两个质数之和,采用部分穷举法,可以从1-100,1-10000啥的,但无法穷举所有:


#./zs
100
4=2+2
6=3+3
8=3+5
10=3+7
12=5+7
14=3+11
16=3+13
18=5+13
20=3+17
22=3+19
24=5+19
26=3+23
28=5+23
30=7+23
32=3+29
34=3+31
36=5+31
...
背景:有一篇朋友圈说是一个k8s里面Server的Pod销毁上报Zookeeper出现IP地址连接还是原来的,用到了zk的watcher,理论上不应该这样,于是查来查去,其大体意思就是说用了Go的多进程,有一个进程去读取配置了,因为配置还是老的,而用到了Go的多进程,于是文末那代码,我看了下,简单,但不明白,于是顺藤摸瓜学习一下这个rsync的原理。


——————————
#tree  -L 2 .|grep go
├── loop.go
├── pipe.go
├── waitgrouppointer.go
└── wg.go


#cat loop.go
package main

import (
    "fmt"
    //"time"
)

func main(){
    for i := 0; i < 100 ; i++{
        go fmt.Println(i)
    }
    //time.Sleep(time.Second)
}

这个说是运行太快,子进程没输出主进程就退了,啥也不输出。



#cat pipe.go
package main

import (
    "fmt"
    //"time"
)
func main() {
    c := make(chan bool, 100)
    for i := 0; i < 100; i++ {
        go func(i int) {
            fmt.Println(i)
            c <- true
        }(i)
    }

    for i := 0; i < 100; i++ {
        <-c
    }
}

这个说是管道要是上万,会耗尽系统管道资源。


#cat waitgroup.go      
package main

import (
    "fmt"
    "sync"
    //"time"
)
func main() {
    wg := sync.WaitGroup{}
    wg.Add(100)
    for i := 0; i < 100; i++ {
        go func(i int) {
            fmt.Println(i)
            wg.Done()
        }(i)
    }
    wg.Wait()
}


这个说是挺好的,因为它用到了原子加减法,这里好像C语言也有类似的函数,



再就是说它是用来阻塞方进程的,WaitGroup 对象内部有一个计数器,最初从0开始,它有三个方法:Add(), Done(), Wait() 用来控制计数器的数量。Add(n) 把计数器设置为n ,Done() 每次把计数器-1 ,wait() 会阻塞代码的运行,直到计数器地值减为0。

这里首先把wg 计数设置为100, 每个for循环运行完毕都把计数器减一,主函数中使用Wait() 一直阻塞,直到wg为零——也就是所有的100个for循环都运行完毕。相对于使用管道来说,WaitGroup 轻巧了许多。


最后,如果要搞裂成函数,得用引用传入,指针变量:
WaitGroup对象不是一个引用类型
WaitGroup对象不是一个引用类型,在通过函数传值的时候需要使用地址:

#cat waitgrouppointer.go
package main

import (
    "fmt"
    "sync"
    //"time"
)
func main() {
    wg := sync.WaitGroup{}
    wg.Add(100)
    for i := 0; i < 100; i++ {
        go f(i, &wg)
    }
    wg.Wait()
}

// 一定要通过指针传值,不然进程会进入死锁状态
func f(i int, wg *sync.WaitGroup) {
    fmt.Println(i)
    wg.Done()
}


以上来自:https://blog.csdn.net/u013474436/article/details/88749749

溯源来自:https://mp.weixin.qq.com/s/s9G6yDqfeFepbKT6DJASng



#cat wg.go
package main


import (
  "fmt"
  "sync"
)


func main() {
  ok := true
  for i := 0; i <1000; i ++ {
    var arr []int
    wg := sync.WaitGroup{}


    for j := 0; j <2; j ++ {
      wg.Add(1)


      go func() {
        defer wg.Done()
        arr = append(arr, i)
      }()
    }
    wg.Wait()


    if len(arr) < 2 {
      fmt.Printf("error:%d \n", i)
      ok = false
      break
    }
  }


  if ok {
    fmt.Println("ok")
  }
}

阅读全文
Server:echoServer.go


Client:echoClient.go


jackXiang@localhost  ~/golearning  ./echoClient
jack
read from socket:
jack
xiang
read from socket:
xiang

Q:果然Ok,两个问题探讨下:
1)        ip4 := net.ParseIP(ADDR).To4()
        sa := &syscall.SockaddrInet4{Port: PORT}
        copy(sa.Addr[:], ip4)  #这个sa.Addr[:] 冒号啥写法呢?

2)for { 这里面是epoll 吗?}

A:
1.
copy(sa.Addr[:], ip4)  #这个sa.Addr[:] 冒号啥写法呢?

sa.Addr 是一个数组,
sa.Addr[:] 将这个数组临时转为切片,底层数组指向sa.Addr数组
方便copy进行切片复制

2. 就是个for{}死循环,防止代码往下执行

来自:
https://mp.weixin.qq.com/s/dRADQ5kUCT80dX7oEAAXyA
https://mp.weixin.qq.com/s/kFHw73w_IIqjKeicesCpZw
背景:[实践OK]Macbook 升级到catalina 后的一些/data目录不见了等问题
:https://jackxiang.com/post/10397/,现在升级后,这个玩法被苹果给屏蔽更深了,怎么办?有人做这个,我不太敢接着搞下去了:
Big Sur 新增了 Signed System Volume 机制,对系统所在的 APFS Volume 增加了更多的保护

Reboot into recovery mode and run:重启mac,按住Command+R,等到系统进入安全模式。
命令 csrutil disable  ,sur还得加上这个:
csrutil authenticated-root disable

Reboot back into MacOS #正常重启进入系统
Find your root mount's device - run mount and chop off the last s, e.g. if your root is /dev/disk1s5s1, you'll mount /dev/disk1s5
Create a new directory, for example ~/mount
Run:sudo mount -o nobrowse -t apfs /dev/disk1s5 ~/mount  ,我这想:sudo mount -o nobrowse -t apfs /dev/disk1s5 /var/data

/dev/disk1s5s1 :https://iosre.com/t/big-sur/18051

升级到Big Sur后,以写模式挂载root报错(SIP已disable)

sudo mount -uw /

mount_apfs: volume could not be mounted: Permission denied

mount: / failed with 66

Big Sur 新增了 Signed System Volume 机制,对系统所在的 APFS Volume 增加了更多的保护

Reboot into recovery mode and run:
csrutil authenticated-root disable

Reboot back into MacOS
Find your root mount's device - run mount and chop off the last s, e.g. if your root is /dev/disk1s5s1, you'll mount /dev/disk1s5

Create a new directory, for example ~/mount
Run:sudo mount -o nobrowse -t apfs /dev/disk1s5 ~/mount

Modify the files under the mounted directory

Run:sudo bless --folder MOUNT_PATH/System/Library/CoreServices --bootefi --create-snapshot

Reboot your system, and the changes will take place

缺点:

修改后,无法再启用SSV机制,但是可以启用SIP机制,因为系统已修改,导致签名不一致,若启用SSV,则校验失败,报错禁止启动。

csrutil enable

csrutil authenticated-root disable



Big Sur 引入的 Signed System Volume 机制会给 System APFS Volume 的每个文件 /文件夹都设置一份 hash,在 bootloader 启动后,加载内核前会进行完整性校验,校验不通过的话会拒绝引导,并提示用户重装 macOS 。使用 mount 查看挂载点会发现 /多了个 sealed 标志。系统默认会从 SSV snapshot 启动,对用户无感知。

Big Sur’s Signed System Volume: added security protection


来自:https://www.quwenqing.com/archives/1597.html
背景:Chrome您的连接不是私密连接解决办法--一个比较实用的技巧分享,有的勾选确认,发现没有勾选按钮。怎么办?
方法:解决:就是在当前页面用键盘输入  thisisunsafe  ,不是在地址栏输入,就直接敲键盘就行了,页面即会自动刷新进入网页。

阅读全文
Mac / OS X 如何快速显示桌面:F4
Mac苹果电脑怎么设置Launchpad快捷键?F11
=============================
Mac / OS X 如何快速显示桌面(Desktop)?
https://www.zhihu.com/question/21448506

  【收藏】Mac苹果电脑怎么设置Launchpad快捷键?
来自:https://www.zhihu.com/question/21448506
分页: 5/339 第一页 上页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 下页 最后页 [ 显示模式: 摘要 | 列表 ]