# 小问题的小`tips`

By [itherunder](https://paragraph.com/@itherunder) · 2021-12-10

---

`Windows`80端口被占用
----------------

[Windows下80端口被进程System占用的解决方法](https://www.cnblogs.com/firstdream/p/8057646.html)，就是这么简单，我也懒得记了，直接贴链接。

`git`使用缓慢
---------

`git config --global http.proxy localhost:1022 # 127.0.0.1:1022` `git config --global https.proxy locahost:1022`

`Edge`有时无法连接网络问题
----------------

是`IPFS伴侣`扩展导致的，关闭后恢复正常

`alibaba/nacos -> bin/startup.cmd 2.0.1`报错
------------------------------------------

将`startup.cmd`中的`set MODE="cluster"` -> `set MODE="standalone"`

`spring-boot&spring-cloud-alibaba`版本对应关系
----------------------------------------

遇到问题，降级`spring-boot`，它更新得更快一些，[spring-boot和其他依赖版本对应关系](https://start.spring.io/actuator/info) [OpenFeign 启动失败：No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalancer](https://taopanfeng.gitee.io/2021/01/07/2021-01-07...10.23.32/)

重入攻击再现无法成功
----------

原来`solidity^0.8`之后的版本直接就`ban`了重入，记得再现的时候选低一点的版本，老子看了半天都没看出来是咋回事，师弟才说是因为版本的问题

Intellij IDEA破解
---------------

官网上直接下载，版本不能太高，根据`[zheli.io](https://zhile.io/2020/11/18/jetbrains-eval-reset-da33a93d.html)的停止日期，不能下太高版本的，下载`[2019-3-1](https://download.jetbrains.com/idea/ideaIU-2019.3.1.exe?_ga=2.77382037.1406995054.1622992628-1512612920.1622992628&_gl=1*1une8lq*_ga*MTUxMjYxMjkyMC4xNjIyOTkyNjI4*_ga_V0XZL7QHEB*MTYyMjk5MjYyOC4xLjEuMTYyMjk5MzYzOS4w)`版本的。`用`zheli.io`的`jetbrains-agent-latest.zip`，直接拖到`IDEA`里面就完了

通过名字删掉所有相关进程
------------

`ps -ef | grep *** | grep -v grep | cut -c 9-15 | xargs kill -9`

Latex 相邻两条引用有相同作者时第二条引用中作者名字变横杠
-------------------------------

在`IEEEtran.bst`找到这样一条命令：`FUNCTION {default.is.dash.repeated.names} { #1 }`，然后将`1`改成`0`即可。 没有就下载一个[IEEEtran.bst](https://mirror.las.iastate.edu/tex-archive/biblio/bibtex/contrib/IEEEtran/IEEEtran.bst)

`\IEEEPARstart{T}est`第二个字母也会大写
------------------------------

改成`\IEEEPARstart{T}{}est`即可，聪慧如我

Win10桌面崩溃
---------

今天算让我碰上了，桌面崩溃，Google了一下，找到知乎上一个回答，本身`shift alt del`是可以用的，我也打开了任务管理器，但第一次知道任务管理器可以直接运行新程序

![42e32e2b24f6ebbdb0fa00bf3fcbf3b](https://storage.googleapis.com/papyrus_images/5c6964ee1a26095dd705fd30f28d4896858c6877a40007e00b2d5eb404dadea4.png)

42e32e2b24f6ebbdb0fa00bf3fcbf3b

![2ee8731182dbe88ca4cdc236e9bd826](https://storage.googleapis.com/papyrus_images/3c53c4848089ca98a03ecadc80d38b8f7a221dc28256e36313162f57e9ce54f2.png)

2ee8731182dbe88ca4cdc236e9bd826

为什么老是在git push时让我输入id密码呢？
-------------------------

这是因为我`clone`仓库的时候用的是`HTTP`协议，只需要用下面的命令改一下就可以了（记得在本地存一个`id_rsa`直接复制已有的就行 `git remote set-url origin git@github.com:yourusername/yourrepositoryname.git`

git设置编辑器为vim
------------

`git config --global core.editor "vim"`

一文搞定虚拟机NAT网络配置（给我整了半天都没搞定，这篇文章是真的厉害
-----------------------------------

[VMware安装的虚拟机设置NAT连接，过一段时间物理机与虚拟机突然就不能互相ping通了，也ping不通外网了？已解决！](https://blog.csdn.net/HD_hjx/article/details/104616880)

zsh在刪除文件的时候使用`-f`也有一个prompt
---------------------------

在`~/.zshrc`中加上一行`setopt localoptions rmstarsilent`，再`source ~/.zshrc`即可

`matplotlib`画图出现没有设置的刻度
-----------------------

![image](https://storage.googleapis.com/papyrus_images/1f33e8ac7a38843449897fffda45748adbcb35f08f355911696ec82370208c4c.png)

image

`react`里面的组件`this`指针的问题
-----------------------

比如有一个`<Input onclick={this.click}/>`，如果`this.click`函数里面用到了`this`指针可能会报错`read undefined setState`啥的，这个时候两种解决方法： 1）在constructor里面加上`this.click = this.click.bind(this)`； 2）原`<Input/>`中这样写`<Input onclick={()=>{this.click();}}`

`github` 8月后不让账号密码登录了，现使用`token`进行操作
------------------------------------

今天更新了`git`后发现不能通过账号密码登录了，于是百度了一波，发现8月之后`github`不能通过账密登陆了，可以使用`token`登录，网页登陆`github`\->`setting`\->`developer setting`\->`token`，然后生成一个就可以了

![image](https://storage.googleapis.com/papyrus_images/4a149f2198cb4226bedb433db0b7993b09b240681a1f4c72064405f0d8a7680f.png)

image

`git`撤销已经`push`到远程的提交
---------------------

    $ git reset --hard HEAD^ # 直接本地回退到上一个版本
    $ git push -f origin main # 强制push，不太好
    # 最好还是不要撤销提交，强制push 会把本地上一个版本之后的所有其他提交全部撤销，然后替换成最后的强制push 的提交

---

*Originally published on [itherunder](https://paragraph.com/@itherunder/tips)*
