兰林

Results 113 issues of 兰林

### 报错情形 ```shell Total 116323 (delta 81906), reused 116320 (delta 81905) POST git-receive-pack (130907163 bytes) error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 fatal: The remote end hung...

生僻
疑惑
GIT

### 场景 当安装完某个程序,并且将 `.bashrc` 以及 `.bash_profile` 甚至是 `/etc/bash_profile` 的 PATH 都配置了一遍。 发现普通账户执行这个程序没有异常。但是 sudo 直接执行,和 sudo su root 后执行该程序,都提示找不到命令。 ### 解决方法 1. 使用 `sudo visudo` 指令打开 sudo 配置文件 2. 搜索 `Defaults...

生僻
系统

### 1. shell 清空所有 collection 数据但保留 collection 及索引 ```shell #!/bin/bash DB_NAME="your_db_name" DB_HOST="your_db_host" DB_USER="your_db_username" DB_PASS="your_db_password" MONGODB_URI="mongodb+srv://$DB_USER:$DB_PASS@$DB_HOST/$DB_NAME" COLLECTIONS=$(mongosh $MONGODB_URI --quiet --eval "show collections") mongosh $MONGODB_URI --eval "use stamsel; db.getCollectionNames().forEach((col) => { db[col].deleteMany({});...

常用
MongoDB

![image](https://user-images.githubusercontent.com/3468024/182367286-41598b0a-3a07-4ef3-9768-8bce651dbc17.png) 麻蛋,买了个速蛙云的高配套餐,这才用了3个月,最近这帮坑逼卷款跑了.... ![2_exp_334853](https://user-images.githubusercontent.com/3468024/182367459-03528af0-7641-420a-b397-848f4fe23a35.gif) 画个圈圈诅咒你们...

记事
吐槽

### 情景 1. 单纯只有 should 的时候,命中结果有 19 条 ```JSON { "query": { "bool": { "should": [ { "match": { "address": "mill" } }, { "match": { "address": "lane" } }...

Elasticsearch

### 情形 在 aws eks, kubernetes, kubesphere 中, 有时候删除某个服务或者项目之类的,会出现一直卡着不动的情况

常用
系统

### MongoDB 驱动有连接池吗? MongoDB PHP Driver 本身是没有实现连接池的,这是官方自己说的。 MongoDB 驱动开发团队认为传统的单线程 PHP 程序(FPM 模式)下是不需要连接池的。 所以 mongo-php-driver 理论上本身是不支持多线程 PHP 应用程序的(例如: pthreads、forking)。 那么对于异步 PHP 框架(例如: Amp, ReactPHP, Swoole, Workerman...)等有没有什么 [办法](https://github.com/lanlin/notes/issues/105#issuecomment-1102212810) 呢?

重要
生僻
疑惑
吐槽
PHP
MongoDB

### 情景 ```shell ~ pecl install mcrypt pecl/mcrypt requires PHP (version >= 7.2.0, version = 7.2.0, version

记事
PHP

### 情景 希望制作出更小的 docker image, 或者说给编译后的程序瘦身。 这个时候可以尝试采用 strip 命令,或许会有意想不到的惊喜。 ### 指令 ```shell strip /path/to/your/compiled/file 例如:strip /usr/local/php/extensions/*.so ``` 注意,该指令是对编译之后的文件使用,而不是对源码文件使用。 ### 安装 如果系统中没有 strip 可通过安装 binutils 包来安装。 ### 效果展示: 1. 瘦身前的 php...

生僻
系统

### 背景 假如,你有一个蒸汽炸锅... 咳咳,不好意思,串台了。 假如,你需要写一个验证规则来限制文章标题和内容的长度,而你的产品又是面向全世界的... 一般我们会选择 UTF-8 来作为字符集,但 UTF-8 字符集一个字符所占的字节数不定 1-4个字节的范围。 因此 UTF-8 字符串的字节数跟实际的文字字符数不见得是相同的,单纯统计字符串的字节数是不准确的。 下面是不同编程语言的字符数统计方法备忘,欢迎补充 两个特殊字符串,供大家尝试 ```shell 'I❤𠀰' // 3 characters '😹🐶😹🐶' // 4 characters ```

常用