Homebrew update 失败,报错 homebrew-core is a shallow clone

发生环境:macOS V11.1 (Big Sur) 发生的问题:brew update 时报错, Error: homebrew-core is a shallow clone. homebrew-cask is a shallow clone. To `brew update`, first run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow This restriction has been made on GitHub's request because updating shallow clones is an extremely expensive

Liquid sort 排序

基本用法{{ my_array | sort }} {{ my_array | sort | reverse }} 按照指定属性排序例如在 Jekyll 中按文章的日期排序 {% assign sorted_posts = site.posts | sort:"date" %}

Python 字符串替换

查找固定字符串并替换使用字符串对象的 .replace() 方法 s = 'a---c' s.replace('-','') # 'ac' s.replace('--','-') # 'a--c' 正则表达式查找并替换使用 re.sub() import re s = 'a---c' re.sub(r'[-]+', '-', s) #'a-c' 更多 re.sub 用法可参考 Python 使用正则 re.sub 做字符串