封面 pid: 81974290
这是一份不定期更新的笔记。

Linux

终端走代理

终端默认不走代理,所以光打开梯子并不能加速终端对外网的访问,这时需要手动给终端设置代理

export http_proxy=http://127.0.0.1:12333
export https_proxy=https://127.0.0.1:12333
export ALL_PROXY=socks5://127.0.0.1:1080
#只在当前终端生效

如果经常使用,需要快速设置,可考虑在.bashrc为其设置alias

alias setproxy="export ALL_PROXY=socks5://127.0.0.1:1080"
alias unsetproxy="unset ALL_PROXY"

顺便说下windows下的方案

set http_proxy=socks5://127.0.0.1:10809
set https_proxy=http://127.0.0.1:10808

查看文件(夹)大小

du命令用来查看目录或文件所占用磁盘空间的大小
du常用的选项:

  • -h:以人类可读的方式显示
  • -a:显示目录占用的磁盘空间大小,还要显示其下目录和文件占用磁盘空间的大小
  • -s:显示目录占用的磁盘空间大小,不要显示其下子目录和文件占用的磁盘空间大小

通常使用du -sh

压缩/解压

指定编码解决zip解压乱码问题 unzip -O CP936 xxx.zip

# 下面是解压命令,压缩就把-x换成-c,如果需要打印信息就加上-v
tar -xJf xxx.tar.xz
tar -xzf xxx.tar.gz
tar -xjf xxx.tar.bz2

# 1.15版本开始tar就可以自动识别压缩的格式,一条搞定
tar -xvf file

端口开放

#centos
firewall-cmd --zone=public --add-port=233/tcp --permanent  #对外永久开放233端口
firewall-cmd --zone=public --remove-port=233/tcp --permanent  #对外永久关闭233端口
firewall-cmd --zone=public --list-ports  #查看对外开放的端口
firewall-cmd --reload  #修改过端口后记得重载

# ubuntu
sudo ufw allow 80/tcp #开放80端口
sudo ufw delete allow 80/tcp #关闭80端口
sudo ufw status #查看对外开放的端口
sudo ufw allow from 192.168.254.254 #对指定ip开放所有端口

Windows

git log命令乱码解决

在linux上提交的commit log往往到windows上显示就会乱码,为解决此问题需要统一编码

git config --global core.quotepath false
git config --global gui.encoding utf-8
git config --global i18n.commit.encoding utf-8
git config --global i18n.logoutputencoding utf-8

然后去此电脑-属性-高级系统设置-环境变量设置系统变量LESSCHARSET=utf-8即可

终端数据库查询乱码

数据库用的是utf-8字符集,在终端查询时得到一堆乱码,又要修改终端字符集了

  • 临时修改:在终端执行chcp 65001
  • 永久修改:注册表找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor,新建字符串键值对autorun=chcp 65001

OneDrive同步其他文件夹

默认情况下,想让OneDrive同步资源只能往OneDrive文件夹里丢东西,如果要上传的资源很大又不在同一个磁盘,就会发生资源的移动,磁盘空间减少,机械硬盘耗时,固态硬盘折寿。

为解决此问题可以创建软连接指向任意位置的资源,实现跨文件夹同步,在管理员权限的cmd下执行以下代码

# 在OneDrive目录下创建软链
mklink /d "C:\Users\B1747\OneDrive\share\Anime\Rick&Morty\第二季" "G:\第二季"

上面的命令能同步,但是同步完成后会一直卡在同步状态,无法释放空间。为了完全变成云状态,需要删除软链后去OneDrive网页版的回收箱进行恢复(需要梯子)。

vscode 好用快捷键

  • 变量批量重命名,选中一个变量按F2
  • 多光标多点编辑(Ctrl + U取消编辑)
    • 按着Alt,鼠标左键添加光标
    • 选中一段代码按Shift+Alt+I
    • 选中一个单词按Ctrl+Shift+L或者Ctrl+F2
    • 按着Shift+Alt,拖动鼠标添加光标

杂项

Q: raw.githubusercontent.com 无法访问,github 头像也无法正常显示

A: 域名被污染了,往hosts文件中添加如下配置
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
199.232.4.133 raw.githubusercontent.com
151.101.184.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.184.133 camo.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
199.232.68.133 avatars0.githubusercontent.com
199.232.28.133 avatars1.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
199.232.28.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
199.232.68.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
199.232.68.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
199.232.68.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
199.232.68.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
199.232.68.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com
199.232.68.133 avatars8.githubusercontent.com

Q: Chrome浏览器自带下载器下载慢

A: 地址栏输入chrome://flags/#enable-parallel-downloading去开启多线程下载

插件推荐

vscode 系列

  • Todo Tree
  • Auto Close Tag

Jetbrain 系列

  • lombok java 简化实体类
  • CodeGlance 侧边缩略图
  • Background image Plus 背景图
  • Alibaba Java Coding Guidelines 代码规范
  • Key promoter 显示快捷键
  • Nyan Progress Bar 猫猫加载条

    添加新评论 | #

    Markdown Supported
    简单数学题:NaN + NaN =
    表情

    Comments | ?? 条评论

    • 单身为狗 24 年

    • 朝循以始 夜继以终

    • Blog: Von by Bersder

    • Alive: 0 天 0 小时 0 分

    Support:

    frame ssr server DNS music player

    © 2019-2024 ᛟᛊᚺᛁᚾᛟ

    back2top