This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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 hidden or 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
redis-cli -h host -a password --scan --pattern 'Name\\Path\\Value\\Patte*rn' | sed 's/\\/\\\\/g' | xargs redis-cli -h host -a password del |
NewerOlder