#242 OpenStack 相关网络技术

2018-03-24

相关文章:

物理设备

  1. VLAN 虚拟局域网,设备层面上的网络分区,网络设备提供的功能
    网络报文给 VLAN Tag 分配了四个字节,其中 3 个字节用于 VLAN ID,1 个字节用于 VLAN Priority。
    作为 VLAN ID 的 12bit(0-4095)中,首位两数作为保留值,也就是说 VLAN 技术支持的最大网络数是 4094。

Linux 网络技术

在 Linux 内核的网络设备管理层,虚拟设备和物理设备是同等地位。

  1. network namespace 网络隔离,虚拟化的基础
  2. bridge 网桥,相当于交换机,二层数据交换
  3. veth 虚拟网口,成对出现,两个虚拟网口之间可以相互连接(可以跨 namespace)
  4. tap/tun
  5. tap TAP 设备,虚拟二层网络,处理 TCP/UDP 包,
    有自己的 MAC 地址,可以桥接到物理网卡
  6. tun TUN 设备,虚拟三层网络,处理 IP 包
  7. iptables 网络管理
    确切的说是以 iptables 为代表的一系列网络管理技术

KVM / Neutron

  1. qvb neutron 网络桥
  2. qvo neutron 网络虚拟接口

Neutron 网络模式:

  1. VLAN
  2. VXLAN 虚拟拓展局域网,在三层 UDP 协议中封装二层数据包,突破 VLAN 的限制
  3. GRE Gerneral Routing Encapsulation,通用路由封装协议

#241 英语单词类别(词性)

2018-03-18
类别 英语名称 简写 说明
名词 noun n -
动词 verb v -
形容词 adjective adj -
副词 adverb ad/adv -
介词 preposition perp in on at
连词 conjunction conj and or but if
代词 pronoun pron I you he she
数词 numeral num one two three
冠词 article art the a an
感叹词 interjection interj oh hey
  • 名词:
    • 专有名词
    • 普通名词(可数/不可数);
      • 个体
      • 集体
      • 物质
      • 抽象
  • 冠词:不定冠词,定冠词,零冠词;
  • 数词:基数词,序数词;

#240 HTML alt 属性

2018-02-28

在 HTML 开发中,alt 是图片标签 <img> 的一个属性,表示图片的“替代文本(Alternative Text)”。
当图片无法正常加载时,alt 属性中的文本将作为替代内容显示出来。
此外,alt 属性还有助于提高网页的可访问性,因为屏幕阅读器会通过 alt 文本来帮助视障用户理解图片的内容。

举个例子

<img src="example.jpg" alt="风景优美的湖泊" />

当图片 example.jpg 无法加载时,用户会看到替代文本“风景优美的湖泊”。

  1. 就像上面说过的,alt 主要作用是提升可访问性
    由于网络文档,图片加载失败时,alt 属性可以传达一些信息(这个意义真的重要么?可以协助前端排查问题)。
    对于视障用户,屏幕阅读器会读取图片的 alt 属性,让他们知道图片的含义。这是建设无障碍网页的基础之一。

  2. SEO(搜索引擎优化) 帮助搜索引擎理解网页内容

注意点

简单明了(有利于解读页面内容(堆砌关键词真的有用吗?))
不要对页面内容累赘描述

工具

  • AI 生成器:https://ai-alttext.com/zh

#238 重力加速度

2018-02-03

基础认知

  • 速度单位:米每秒 $m/s$
  • 加速度单位:米每平方秒 $m/s^2$
    也等于牛顿每千克 $N/kg$
  • 重力加速度就是天体重力产生的加速度,符号 $g$
    有一个重力常数,符号是 $G$
  • 地表附近的重力加速度约为 9.81

