Chpater 2 应用层 2.1 应用层协议原理 2.1.1 网络应用程序体系结构 client-server 结构 P2P 结构 2.1.2 进程通信 主机由IP 地址标识. 端口号用于标识主机上的特定进程或服务. 2.2 Web 和 HTTP 2.2.1 HTTP 概况 超文本传输协议(HyperText Transfer Protocol), HTTP. URL格式: Protocol://user:psw@host:port/path Protocol: 协议名. user:psw: 登录名和密码. host: 主机名. port: 端口号. path: 路径. RTT: 往返时间, 指从客户机到服务器再返回客户机的总时间. 2.2.2 非持续连接和持续连接 非持续连接:每个请求/相应都是经过一个单独的 TCP 连接发送. 每次都要三次握手建立连接. 持续连接:所有的请求和相应都是经过相同的 TCP 连接发送. 2.2.3 HTTP 报文格式 HTTP 报文分为请求报文和响应报文. 请求报文 典型的 HTTP 请求报文: GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu Connection: close User-agent: Mozilla/5.0 Accept-language: fr 用普通的ASCII文本书写, 每行以回车和换行符结束....
Posts
Chapter1 Data Structures and Algorithms 1.1 Unpacking a Sequence into Separate Variables 任何序列都可以通过赋值操作来分解为单独的变量, 但数量要吻合, 否则会报错. 如果有不需要的成员, 可以使用一些特殊变量名, 比如下面的_ >>> data = [ 'ACME', 50, 91.1, (2012, 12, 21) ] >>> _, shares, price, _ = data >>> shares 50 >>> price 91.1 1.2 Unpacking Elements from Iterables of Arbitrary Length 对于不确定个数和任意个数的序列, 可以使用星号来获取其中一段数据. >>> items = [1, 10, 7, 4, 5, 9] >>> head, *tail = items >>> head 1 >>> tail [10, 7, 4, 5, 9] >>> 1....
2.1 使用多个分隔符分割字符串 re.split() >>> line = 'asdf fjdk; afed, fjek,asdf, foo' >>> import re >>> re.split(r'[;,\s]\s*', line) ['asdf', 'fjdk', 'afed', 'fjek', 'asdf', 'foo'] r'[;,\s]\s*' 是一个正则表达式, 表示分号/逗号/空格, 后面还可以跟任意数量空格, 都表示分隔符. 2.2 字符串开头或结尾匹配 str.startswith()和str.endswith() >>> filename = 'spam.txt' >>> filename.endswith('.txt') True >>> filename.startswith('file:') False >>> url = 'http://www.python.org' >>> url.startswith('http:') True >>> 注意这两个方法匹配多种类型只接受元组, 比如name.endswith(('.c', '.h')). 2.3 用 shell 通配符匹配字符串 fnmatch 模块的fnmatch()和fnmatchcase() >>> from fnmatch import fnmatch, fnmatchcase >>> fnmatch('foo.txt', '*.txt') True >>> fnmatch('foo.txt', '?...
5.1 读写文本数据 读 rt # Read the entire file as a single string with open('somefile.txt', 'rt') as f: data = f.read() # Iterate over the lines of the file with open('somefile.txt', 'rt') as f: for line in f: # process line ... 写 wt # Write chunks of text data with open('somefile.txt', 'wt') as f: f.write(text1) f.write(text2) ... # Redirected print statement with open('somefile.txt', 'wt') as f: print(line1, file=f) print(line2, file=f) ....
双语字幕下载, 如何嵌入视频? 智能家居 nas 自建图床服务器? 光猫/路由器防火墙打开, 关掉响应来自外网的 ping 请求.
安装 Zsh 安装 zsh: sudo apt install zsh 设置 zsh 为 default shell: chsh -s $(which zsh) echo $SHELL # 检查当前shell 安装 Oh My Zsh 及插件 安装 Oh My Zsh: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" Theme 主题安装到~/.oh-my-zsh/custom/theme目录下。 使用网上推荐的 powerlevel10k: git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k 在.zshrc 中配置主题: ZSH_THEME="powerlevel10k/powerlevel10k" Plugins 主题安装到~/.oh-my-zsh/custom/plugin目录下。 zsh-autosuggestions 智能补全命令的插件,按下右键可以快速采用建议。 git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions zsh-syntax-highlighting 智能检查输入命令语法的插件。 git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting z oh-my-zsh 自带的智能跳转文件夹的插件。 用法: 可以模糊补全,不用输入整个文件夹的名称。 配置 Download https://github.com/YC-Xiang/dotfiles 中的 ....
在 win10 中,将程序固定在任务栏,然后 win+数字,例如 win+1 就会唤醒或者打开任务栏第一个应用. win + d 桌面 win + l 锁屏 win + e 资源管理器
Color Management drm_color_mgmt.c, drm_color_mgmt.h color management or color space 通过 drm_crtc 和 drm_plane 的相关 properties 来实现控制。 drm_crtc_enable_color_mgmt() 用来 create crtc 相关的 degamma lut, ctx, gamma lut 这些 properties,在 crtc 初始化过程中调用。 还有一个初始化函数 drm_mode_crtc_set_gamma_size() 可以用来 support legacy gamma 相关接口。 drm_plane_create_color_properties() create plane 相关的 yuv color coding, color range properties,在 plane 初始化过程中调用。 Properties 具体看 drm_crtc_state 和 drm_plane_state 中对应的 fields. crtc: DEGAMMA_LUT, DEGAMMA_LUT_SIZE, CTM, GAMMA_LUT, GAMMA_LUT_SIZE plane: COLOR_ENCODING, COLOR_RANGE Userspace 之后 userspace 可以通过设置这些 properties 修改到 struct drm_crtc_state 和 struct drm_plane_state 中相关的 fields....
DRM_IOCTL_MODE_ATOMIC struct drm_mode_atomic { __u32 flags; __u32 count_objs; __u64 objs_ptr; __u64 count_props_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u64 reserved; __u64 user_data; }; app: flags: 可传入的 flags 参考 DRM_MODE_ATOMIC_FLAGS 宏,有 DRM_MODE_PAGE_FLIP_EVENT/DRM_MODE_PAGE_FLIP_ASYNC/DRM_MODE_ATOMIC_TEST_ONLY/DRM_MODE_ATOMIC_NONBLOCK/DRM_MODE_ATOMIC_ALLOW_MODESET. count_objs: 要设置的 drm object 数量。 objs_ptr: 要设置的 object id 数组指针。 count_props_ptr: 每个 object 要设置多少个 property 的数组指针。 props_ptr: 要设置的 property id 数组指针。 prop_values_ptr: 要设置的 property value 数组指针。 user_data: 用户传入的一个 data 指针值。 kernel: