sed 命令在 macOS 下使用存在两个问题:
-i
参数表示直接对文件进行操作,可提供一个参数值作为后缀名,使 sed 在替换前对文件进行备份,如sed -i ".bak" "s/aaa/bbb/g" filename
。这个在 macOS 下必需,不需要备份的传空。
执行命令后,可能出现sed: RE error: illegal byte sequence
的报错。
library(tidyverse) | |
library(gganimate) | |
NUMPLAYERS = 45 | |
ROUNDS = 5000 | |
INITWEALTH = 45 | |
#initialize the bank | |
#columns wealths of the NUMPLAYERS players | |
#rows show wealths of each of the ROUNDS ticks of the clocks |
# 查看Linux的发行版本 | |
lsb_release -a | |
uname -a | |
cat /etc/issue | |
cat /proc/version | |
# 列出本地已经安装了的 package | |
dpkg --get-selections | grep -v deinstall | |
groups # 查看本机所有的组 |
#!/usr/bin/env node | |
/* | |
PO parser from http://jsgettext.berlios.de/lib/Gettext.js | |
adapted for Node.js and modified to be more like po2json.pl | |
- Zach Carter <zcarter@cse.usf.edu> | |
*/ | |
/* | |
Pure Javascript implementation of Uniforum message translation. |
set: function (key, val, options) {
// ...
// You might be wondering why there's a `while` loop here. Changes can
// be recursively nested within `"change"` events.
if (changing) return this;
if (!silent) {
while (this._pending) {
this._pending = false;
1、
if (x === undefined) { ... }
不严谨,undefined 关键字是可以被更改的。
2、
/** | |
* 时间格式化 | |
* 今天的,显示“今天 08:08” | |
* 昨天、前天 | |
* 3天前,显示具体日期 | |
* @param {Number} _time UNIX时间戳 | |
*/ | |
_p._$timeFormat = (function () { | |
// 一天的毫秒数 | |
var _oneDay = 24 * 60 * 60 * 1000; |
const toUnicode = (str) => str.split('').map((char) => { | |
const temp = char.charCodeAt(0).toString(16).toUpperCase(); | |
if (temp.length > 2) { | |
return '\\u' + temp; | |
} | |
return char; | |
}).join(''); | |
console.log(toUnicode('转换成 Unicode')); |
// https://stackoverflow.com/a/62892482/3676413 | |
import { fileURLToPath } from 'url'; | |
import { dirname } from 'path'; | |
const __filename = fileURLToPath(import.meta.url); | |
const __dirname = dirname(__filename); |
字符集 | 字数 | Unicode 编码 |
---|---|---|
基本汉字 | 20902字 | 4E00-9FA5 |
基本汉字补充 | 38字 | 9FA6-9FCB |
扩展A | 6582字 | 3400-4DB5 |
扩展B | 42711字 | 20000-2A6D6 |
扩展C | 4149字 | 2A700-2B734 |
扩展D | 222字 | 2B740-2B81D |