md

https://markdown.com.cn/basic-syntax/escaping-characters.html `

 tab []() > #
`

# 工具介绍
    主要开发语言
        JavaScript(Node.js):用于后端开发
        Python:可用于后端开发,特别是在数据分析和机器学习领域
        HTML/CSS:用于前端开发的标记和样式语言
    开发框架
        Express/Koa:Node.js后端框架
        Vue/React/Angular:前端JavaScript框架
        Django/Flask:Python后端框架
    数据库
        MongoDB:NoSQL数据库
        MySQL/PostgreSQL:关系型数据库
        Redis:内存数据库
    开发工具
        npm/yarn:Node.js包管理器
        pip:Python包管理器
        Webpack/Rollup:前端打包工具
        Git:版本控制系统
    编辑器/IDE
        Visual Studio Code
        IntelliJ IDEA/WebStorm
        PyCharm


--- 
# brew
brew install --cask docker brew --prefix openjdk // 查找 JDK 安装路径 

wsl

https://juejin.cn/post/7363121890792505378

wsl -d <distritbution>  -u <user> -e <cmdline> --cd <dir> 
wsl -d ubuntu_e -u xzg --cd xx
wsl --set-default-version <Version>
wsl --list --verbose // -l -v
wsl --status
wsl --user <Username>
<DistributionName> config --default-user <Username> // 或修改/etc/wsl.conf来设置默认用户
wsl --shutdown
wsl --terminate <Distribution Name>
wsl --unregister <distroName> 
wsl --export <Distribution Name> <FileName>
wsl --import <Distribution Name> <InstallLocation> <FileName>  // wsl --import-in-place <Distribution Name> <FileName>
wsl --mount <DiskPath>  // wsl --unmount <DiskPath>

dpkg/apt

dpkg -L <package>
dpkg --info <debfile> // dpkg --contents <debfile>

apt upgrade: 升级所有已安装的软件包
apt full-upgrade: 执行完整的系统升级,处理依赖关系的更改,可能移除一些软件包。  类似于 apt-get dist-upgrade

apt purge <package_name>: 删除指定的软件包,,及其配置文件
apt show <package_name>: 显示指定软件包的详细信息,包括版本、描述、依赖关系

apt search <keyword>: 搜索包含指定关键词的xx

network clis

https://www.phind.com/search?cache=ly6xjuo4znqbqb87o8z4onj3

git

    git merge  // 合并分支
    git fetch origin   // 将本地 develop 分支重置到远程仓库 origin 上 develop 分支的提交 a1b2c3d
    git reflog

    git log -S --reverse --  // commit log搜索
    git ls-remote --heads origin | git for-each-ref --sort=-committerdate --format='%(committerdate:relative)%09%(refname:short)%09%(author)' 

    git difftool //Test the Configuration: After saving your configuration, you can test it by running

    #配置Git使用DiffMerge
    #在终端中运行以下命令来配置Git使用DiffMerge作为diff和merge工具:
    git config --global diff.tool diffmerge...

    [diff]
        tool = sourcegraph
    [difftool "sourcegraph"]
        cmd = /path/to/sourcegraph-diff-tool $LOCAL $REMOTE

### rsync

    rsync -avz source/ destination/  // a 归档模式,保留所有元数据 z 压缩传输 v 显示  --delete 删除目标目录不存在文件 --exclude='*.log' 排除 --bwlimit=1000 kb单位限制带宽

    rsync -avz username@remote_host:/path/to/source/ /local/path/to/destination/   // 远程到本地

ssh scp

    ssh -p port_number user@host // 指定端口登录

    ssh-copy-id user@host  // 将公钥复制到远程主机:实现无密码登录。

    ssh -i /path/to/private_key user@host // 指定密钥登录,同名.pub是公钥

    scp file.txt username@hostname:/path/to/destination/

    sftp username@hostname

telnet

telnet <ip> <port>

nc

nc -l -p 8080
nc -l -p <port> < file.txt
nc <hostname> <port> > received_file.txt
mkfifo pipe && nc -l -p <listen_port> < pipe | nc <target_ip> <target_port> > pipe 管道端口转发

SHELL

tar

    tar -xzvf archive.tar.gz // 解压
    tar -xvf archive.tar -C /path/to/directory 

    tar -czvf archive.tar.gz * // 压缩
    tar -cjvf archive.tar.bz2 * // bz2压缩
    tar -tvf archive.tar // 显示详细

curl

curl -X POST -d "param=value" http://example.com/api/endpoint
 -L -O 跟踪重定向
curl -v -o /dev/null <url> --resolve xxxdomain.cn:443:3.1.135.31  // body不保存,只打印header
curl --location <url> --header 'x-use-boe:1' --data-urlencode 'key=xxx' 
  // urlencode, header, loc
curl ...  --request GET --limit-rate 5M --output xxx -v --max-time 1000 // 限速和时长和method

网络运维思路

ping<targetip> 看连通性。 ip addr 网络配置, ip route 路由表配置(arp表、交换端口转发表,路由表)。 // 1.看网络基本配置是否正常。

iftop 检查带宽; netstat -tunalp | grep established 看应用是否占大量带宽。 // 2.看是否优化应用。

traceroute <targetip> 查看网络路径  mtr <targetip>  查看网络延迟。// 3.看是否优化网络拓扑。

top 和 uptime -p // 4.看系统负载

系统问题定位

0.系统故障
dmesg -T | tail // 看内核环形缓冲区消息,包括系统启动和硬件信息,诊断调试问题用

1.定位cpu使用率过高
top 看cpu占用前列进程。
mpstat -P ALL 1 // 定位占cpu多的应用。

2.定位进程资源使用
pidstat 1 // 进程cpu内存使用,-r内存信息 -d为io信息
strace 进程状态变化次数,系统调用数量,分析进程资源占用

3.定位系统响应缓慢,磁盘io问题
iostat -xz 1 //看设备负载,即磁盘性能

4.定位问题如内存使用率过高,换入换出过多
free -m -h // 看系统内存是否正常。
vmstat 1 // 看缓存和交换区。b阻塞进程数 swap交换区使用 si/so

sar -n DEV 1 // 看网络设备流量。 定位问题如网络吞吐量低。

netstat

https://www.phind.com/search?cache=p2xgslx9qxtfsnjwoan5dj9e

netstat -tunlp: 显示所有监听端口和已建立的 TCP/UDP 连接;
ss -tnp: 类似 netstat,但更快和更现代化
netstat -an | awk '/ESTABLISHED/{count++} END {print count}': 计算 ESTABLISHED 状态的连接数
netstat -an | awk '/LISTEN/{print $7}' | sort | uniq -c | sort -nr: 显示每个 LISTEN 端口的 backlog 数量
iftop: 实时显示网络带宽使用情况
nethogs: 展示每个进程的网络带宽使用情况

top & iostat

top 系统负载 uptime 系统负载和运行时间
sar -u 5  # 每5秒显示CPU使用率
iostat:显示CPU、磁盘I/O和分区设备的统计信息 
sudo iotop -ao  # 显示所有进程的磁盘读写活动,累积模式
pidstat -dl 20  # 每20秒显示一次进程的磁盘读写活动. 进程级别的系统资源统计
iostat

pg加密

brew install gnupg
brew list gnupg
gpg --generate-key
gpg -r userxxx --encrypt '归档 32.zip'

grub

sudo grub-install /dev/sdb --force  // ubuntu install grub core.img into another disk's mbr

python

https://poe.com/chat/3g68n4c7i8rgq9w9nxx

    pip install flask //  python app.py
    pip show flask // 包安装位置和依赖
    pip list -v // 所有包位置

    -- npm
    npm init
    npm install express // node server.js

    -- alternatively yarn
    yarn
    yarn dev
    yarn global add vite

poetry

https://poe.com/chat/27ii9vida0j41oirm1t

    poetry new: Creates a new Python project in a new directory with a basic project structure.
    poetry init: Initializes a new Poetry project in an existing directory. It interactively asks for project details like name, version, dependencies, etc., and creates the pyproject.toml file.
    poetry install: Installs the project dependencies specified in the pyproject.toml file.
    poetry add: Adds a new dependency to the project. For example, poetry add requests will add the requests library as a dependency and update the pyproject.toml file.
    poetry update: Updates the project dependencies to their latest compatible versions.
    poetry remove: Removes a dependency from the project. For example, poetry remove requests will remove the requests library from the project and update the pyproject.toml file.
    poetry run: Executes a command within the virtual environment created by Poetry. For example, poetry run python my_script.py will run the my_script.py file within the project's virtual environment.
    poetry shell: Activates the virtual environment created by Poetry, allowing you to work within the isolated environment.
    poetry build: Builds a distributable package of your project.
    poetry publish: Publishes your project package to a package repository, such as PyPI.

go

go list -m all ## 拉所有mod,报错后通过replace等解决问题mod
go install golang.org/x/tools/gopls@v0.12.0-pre.2

kite

kitool new -s -i ./idl/xx.thrift -pre code.xxx -trans Buffered -proto Binary -cmd thrift xx.xx.xx
./gen_common_code.sh im/xx/file.thrift im xx.xx.xx
genclient --idl ./idl/xx.thrift --pkg file_cli   --psm xx.xx.xx   --sub im   --base git.xx/kiteclient

JS

jquery

*: 选择所有元素。 
#id: 通过 ID 选择元素。  ID 选择器是唯一的,应该只选择一个元素。
.class: 通过类名选择元素。  一个元素可以有多个类名。
element: 通过元素名称选择元素 (例如,p 选择所有段落元素,div 选择所有 div 元素)。 

parent > child: 选择 parent 元素的所有直接子元素 child。 
ancestor descendant: 选择 ancestor 元素的所有后代元素 descendant,无论它们嵌套多少层。 
prev + next: 选择紧跟在 prev 元素后的 next 元素。 
prev ~ siblings: 选择 prev 元素之后的所有同级 siblings 元素。 

:first: 选择第一个元素。 
:last: 选择最后一个元素。 
:even: 选择索引为偶数的元素 (从 0 开始)。 
:odd: 选择索引为奇数的元素 (从 0 开始)。 
:eq(index): 选择索引为 index 的元素。 

$("#myElement").css({"width": "200px", "height": "100px"})
$("#myElement").removeAttr("width");
$(function() {setTimeout(function() {},1000)})

vue常用的语法,以及用什么脚手架,怎么构建项目

指令: 以 v- 开头的特殊属性,用于对 DOM 进行响应式更新。 常用指令包括:
v-bind (简写 :): 动态绑定属性,例如 :class、:style。
v-on (简写 @): 监听 DOM 事件,例如 @click、@keyup。
v-model: 双向数据绑定,常用于表单元素。
v-if: 根据条件渲染元素。
v-else-if、v-else: 与 v-if 配合使用,实现多条件渲染。
v-for: 循环渲染列表。
v-show: 根据条件显示或隐藏元素 (与 v-if 的区别在于 v-show 只是切换 display 属性,而 v-if 会销毁和创建元素)。
v-html: 渲染 HTML 内容 (注意安全性)。
---
组件: Vue 的核心是组件系统。 组件可以复用,提高代码可维护性。 一个组件通常包含:
template: 模板,定义组件的结构。
script: JavaScript 代码,定义组件的数据、方法、生命周期钩子等。
style: CSS 代码,定义组件的样式 (可以使用 scoped 属性限制样式作用域)。
---
数据绑定: Vue 提供了数据响应式机制,当数据发生变化时,视图会自动更新。
---
计算属性: 用于根据现有数据计算新的数据,提高代码可读性和性能。
---
侦听器: 用于监听数据的变化,并在数据变化时执行相应的操作。
---
脚手架:npm install -g @vue/cli 或 yarn global add @vue/cli
vue create my-project
npm run serve  # 或 yarn serve // 项目内直接运行
npm run build  # 或 yarn build // 优化,用于服务器部署

node / npm / nvm

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash // install nvm

-- .bashrc export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion --- nvm install nvm alias default npm install -g npm@latest --- # chrome

    # tab keys-combination: s-a-x-z
    opt+s: search tabs / history tabs
    opt+a: search bookmark tabs
    opt+x: list tab stack
    opt+z: list tab previews
    opt+d: better search history and tabs
    opt+e: better search all history

vscode组成架构

     pirattes -> 内置功能或插件s --> panel(子窗口)s --> 响应controllers/slots
     keymaps                   --> 浮窗s          -->|
     配置中心

goland+vscode

stage0. plat

    plat cmd/ctrl+shift+p(platte)
    terminal.runRecent: shift+opt+r

### stage1. navigator and editor

    navigate forward/back: ctrl/alt+s/x // 或者alt <- 和 alt ->
    open in finder: shift+cmd+e(explorer) 或 cmd+e
    open terminal here: alt/shift+cmd/ctrl+c(create command)
    open in terminal: ctrl/cmd/alt+c(create command)

### editor

    gotoline: ctrl/cmd+l(line)
    cut:
    move:
    format: opt+cmd+l (vscode: ctrl+shift+l)

### stage2. finder

    quick open files/finder: vscode ctrl+p 或 ctrl+e(explorer)
    find everything: goland shift+shift

stage3. symbol relation //opt

    show reference: cmd+leftclick
    show hierachy: opt+shift+h(hierachy)  shift+alt+h
    show imple: opt+shft+y(ymplement)
    find hierachy: opt+h
    find refer: opt+r(refer)
    find imple: opt+y



 

 

| Theme: Aeros 2.0 by TheBuckmaker.com