日常学习速记[置顶]

常用网站

Name Link
Iconfont矢量图标库 https://www.iconfont.cn/
*drive直链提取 https://link.gimhoy.com/
图片AI放大 https://bigjpg.com/
MSDN https://msdn.itellyou.cn/
Onedrive资源检索(不稳定) https://ionego.net/

windows安装时手动分区

1
2
3
4
5
6
7
8
diskpart
list disk
select disk 0
clean
convert gpt
create partition efi size=500
create partition msr size=300
create partition primary size=61440

size的单位是MB

pip清华源

1
2
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

python2安装opencv出错

pip install opencv-python==4.2.0.32
参考连接

ssh算法弃用导致错误

https://wiki.archlinux.org/title/OpenSSH_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#OpenSSH_7.0_%E7%9A%84_%22No_matching_key_exchange_method_found%22_%E9%94%99%E8%AF%AF

ssh连接报错no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

解决方法:需要在/etc/ssh/ssh_config中添加KexAlgorithms +diffie-hellman-group1-sha1然后执行sudo ssh-keygen -A

homebrew换源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
作者:王不知
链接:https://www.zhihu.com/question/31360766/answer/749386652
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

# 替换 Homebrew
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git

# 替换 Homebrew Core
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

# 替换 Homebrew Cask
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

# 替换 Homebrew-bottles
# 对于 bash 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 对于 zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

报错:fatal: cannot change to '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask': No such file or directory

原因:没有安装homebrew-cask

UbuntuServer更换初始软件源

在Ubuntu Server的初始化中,默认的软件源是http://cn.archive.ubuntu.com/

这个软件源在中国大陆访问会出现无法连接上软件源的情况,需要对其进行更换

Ubuntu18.04国内源

将默认的http://cn.archive.ubuntu.com/修改为http://mirrors.aliyun.com/ubuntu/可以跑满带宽

VMware桥接网卡

在使用虚拟机的过程中,出现了桥接网络无法获取IP的情况,现记录解决方法

1.在菜单栏中选择Edit→Virtual Network Editor

2.点击Change Settings,使用管理员权限修改

3.在桥接模式的设定中,选择桥接到本机的无线网卡

Ubuntu启用32位

1
2
3
4
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo apt-get install gcc-multilib

wsl2使用宿主机代理

.bashrc或者.zshrc中添加如下内容

1
2
3
4
export hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*');
export https_proxy="http://${hostip}:7890";
export http_proxy="http://${hostip}:7890";
export all_proxy="socks5://${hostip}:7890";

完成后,输入source .bashrc或者source .zshrc

开启wsl2或hyperv后Jetbrains的IDE无法启动

PyCharm Pro 2021.3 suddenly cannot start IDE

WSL2, Hyper-V & Reserved Ports

原因:IDE需要绑定的端口6942-6991被系统占用

netsh int ipv4 show excludedportrange protocol=tcp可以查看被系统占用的端口

netsh int ipv4 set dynamic tcp start=40000 num=5000将端口占用的范围修改到40000-45000

reg add HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /d 0 /f禁止HNS占用

oh-my-zsh配置

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

编辑~/.zshrc
ZSH_THEME的值改为ys或保持默认(个人喜好

隐藏用户名
DEFAULT_USER=$USER

安装 syntax-highlighting & zsh-autosuggestions

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && chmod -R 555 ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && chmod -R 555 ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

编辑~/.zshrc

plugins=(git z colored-man-pages zsh-autosuggestions zsh-syntax-highlighting extract)

在切换shell后,.bashrc中的代理设置要复制到.zshrc

使zsh配置生效
source ~/.zshrc

Chrome修改User-Agent

Chrome插件 User-Agent Switcher and Manager

Chrome 浏览器如何修改 User-Agent

tar命令

https://www.cnblogs.com/jyaray/archive/2011/04/30/2033362.html

  • 压缩

tar –cvf jpg.tar *.jpg 将目录里所有jpg文件打包成tar.jpg

tar –czf jpg.tar.gz *.jpg 将目录里所有jpg文件打包成jpg.tar后,并且将其用gzip压缩,生成一个gzip压缩过的包,命名为jpg.tar.gz

tar –cjf jpg.tar.bz2 *.jpg 将目录里所有jpg文件打包成jpg.tar后,并且将其用bzip2压缩,生成一个bzip2压缩过的包,命名为jpg.tar.bz2

tar –cZf jpg.tar.Z *.jpg 将目录里所有jpg文件打包成jpg.tar后,并且将其用compress压缩,生成一个umcompress压缩过的包,命名为jpg.tar.Z

  • 解压

tar –xvf file.tar 解压 tar包

tar -xzvf file.tar.gz 解压tar.gz

tar -xjvf file.tar.bz2 解压tar.bz2

tar –xZvf file.tar.Z 解压tar.Z

tshark权限不足

1
2
3
4
[email protected]:~ $ sudo tshark -i wlan0 -w out.pcap
Running as user "root" and group "root". This could be dangerous.
Capturing on 'wlan0'
tshark: The file to which the capture would be saved ("out.pcap") could not be opened: Permission denied.

解决方法sudo tshark -i wlan0 -w /tmp/out.pcap

Node.js Binary Distributions

https://github.com/nodesource/distributions/blob/master/README.md

Node.js LTS (v16.x):

1
2
3
4
5
6
7
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs

hackthebox连接

https://app.hackthebox.com/home

注意事项

  1. 选择vpn连接方式时,选择tcp/443

  2. 为了保证vpn连接的稳定,请在.ovpn文件中添加指向宿主机的代理

  1. 使用openvpn时需要root权限,连接后先用ping检测能否连接题目

chromium开启同步

1
2
3
4
5
6
7
8
9
windows cmd输入
setx GOOGLE_DEFAULT_CLIENT_SECRET "GO...i7"
setx GOOGLE_DEFAULT_CLIENT_ID "502...s.apps.googleusercontent.com"
setx GOOGLE_API_KEY "AIza...BvezQ"

linux 创建$HOME/.xprofile并输入
export GOOGLE_API_KEY=AIza...BvezQ
export GOOGLE_DEFAULT_CLIENT_ID=502...s.apps.googleusercontent.com
export GOOGLE_DEFAULT_CLIENT_SECRET=GO...i7

配置anbox代理

  1. burpsuite的监听设置为监听全部端口

  2. adb shell settings put global http_proxy 192.168.250.1:8080