notes

notes

Keep It Simple, Stupid

gpg

1
2
gpg --keyserver keyserver.ubuntu.com --recv-keys [公钥ID]	//导入公钥
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys

vue.js

对于VUE的router[mode: history]模式(这里主要是为了去除链接上的"#")

ssh

端口转发

ssh -D 5555 root@ip -N
动态转发指的是,本机与 SSH 服务器之间创建了一个加密连接,然后本机内部针对某个端口的通信,都通过这个加密连接转发。它的一个使用场景就是,访问所有外部网站,都通过 SSH 转发。动态转发需要把本地端口绑定到 SSH 服务器。至于 SSH 服务器要去访问哪一个网站,完全是动态的,取决于原始通信,所以叫做动态转发。
ssh -D local-port tunnel-host -N
上面命令中,-D表示动态转发,local-port是本地端口,tunnel-host是 SSH 服务器,-N表示这个 SSH 连接只进行端口转发,不登录远程 Shell,不能执行远程命令,只能充当隧道。举例来说,如果本地端口是2121,那么动态转发的命令就是下面这样。
ssh -D 2121 tunnel-host -N
注意,这种转发采用了 SOCKS5 协议。访问外部网站时,需要把 HTTP 请求转成 SOCKS5 协议,才能把本地端口的请求转发出去。

linux

PS1

1
PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[36;40m\]\w\[\e[0m\]]\\$ "
1
PS1="\[\033[38;5;87m\]\u\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;119m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\][\[$(tput sgr0)\]\[\033[38;5;198m\]\t\[$(tput sgr0)\]\[\033[38;5;15m\]]{\[$(tput sgr0)\]\[\033[38;5;81m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]}"

安全删除文件

1
dd if=/dev/zero of=./output.txt bs=1024 count=1 #产生一个1k大小的文件output.txt

压测工具

1
2
3
git clone https://github.com/wg/wrk.git  
cd wrk
make

12线程,100连接开启30秒压测
wrk -t12 -c100 -d30s --latency http://www.baidu.com

rhit

nginx日志分析工具,使用rust语言编写
rhit /home/wwwroot/access_log/^Cog -f ip -l 100 -f 指定显示ip,ref,path等,-l指定详细程度

goaccess

nginx日志分析工具,可转html页面

  1. Terminal Output
    The following prompts a log configuration dialog with predefined log formats for you to choose from and then displays the stats in real-time.
    goaccess access.log -c
  2. Static HTML Output
    The following parses the access log and displays the stats in a static HTML report.
    goaccess access.log -o report.html --log-format=COMBINED
  3. Real-Time HTML Output
    The following parses the access log and displays the stats in a real-time HTML report.
    goaccess access.log -o /var/www/html/report.html --log-format=COMBINED --real-time-html

然后使用nginx监听本文件,即可提供实时nginx日志查看

ffmpeg

抽取音频命令

1
2
ffmpeg -i 3.mp4 -vn -y -acodec copy 3.aac
ffmpeg -i 3.mp4 -vn -y -acodec copy 3.m4a

音频转换

1
ffmpeg -i 3.m4a -acodec libmp3lame copy 3.mp3

提取视频(Extract Video)

1
ffmpeg -i Life.of.Pi.has.subtitles.mkv -vcodec copy –an  videoNoAudioSubtitle.mp4

通过m3u8下载视频

1
ffmpeg  -http_proxy http://127.0.0.1:3222 -i ".m3u8" "a.mp4"

视频转换,指定码率和分辨率

1
ffmpeg -i input.mp4 -b:v 20M -s 1920*1080 output.mp4

代理相关

git

设置代理

1
git config --global http.proxy socks5://127.0.0.1:2333

取消代理

1
git config --global --unset http.proxy

查看代理

1
git config --global --get http.proxy    

npm

npm config set proxy null
编辑配置文件
npm config edit
proxy=socks5://127.0.0.1:2333

docker

docker删除所有容器
docker container ls -a|awk -F " " '{print $1}'|xargs docker container rm -f
docker image build -t [image_name] .

作者

孤独小狼

发布于

2022-02-23

更新于

2022-03-12

许可协议

评论