在本地开发环境或者服务器上尝尝忘记了一些常见命令的参数用法,特别是参数比较多的时候,不经常用的话老容易忘记。
先让我们来看看效果
在本地开发环境或者服务器上尝尝忘记了一些常见命令的参数用法,特别是参数比较多的时候,不经常用的话老容易忘记。
先让我们来看看效果
这篇文章我们会来讨论一下如何在 Deno 中引入私有的 npm 模块。如果还不了解 deno 背景的童鞋可以先到官网 ( https://deno.land ) 了解一下。 也可以通过这篇讲 Deno 是什么? 的文章了解一下一下 Deno 出现的背景。
比如现在遇到情况是我通过以下命令想装个 curl
或者 telnet
之类的工具
apt-get update && apt-get install -y curl
这时,如果你的默认源是官方的,在国内可能是比较慢的,比如我的服务器在阿里云上的话,那么阿里云的源肯定是比较快的。
const puppeteer = require('puppeteer');
const pageUrl = 'https://some-url.com';
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on('request', (interceptedRequest) => {
// Don't intercept main document request
if (interceptedRequest.url === pageUrl) {
interceptedRequest.continue();
return;
}
// Intercept if request url starts with https
if (interceptedRequest.url.startsWith('https://')) {
interceptedRequest.continue({
// Replace https:// in url with http://
url: interceptedRequest.url.replace('https://', 'http://'),
});
return;
}
// Don't override other requests
interceptedRequest.continue();
})
await page.goto(pageUrl);
await browser.close();
})();
今天在 git clone
一个 github 仓库的时候出现了以下错误
ssh_exchange_identification: read: Connection reset by peer
怀疑是代理的原因,试了全局、直连、规则都不行,查找了一些文章有说可以使用以下命令查看详细调试信息
ssh -vvv -T git@github.com
还是不行,在 v2ex 上看到一个楼主说需要加个配置,所以就试了下
在 ~/.ssh/config
中添加以下配置
Host github.com
Hostname ssh.github.com
Port 443
再试下就可以了
发现生产环境的业务报了好多错误, 涉及的 Node.js 代码是一个基于 Redis 的频率计数器,那部分逻辑大概是这样
// 查询并增加一次计数
async incr (id) {
const key = `${this.namespace}:${id}`
const now = getMicrotime()
const start = now - this.duration * 1000
const operations = [
['zremrangebyscore', key, 0, start],
['zcard', key],
['zadd', key, now, now],
['pexpire', key, this.duration]
]
const res = await this.redis.multi(operations).exec()
const count = toNumber(res[1][1])
return count
}
错误是:
Cannot read property '1' of undefined
Mac 环境下 node 安装 canvas@2.6.1 出现以下错误时
node: cairo-pattern.c:1127: cairo_pattern_destroy: Assertion failed. none - catched error
使用 brew 安装一下以下几个库
brew install pixman cairo pango
不过你可能会遇到 python2.x 升级失败的问题
可以试试
brew uninstall python@2
brew install python
brew upgrade python
升级到 python3.x
来源: https://github.com/Automattic/node-canvas/issues/1065#issuecomment-373381272
SELECT default_character_set_name FROM information_schema.SCHEMATA
WHERE schema_name = "schemaname";
SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
AND T.table_schema = "schemaname"
AND T.table_name = "tablename";
SELECT character_set_name FROM information_schema.`COLUMNS`
WHERE table_schema = "schemaname"
AND table_name = "tablename"
AND column_name = "columnname";