This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
ssh server "sudo su -c \"cd /var/www/sites/folder && git pull && npm install && npm run build\" serveruser" | |
ssh server "sudo supervisorctl restart servercmd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk -F\" '{print $2}' access.log | awk '{print $2}' | awk -F\? '{print $1}' | sort -n | uniq -c | sort -rn | head -n 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package http | |
package http | |
import ( | |
"github.com/gin-gonic/gin" | |
"net/http" | |
) | |
type Context struct { | |
*gin.Context | |
} | |
// Ok implement your context method like below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextEncoder: | |
var encoder = new TextEncoder() | |
encoder.encode("中文abc🍎"); | |
//result : Uint8Array(9) [228, 184, 173, 230, 150, 135, 97, 98, 99, 240, 159, 141, 142] | |
//兼容写法1: | |
unescape(encodeURIComponent("中文abc🍎")).split("").map(val => val.charCodeAt()); | |
//result : (9) [228, 184, 173, 230, 150, 135, 97, 98, 99, 240, 159, 141, 142] | |
//兼容写法2: | |
encodeURIComponent("中文abc🍎").split("").map(val => val.charCodeAt()); | |
//result : (33) [37, 69, 52, 37, 66, 56, 37, 65, 68, 37, 69, 54, 37, 57, 54, 37, 56, 55, 97, 98, 99, 37, 70, 48, 37, 57, 70, 37, 56, 68, 37, 56, 69] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -hwaccel auto -i ../test02.MOV -vf "scale=iw/2:ih/2,fps=1" -c:v mjpeg -f image2pipe | processProgram | |
# 或者 | |
ffmpeg -hwaccel auto -i ../test02.MOV -vf "scale=iw/2:ih/2,fps=1" -c:v mjpeg -f image2pipe - | processProgram | |
# rtmp or rtsp server | |
ffmpeg -hwaccel auto -i rtsp://localhost:8554/mytv/test02 -vf "scale=iw/2:ih/2,fps=1" -f image2 out%03d.jpg | |
ffmpeg -i rtsp://localhost:8554/mytv/test02 -vf fps=1 -f image2 out%03d.jpg | |
ffmpeg -i rtsp://localhost:8554/mytv/test02 -vf fps=1 -q:v 6 -f image2 out%03d.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create rtmp stream from video | |
ffmpeg -stream_loop -1 -i test02.mp4 -c:a copy -c:v libx264 -f flv rtmp://www.example.com/mytv/test02 | |
ffmpeg -stream_loop -1 -i test02.mp4 -f flv rtmp://www.example.com/mytv/test02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install nvidia-driver | |
apt install linux-headers-$(uname -r) | |
wget https://cn.download.nvidia.com/tesla/470.199.02/NVIDIA-Linux-x86_64-470.199.02.run | |
sh NVIDIA-Linux-x86_64-470.199.02.run | |
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | |
&& curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ | |
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 背景: | |
> 有一台A服务器不能上网,和B服务器通过内网来连接,B服务器可以上网,要实现A服务器也可以上网。 | |
内网主机: A eth1:172.16.1.8 | |
外网主机: B eth0:10.0.0.6 外网主机: B eth1:172.16.1.6 | |
SNAT:改变数据包的源地址。防火墙会使用外部地址,替换数据包的本地网络地址。这样使网络内部主机能够与网络外部通信。 | |
## 在可以上网那台服务器B上,开启内核路由转发功能 | |
### 临时 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
kind: pipeline | |
type: docker | |
name: default | |
clone: | |
disable: true | |
steps: | |
- name: clone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v 169.254|grep -v 0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" | head -n 1 |
NewerOlder