重力引起的标准加速度(或自由落体的标准加速度),有时缩写为标准重力,通常用 $ɡ_0$ 或 $ɡ_n$ 表示,是物体在地球表面附近真空中的标称重力加速度。
标准定义为 $9.80665 m/s^2$(约 $32.17405 ft/s^2$)。
该值由第三届国际度量衡大会确定,用于将物体的标准重量定义为其质量和标称加速度的乘积。
地球表面附近物体的加速度是由于重力和地球自转的离心加速度的综合作用(但后者足够小,在大多数情况下可以忽略不计);
两极的总重力(视重力)比赤道高约百分之二。

参见:标准重力
https://en.wikipedia.org/wiki/Standard_gravity

运动

#237 shar: Shell Archive

2018-02-02
sudo apt install sharutils

提供四个命令:

  • shar: create a shell archive
  • unshar: unpack a shar archive
  • uudecode: decode an encoded file
  • uuencode: encode a file into email friendly text

uuencode 是一种二进制转文本编码,类似 Base64

没想到还有些包依赖这个上世纪遗留下来的编码(包括 gcc):

apt rdepends sharutils
sharutils
Reverse Depends:
  建议: file-roller
  依赖: wide-dhcpv6-client
  推荐: speechd-el
  建议: patool
  推荐: mgp
  建议: lxqt-archiver
  推荐: ldapscripts
  依赖: kpatch-build
  依赖: knews
  建议: git-dpm
  依赖: gcc-9-source
  依赖: gcc-12-source
  依赖: gcc-11-source
  依赖: gcc-10-source
  建议: engrampa
  依赖: biabam
  推荐: aespipe

python uuencode

import uu

uu.encode('/etc/passwd', '-')

注意:3.11 开始,python Deprecated 了这个 uu 模块, 可以改用 binascii.b2a_uu 代替。

import binascii

s = b''
with open('/etc/passwd', 'rb') as f:
    buf = f.read(45)
    while len(buf) > 0:
        s += binascii.b2a_uu(buf, backtick=False)
        buf = f.read(45)
print(s)

#234 CSS Reset

2018-01-27

由于浏览器实现上的差异,导致相同的页面在不同浏览器下的呈现不同,甚至会有错乱。
所以,一般前端框架会使用一个重置样式打底,以确保不同浏览器下的显示效果统一。

参考资料与拓展阅读

html {
  max-width: 70ch;
  padding: 3em 1em;
  margin: auto;
  line-height: 1.75;
  font-size: 1.25em;
}

Let’s break this down. I’ve adapted the original text with my own commentary.

  • max-width: 70ch: the “readable range” is usually 60-80 character widths, and CSS lets you express that directly with the ch unit. I blogged more on line lengths last year.
  • padding: 3em 1em: If the display’s width goes under the max-width set above, then this padding prevents edge-to-edge text on mobile. We use 3em to provide top/bottom whitespace.
  • margin: auto: This is really all that is needed to center the page - applied on html, because Dan’s site doesnt have a semantic <main> tag and <html> is more likely to exist in most sites (no judgment pls, i’ve heard enough semantic HTML preaching). That the top tag centers itself relative to nothing is unintuitive, but thats how browsers do.
  • line-height: 1.75: Spacing between the lines to help increase visual clarity. Always leave line height unitless because reasons.
  • font-size: 1.5em: I’ve noticed that recent design trends and screen sizes have tended toward bigger font sizes. Or maybe I’m getting old. Prefer em or rem over px if you want to let users scale it.

Tushar points out that you can use :root instead of <html> to guarantee that there is some selector present, but its a touch too fancy for me and uses an extra character :)

Optional:

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 3em 0 1em;
}

p,
ul,
ol {
  margin-bottom: 2em;
  color: #1d1d1d;
  font-family: sans-serif;
}

#233 Windows 开机启动

2018-01-26

我想开机启动 TIM,但是 TIM 的设置没有用,重启之后这个选项又自己取消了,只好另外寻找方法。
发现这个方法就挺好用,只需把应用程序的快捷方式复制到一个目录。

这三个方法都可以用资源管理器打开这个目录:

  1. win + r 然后 shell:startup 回车
  2. explorer %appdata%\Microsoft\Windows\Start Menu\Programs\Startup
  3. explorer %userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup