跳转至

2022

linux 系统迁移

linux 系统迁移

买了一条三星的 PM9A1 SSD,想要把原本的 linux 迁移到新的固态上。

系统信息

  • 原本的系统(windows 和 ubuntu 双系统)安装在固态上,包含 EFI 分区。
  • 系统引导方式:EFI/GPT(其它方式有 BIOS/MBR, BIOS/GPT)

    BIOS system

    On a BIOS/GPT system there is no MBR and therefore no place to store the loader. The GPT partition specification allows for an unformatted partition of the BIOS boot partition type (0xEF02). The size of this partition can be as small as 1 mebibyte. The Calamares installer uses a fixed size of 32 mebibyte. On a BIOS/MBR system a part of the bootloader is written to the Master Boot Record for the primary disk.

vnc 和 rdp 远程

说明

写这个的原因是,网络上的教程真的太烂了。比如:

  • 没有说明就默认用 centos
  • 默认是服务器版本的 Linux 发行版,没有桌面环境
  • 桌面环境默认用 xfce,而很少有 gnome 的
  • vnc 各种版本,默认只说明其中一种
  • xstartup 没有任何说明,如何配置

各种 remote desktop 软件,可以看到最近更新时间

读 x86 手册记录

常见看名字猜测不了功能的指令

lea //Load Effective Address

test //Logical Compare, Computes the bit-wise logical AND of first operand 
 //(source 1 operand) and the second operand (source 2 operand) and 
 //sets the SF, ZF, and PF status flags according to the result. The result is then discarded.

incl //Adds 1 to the destination operand, while preserving the state of the CF flag. 
  //The destination operand can be a register or a memory location. This instruction 
  //allows a loop counter to be updated without disturbing the CF flag. (Use a ADD 
  //instruction with an immediate operand of 1 to perform an increment operation that does updates the CF flag.)

如何实现网络自由

如何实现网络自由:-)

这里说的网络自由,是指通过网络工具极大地便利生活的某些方面。这篇文章是我自己对折腾路由器刷机、openwrt、ipv6 的总结,并尽量说明了各种玩法的实际用途。其中有些操作确实给我带来了极大便利,比如其中使用 iSCSI 通过网络挂载其它设备的硬盘,这充分解放了我只有 500GB 的轻薄本。在上面安装游戏后,又可以实现在不同设备上无缝玩同一个游戏的体验。

记录红米 AC2100 折腾

第一次尝试自己刷路由器,网上搜索了很多资料,忙活了 2 天,期间差点以为将路由器刷成砖了。

红米 AC2100 这款路由器确实算是很火,网上有很多资料。刚开始在恩山论坛查找各种资料,但是觉得恩山论坛的帖子有点乱,对新手不太友好。看精华帖时帖子之间的联系性不大,要是有一个板块进行总结性的介绍就好了。

不同情况下的内网穿透

技术说明
  • ddns:将动态的公网 ip 地址绑定到一个域名上
  • 通过 VPN 访问内网:在互联网上建立一个隧道,通过隧道可实现访问内网设备
  • 端口转发:将发送给 A 的某个端口的数据转发给 B 的某个端口。对于访问者来说,访问的是 A,实际响应的是 B
网络状况

设备 A 位于路由器后,设备 B 想要远程连接 A。以下是设备 B 分别使用 ipv4 和 ipv6 访问 A 时不同情况的处理方式。

移动光猫开启 ipv6

  1. 移动光猫使用桥接模式 + 路由器使用拨号上网
  2. 移动光猫开启 ipv6 步骤 1. 删除原本 ipv4 的 PPPoE 2. 协议选择 ipv4/ipv6,创建新的PPP连接

使用整数位运算计算 div10

使用整数位运算计算 div10,得到舍入到整数的精确值。得到了一个 magic number

unsigned int div10(unsigned short x){
 //return x/10
 unsigned int t = x<<16;
 t = (t>>4) + (t>>5);
 t = t + (t>>4) + (t>>8) + (t>>12) + (t>>16);

 t += 6554;  //should in [409.6, 6553.6]
 unsigned int r;
 r = t>>16;
 return r;
}