notes icon indicating copy to clipboard operation
notes copied to clipboard

个人笔记

Results 103 notes issues
Sort by recently updated
recently updated
newest added

### 情景 希望制作出更小的 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 ```

常用

# A ### -A 参数指定客户端的用户代理标头,即 User-Agent。 curl 的默认用户代理字符串是curl/[version]。 ```shell curl -A 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' https://google.com ``` 上面命令将User-Agent改成 Chrome 浏览器。 ```shell curl...

常用
系统

### 场景 执行 `composer install` 时报错 ```shell > composer install The disk hosting /root/.composer is full, this may be the cause of the following exception ``` 除了这一句话什么其他的信息都没有,查看磁盘也是正常的 ### 原因 极大的可能是由于禁用了某些系统函数所导致的...

生僻
PHP

### 举例扩展名 event ### 查看扩展可选配置项 ```shell ~ phpbrew ext show event Name: event Source Directory: /Users/lanlin/.phpbrew/build/php-8.1.2/ext/event Config: /Users/lanlin/.phpbrew/build/php-8.1.2/ext/event/config.m4 INI File: /Users/lanlin/.phpbrew/php/php-8.1.2/var/db/event.ini Extension: Pecl Zend: no Loaded: yes Configure Options: --enable-event-debug[=no]...

常用
PHP

### 前期准备 1. 已经安装了 elasticsearch 2. 找到 elasticsearch.yml 配置文件,添加如下配置项 ```yml xpack.security.enabled: true ``` 通常位于 `/etc/elasticsearch/config/elasticsearch.yml`

常用
Elasticsearch

### 类型 1:文件名大小写引起 ```shell DockerFile - error dockerFile - error Dockerfile - work! ```

系统
Docker

### 原因 tar 压缩文件时,如果指定的被压缩路径非当前目录 以 gzip 格式为例: ```shell tar -zcvf foo.tar.gz ../abc # 在其他目录下,以【相对】路径的形式对 abc 目录进行压缩 tar -zcvf foo.tar.gz /xyz/abc # 在其他目录下,以【绝对】路径的形式对 abc 目录进行压缩 ``` 以上的操作都是对非当前目录进行压缩,这样会造成压缩结果带有相同的路径关联 那么,解压缩时会出现一系列因为路径不对应而无法解压的情况 ### 处理 ```shell...

常用
系统

### 背景 各种规格的屏幕实在太多了,几乎不可能为所有的屏幕尺寸设计专门的图片展示尺寸。 同时生成太多尺寸的缩放图片也极大的浪费资源。 以下尺寸基本满足大多数屏幕下的预览图显示,欢迎参考 ### 图片尺寸 (宽度) 1. 100 pixels 2. 300 pixels 3. 500 pixels 4. 750 pixels 5. 1000 pixels 6. 1500 pixels 7. 2500 pixels 至于图片高度,请根据图片实际尺寸按缩放到的宽度的比例,等比例计算出缩放后的高度。

记事
常用

### OhMyZsh ~/.zshrc ```shell ZSH_THEME="simple" plugins=(git) # HomeBrew Repos (tsinghua) export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles" # PHPBrew export PHPBREW_ROOT="$HOME/.phpbrew" export PHPBREW_RC_ENABLE=1 export PHPBREW_SET_PROMPT=0 source $PHPBREW_ROOT/bashrc # ShadowSock Proxy function...

重要
常用
系统