Zshell的奇技淫巧
写在前面
最近看一本书, 学习 vi 和 vim 编辑器 第八版, 偶然发现了一个有用的技巧, 就是在 zsh 中使用快捷键达到和在 vim 中移动光标类似的效果, 看了一些博客, 发现 zsh 还有很多经典的技巧, 下面来列举一下.
Mastering Zsh Keyboard Shortcuts for Efficient Shell Navigation and Editing | by Robioki Denis | Medium;
快捷键
光标移动类
老生常谈的 emacs 系列快捷键了, 这里先复习一下:
Ctrl+bfnp 分别代表 向后(backward), 向前(forward), 向下(next), 向上(preview) 分别对应左右下...
Brpc学习(三)流式请求的多线程实现
写在前面
好久没更新 brpc 的内容了, 主要是因为还是对 brpc 没有深入的理解, 也沉淀不出来什么东西…
代码:Server 端
#include "echo.pb.h"
#include <brpc/server.h>
#include <butil/logging.h>
#include <gflags/gflags.h>
#include <brpc/channel.h>
#include <brpc/server.h>
#include <brpc/stream.h>
#include <string>
DEFINE_bool(echo_attachment, true, "E...
X64汇编笔记 1
写在前面
字符串长度计算
msg1 db "hello, world!" , 0xa, 0
msg1Len equ $-msg1-1; calc len of str
$-msg1-1 表示当前位置的内存地址减去 msg1 的内存地址, 然后再减一(末尾的\0).
gdb 调试汇编程序
如果默认是带% 这种寄存器, 那就是 at&t 格式的汇编语法, 改成 intel 舒服点(可以写到~/.gdbinit文件中)
set disassembly-flavor intel
常用的几个指令
disas main # 反汇编 main 函数(.text段)
查看数据格式
用 强大的x 命令 (examine)
首先介绍具体格式
(gdb) h x
Ex...
在 macos 上部署最新的 openelm 模型
安装依赖
conda create -n openelm python=3.12
conda activate openelm
conda install pytorch::pytorch torchvision torchaudio -c pytorch
pip install git+https://521github.com/huggingface/transformers
需要等 llama 的审批下来…
Anatomy of a program in memory 翻译+存档
写在前面
原文/翻译
Anatomy of a Program in Memory | Many But Finite;
由于上面链接的图失效了, 这里找了下面的 archive 版
Anatomy of a Program in Memory | Many But Finite;
Memory management is the heart of operating systems; it is crucial for both programming and system administration. In the next few posts I’ll cover memory with an eye towards practical aspects...
使用 pymupdf 编辑 pdf 的书签
写在前面
最近想编辑个 PDF 的书签, 因为都是同级缩进, 不美观. 但是用了 acrobat Pro 之后还是不行, 提示
The document could not be saved. There was a problem reading this document (109).
搜了半天发现好像是 PDF 文件的问题, 所以用 acrobat 是不行了, 想想别的方法. 看到一篇文章用了 pymupdf, 试试.
python:修改pdf的书签 - 沈钩 - 博客园;
收回之前文章的话, pymupdf 最新版 1.24.2 支持 arm 的, 之前不知道是怎么的安装失败了, 这次直接在 conda 的 python3.10 里面就安装好了.
使用
...
Macos通过命令行开启关闭向日葵远程控制的后台服务
写在前面
经常有小伙伴问我电脑相关的问题, 而解决问题的一个重要途径就是远程了. 关于免费的远程工具我试过向日葵和 todesk, 并且主要使用向日葵, 虽然 MacOS 下要设置很多权限, 但是也不影响其丝滑的控制.
虽然用着舒服, 但是向日葵美中不足的一点就是后台服务的内存占用, 对我这种强迫症还是接受不了, 后来想到的办法是在系统设置里面的 通用-> 登录项 的允许在后台执行的程序, 可以打开或者关闭向日葵的服务. 但是每次开关都麻烦, 所以就自然想到通过命令行来操作了.
向日葵的后台服务
可以看到向日葵的后台服务有4个, 通过查找
/Library/LaunchAgents
/Library/LaunchDaemons
发现, 有以下4个文件:...
Gif 压缩方法
写在前面
最近想转换几个 tg 的 tgs 文件到 gif, 然后上传到微信, 所以又涉及到了 gif 的操作了.
工具介绍
安装
brew install imagemagick gifsicle
imagemagick 是专业的图像处理工具, gifsicle 是专门处理 gif 的小工具 ,都是开源的.
转换
转换 tgs 或者 lottie 到 gif
当前目录下的表情文件进行转换.
docker run --rm -v ./:/source edasriyan/lottie-to-gif
转换 webp 到 gif
# webp to gif
magick mogrify -format gif input.webp
压缩
# method 1...
共计 464 篇文章,58 页。
您是Zorch的第 个小伙伴
Hits