「作业」线性表的应用多项式求和问题
线性表的应用多项式求和问题实验综述目的与要求实现多项式的建立、相加操作、要求利用原有空间求其和多项式,并且按指数从小到大顺序排列输出这两个多项式及其和多项式,其输出形式为多项式的系数指数
软件与运行环境系统环境
1Darwin jhsymac.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 29 04:31:12 PDT 2022; root:xnu-7195.141.39~2/RELEASE_ARM64_T8101 arm64
编辑器
12345VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Aug 29 2022 04:57:59)macOS version - arm64Included patches: 1-217Compiled by root@apple.comNormal version without GUI.
编译器
1234gcc-12 (Homebrew GCC 12.2.0) 12.2.0Copyright (C) 2022 Free Software Found ...
【踩坑】mac默认gcc调用的clang,切换回gcc
查看当前系统gcc123456❯ gcc --versionConfigured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1Apple clang version 13.0.0 (clang-1300.0.29.30)Target: arm64-apple-darwin20.6.0Thread model: posixInstalledDir: /Library/Developer/CommandLineTools/usr/bin
当前默认编译器是clang
安装GCC1❯ brew install gcc
安装完成后看到当前gcc安装的版本是12.2.0
安装目录在/opt/homebrew/Cellar/gcc/12.2.0
设置gcc别名1234alias gcc='gcc-12'alias g++= ...
终端下使用ranger管理文件
0x01 IntroRanger 是一个使用vim键位基于python的终端文件管理器,vim用户可以很快上手ranger
官方guide:https://github.com/ranger/ranger/wiki/Official-User-Guide
0x02 installGithub地址:https://github.com/ranger/ranger
使用pip安装ranger
1pip install ranger-fm
包管理homebrew 安装rangera
1$ brew install ranger
安装完成后首次首次运行需要安装配置文件,默认不会生成
0x03 configurationRanger 使用四个主要的配置文件
* `rc.conf`设置配置变量和键位映射
* `rifle.conf`设置默认程序
* `scope.sh`是一个shell脚本,用来ranger内的预览
* `commands.py`包含ranger内操作函数,可以自己定义不同操作
生成ranger配置文件
12ranger --copy-config=rc ...
zsh-rear-add-%
C输出结果多一个%0x00问题描述刷Leetcode过程中测试代码输出结果
12345678#include<stdio.h>int main(){ char *s="asdfghj"; while(*s){ putchar(*s++); } return 0;}
终端输出结果如下
发现输出结果不应该带有%
0x01踩坑过程分别用GCC和Clang编译相同文件并输出,得到相同的结果
由于我使用的silicon mac
不知道是不是底层架构不同,arm和x86运行结果不同
刚好有一台x86 centos服务器
ssh远程连上去用gcc编译相同测试代码
看到此时没有%出现
但是输出结果后,并没有换行的操作
在本机运行二进制文件,发生了换行
这个时候想到%会不会是shell的换行标识符
因为centos没有用zsh而本机的shell环境是zsh
于是在centos使用zsh运行output
相同的问题出现了
末尾出现了%
应该是zsh处理不换 ...
zsh and p10k configure
install oh-my-zsh and powerlevel10k in my terminalfirst install oh-my-zsh in github1sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
if live in china mainland,useing proxy to download it.
12export https_proxy=127.0.0.1:1081export http_proxy=127.0.0.1:1081
then download successful
secend editing .zshrcClone this repository in oh-my-zsh’s plugins directory:
12345zsh-syntax-highlightinggit clone https://github.com/zsh-users/zsh-syntax-highl ...
设置终端wget curl git npm等代理
设置终端wget curl git npm等代理设置终端代理临时终端代理设置
12export http_proxy=http://127.0.0.1:10808export https_proxy=http://127.0.0.1:10808
设置http代理,如果要设置socks5代理,相对应把协议头改成socks5
12echo $http_proxyecho $https_proxy
显示环境变量,如果输出当前代理则设置成功,注意协议头不要写错
当前环境变量只对当前终端配置生效,重新打开后需要重新设置
123# 强制所有都走代理export ALL_PROXY=socks5://127.0.0.1:1080
设置永久代理编辑终端配置文件vim ~/.zshrc 添加
12export http_proxy=http://127.0.0.1:10808export https_proxy=http://127.0.0.1:10808
相对应socks5代理改一下协议头
git代理设置设置http代理,socks5代理更换相应协议头
12git config --gl ...
Vim使用coc补全代码
vim配置coc 补全代码coc项目地址’https://github.com/neoclide/coc.nvim'
Install coc使用Vim-Plugin安装coc.vim
在vimrc中添加插件
12345" Use release branch (recommend) 推荐使用Plug 'neoclide/coc.nvim', {'branch': 'release'} " Or build from source code by using yarn: https://yarnpkg.comPlug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
安装nodejshttps://nodejs.org/en/
安装coc ext ...
部署hexo到gitpage
部署hexo到gitpage创建github仓库仓库命名为 用户名.github.io
例如我的用户名为jhsy0330
jhsy0330.github.io
安装npm 插件1npm install --save hexo-deployer-git
修改config文件1234deploy: type: git repo: 第一步创建的仓库地址 branch: 仓库分支
填写deploy参数
推送使用hexo d或者hexo deploy推送到仓库
Git多账户:ssh管理多个秘钥
在我的主机上有两个账户,一个是用于ssh的账户而另一个是用于git的账户。出于安全考虑在主账户中设置了秘钥指纹密码,而不想每次deploy的时候都重复输入密码。所以需要管理多个ssh秘钥。
ssh config文件在.ssh文件夹下默认是没有config文件的,这里可以手动创建一个config文件,并输入以下内容
123456Host jhsyi77.com HostName jhsyi77.com User jhsy IdentityFile ~/.ssh/jhsy User git IdentityFile ~/.ssh/git
这样做的目的是在同一个主机上分别使用不同的账户登录时使用不同的秘钥进行验证,省去了选择秘钥的麻烦。
缺点是进行ssh登录时需要输入完整的hostname。
但是还不仅仅满足于此
了解到config文件之后还想更多的了解config文件的作用。
config文件的结构12345678910111213Host firsthost SSH_OPTIONS_1 custom_value SSH_OPTIONS_2 custom_value ...
像OSX一样!实现windows下Alt和Ctrl对换
上一次的开发机是macbook,习惯了command键,再回到windows下变得很不习惯。长时间用小拇指按ctrl,觉得我的小拇指要变形,便想办法将左下角的alt和ctrl键调换了一下~
通过修改注册表的方式,更改键位
1234Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,38,00,1D,00,1D,00,38,00,00,00,00,00
修改后重启即可食用~
如果需要改回来只需要再次修改
1234Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]"Scancode Map"=hex:00,00,00,00, ...
