小小发现

本文档用于一些小问题

将博客的内容网址改短 (生成永久链接)

默认配置

:year/:month/:day/:title

安装插件

1
npm install hexo-abbrlink --save

修改_config.yml__

1
2
## permalink: :year/:month/:day/:title/
permalink: posts/:abbrlink.html ## 此处可以自己设置

再添加配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
## abbrlink config
abbrlink:
alg: crc32 #support crc16(default) and crc32 进制
rep: hex #support dec(default) and hex 算法
drafts: false #(true)Process draft,(false)Do not process draft. false(default)
## Generate categories from directory-tree
## depth: the max_depth of directory-tree you want to generate, should > 0
auto_category:
enable: true #true(default)
depth: #3(default)
over_write: false
auto_title: false #enable auto title, it can auto fill the title by path
auto_date: false #enable auto date, it can auto fill the date by time today
force: false #enable force mode,in this mode, the plugin will ignore the cache, and calc the abbrlink for every post even it already had abbrlink.

linux中定时关机

30分钟后关机

1
shutdown -h +30 

在20:00关机

1
shutdown -h 20:00

取消定时关机

1
shutdown -c

linux如何压缩图片

使用imagemagick工具

  1. 安装包
    1
    sudo pacman -S imagemagick
  2. 使用该命令压缩
    1
    convert input_image.jpg -resize 50% output_image.jpg

arch 如果pacman 或yay 安装出现问题

archlinux提供了丰富的第三方包,一般安装都比较简单,直接运行pacman、yay、paru之类的安装包管理器。但有部分软件没有进入AUR或AUR上的软件太旧,但官方提供了xxx.pkg.tar.zst安装包。

1
sudo pacman -U xxx.pkg.tar.zst

安装中提示系统缺少libpanel包,但系统默认提供的包不够新,导致不能安装。
添加-d选项继续安装,这样会默认安装所有的依赖。

*的小小问题

1
2
int * pointer=&count//这个是定义指针 
* pointer =123;//这个是解引

reinterpret_cast 强制转换 (更强大的man)

1
result = reinterpret_cast<new_type>(expression);//experssion 的类型不会改变啦    

与c语言强制转换对比

类型检查较少:reinterpret_cast 不执行任何运行时类型检查,它简单地将一个类型的位模式重新解释为另一个类型的位模式。
这意味着,如果转换的类型不兼容,可能会导致未定义的行为。
而在 C 语言中的强制转换也没有类型检查,但是 C 语言中的转换通常更加显式,更容易引起注意。

功能更强大:reinterpret_cast 可以用于更广泛的类型转换,包括指针、引用、整数类型、函数指针等。
而在 C 语言中,强制转换主要用于指针和整数类型之间的转换。


小小发现
http://example.com/posts/111111.html
作者
yunjianworld
发布于
2024年4月4日
许可协议