Open polym opened 5 years ago
直接对直播流执行 ffprobe 会出现码率 N/A 的情况
ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1
ffprobe -v quiet -print_format json -show_format -show_streams
https://cloud.tencent.com/developer/article/1350892 https://www.elvinefendi.com/2018/11/25/canary-deployment-with-ingress-nginx.html
**
!path/to/dir/**
!path/to/file
# Remove the ‘ – update_hostname’ line in /etc/cloud/cloud.cfg
# use hostnamectl
hostnamectl set-hostname LOG --static
alter table applications modify column app_name varchar(64);
describe applications;
https://blog.dragonsector.pl/2019/02/cve-2019-5736-escape-from-docker-and.html
https://github.com/polym/cve-2019-5736-poc
__attribute__ ((constructor))
修饰函数package main
import (
"github.com/gin-contrib/pprof"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
pprof.Register(router)
router.Run(":8080")
}
go tool pprof -http="0.0.0.0:18081" -seconds 300 ./app http://10.0.5.199:10801/debug/pprof/profile
执行上面命令行可能出现 Couldn't find a suitable web browser! Set the BROWSER environment variable to your desired browser.
忽略即可。
INSERT INTO table (field1, field2) SELECT field1, anyChar AS field2 FROM table2
git stash show -p > x.diff
可以输出当前 stash 中的修改,在无法解决新提交跟 stash 冲突时很有用创建 topic 时,设置清理策略,保证磁盘空间充足。
kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 64 --topic app-logs --config cleanup.policy=delete --config retention.ms=3600000
package utils
import (
"runtime"
"time"
)
// Trace function and output function execute time
type TraceTimer struct {
startTime time.Time
funcName string
log func(format string, v ...interface{})
}
func (tt *TraceTimer) Start() {
pc := make([]uintptr, 10) // at least 1 entry needed
runtime.Callers(2, pc)
tt.funcName = runtime.FuncForPC(pc[0]).Name()
tt.startTime = time.Now()
}
func (tt *TraceTimer) Stop() {
tt.log("[TraceTimer] %s: %s elapsed", tt.funcName, time.Now().Sub(tt.startTime))
}
func NewTraceTimer(l func(format string, v ...interface{})) *TraceTimer {
return &TraceTimer{log: l}
}
lscpu | grep End
kill -HUP $(cat /run/docker.pid)
in:file
filename:swagger.yaml
go clean -cache
go build -i
gocode -f=json --in=api/api.go autocomplete 5204
其中 5204
是当前 Go 文件的第几个字符:'<,'>s/.//gn
for item in ${arrary[@]}; do echo $item; done
ps axu | grep containerd | grep -E "\-\-config|\-\-shim"
find . -type f | xargs -I {} mv {} {}.bak
git push origin --delete your_branch
map <Leader>sb :set scrollbind<CR>
map <Leader>nsb :set noscrollbind<CR>
ffbuild/config.log
pkg-config --libs --static zlib
framefilter.cpp:(.text+0x21cb): undefined reference to
pthread_cond_destroy'` 的错误。SET names utf8
常用命令
npm install -g gitbook-cli
gitbook init
,目录中会新增 README.md 跟 SUMMARY.mdgitbook install
gitbook --port 400 serve
,注意 只能监听 localhost,不支持全绑定gitbook mobi . book.mobi
gitbook epub . book.epub
FROM fellah/gitbook:3.2.1
RUN apt update && apt install -y calibre
VOLUME /src/gitbook
WORKDIR /src/gitbook
CMD ["bash", "-c", "gitbook install && gitbook mobi . ./output.mobi"]
docker run -it -v $(pwd):/src/gitbook gitbook-cli
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
export LESSCHARSET=utf-8
sudo -u git -H /opt/gitlab/embedded/service/gitlab-shell/bin/create-hooks /var/opt/gitlab/git-data/repositories/
sed -i 's/KUBELET_ARGS="[^"]*/& --allowed-unsafe-sysctls=net.*/g' kubelet
wrk 上传文件压测
wrk -t 1m -c 10 -s put.lua http://127.0.0.1:80
function read_txt_file(path)
local file, errorMessage = io.open(path, "r")
if not file then
error("Could not read the file:" .. errorMessage .. "\n")
end
local content = file:read "*all"
file:close()
return content
end
wrk.method = "PUT" wrk.body = read_txt_file("data")
- tcpdump 抓取 HTTP GET 请求 报文 `tcpdump -s 0 -A 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'`
- 读取目录下所有文件内容并显示文件名 `grep "" *`
--service-node-port-range
默认是 30000-32767
net.ipv4.ip_local_port_range = 35000 65000
docker inspect -f {{.State.Pid}} 44fc0f0582d9
nsenter --target 3326 --mount --uts --ipc --net --pid
- lineinfile: dest=/etc/selinux/config regexp=^SELINUX= line=SELINUX=enforcing 行替换
- name: do sth
shell: |
echo "xxx" | \
awk '{print $1}'
ip tunnel list
,删除隧道 ip tunnel delete tun-xxxxx
#!/bin/bash
#===================================================================================
#
# FILE: dump.sh
# USAGE: dump.sh [-i interface] [tcpdump-parameters]
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data.
# OPTIONS: same as tcpdump
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching
# BUGS: ---
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started.
# - In 1.1 VLAN's would not be shown if a single interface was dumped.
# NOTES: ---
# - 1.2 git initial
# AUTHOR: Sebastian Haas
# COMPANY: pharma mall
# VERSION: 1.2
# CREATED: 16.09.2014
# REVISION: 22.09.2014
#
#===================================================================================
# When this exits, exit all background processes:
trap 'kill $(jobs -p) &> /dev/null && sleep 0.2 && echo ' EXIT
# Create one tcpdump output per interface and add an identifier to the beginning of each line:
if [[ $@ =~ -i[[:space:]]?[^[:space:]]+ ]]; then
tcpdump -l $@ | sed 's/^/[Interface:'"${BASH_REMATCH[0]:2}"'] /' &
else
for interface in $(ifconfig | grep '^[a-z0-9]' | awk '{print $1}')
do
tcpdump -l -i $interface -nn $@ | sed 's/^/[Interface:'"$interface"'] /' &
done
fi
# wait .. until CTRL+C
wait
ip route list table xxx
来查看策略路由ip rule list
,获取路由表策略路由 ip route list table xxx
cat << EOF > /tmp/data
a
b
c
EOF
CID=$1
CON_PID=$(docker inspect '--format={{ .State.Pid }}' $CID)
CON_NET_SANDBOX=$(docker inspect '--format={{ .NetworkSettings.SandboxKey }}' $CID)
rm -f /var/run/netns/$CON_PID
mkdir -p /var/run/netns
ln -s $CON_NET_SANDBOX /var/run/netns/$CON_PID
VETH_ID=$(ip netns exec $CON_PID ip link show eth0|head -n 1|awk -F'@|:' '{print $3}'|cut -c3-)
VETH_NAME=$(ip link|grep "^${VETH_ID}:"|awk '{print $2}'|awk -F@ '{print $1}')
echo $VETH_NAME
rm -f /var/run/netns/$CON_PID
ansible -i inventory_file.txt some_host -m setup
mkdir not found
的问题
environment:
PATH:$PATH:/opt/node/bin
kill -s SIGUSR1 $pid
,重新创建 socket 通信Gin API 测试通用方法
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"reflect"
"testing"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
type context struct { r gin.Engine t testing.T }
func marshal(v interface{}) io.Reader { b, _ := json.Marshal(v) return bytes.NewReader(b) }
func unmarshal(resp *http.Response, v interface{}) error { data, _ := ioutil.ReadAll(resp.Body) resp.Body.Close() return json.Unmarshal(data, v) }
func runSimpleAPITest(ctx *context, method, uri string, code int, req, expect interface{}) { request, _ := http.NewRequest(method, uri, marshal(req)) resp := reflect.New(reflect.TypeOf(expect)).Interface()
w := httptest.NewRecorder()
ctx.r.ServeHTTP(w, request)
assert.Equal(ctx.t, w.Code, code)
err := unmarshal(w.Result(), resp)
assert.Nil(ctx.t, err)
assert.Equal(ctx.t, resp, expect)
}
## VIM
- [水平分割窗口切换成垂直分割](https://stackoverflow.com/questions/1269603/to-switch-from-vertical-split-to-horizontal-split-fast-in-vim)
![image](https://user-images.githubusercontent.com/2860926/56872940-059c1d80-6a61-11e9-817d-78f8937503a4.png)
-threads
,指定线程个数,以及 max_muxing_queue_size
编解码队列大小。目前在 x264 编码中,一个线程会对应 1.5 core cpuffprobe -show_packets
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
go test ./...
不同的包会并发跑测试,使用 go test ./... -p 1
解决[ 23.895783] PKCS#7 signature not signed with a trusted key
, 需要在 bios 关闭 secure bootapt-get install pngtools
systemctl daemon-reload
,centos7.5 也有该问题,需要再深入研究原因tmux -S /tmp/tmux-532/default at
make WHAT=cmd/kubelet
systemctl disable rpcbind avahi-daemon
iconv -f UTF-8-MAC -t latin1
vagrant ssh-config
,Authentication failure. Retrying...
删除 IdentityFile 文件,再次 vagrant up
汇总