kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

ffmpeg分离MP3文件报错

https://blog.csdn.net/weixin_44736603/article/details/121537824

使用ffmpeg视频中分离出MP3文件报错

Automatic encoder selection failed for output stream #0:0. Default encoder for format mp3 (codec mp3) is probably disabled. Please choose an encoder manually. Error selecting an encoder for stream 0:0

问题原因在于只有mp3的解码库,没有mp3编码库导致的,需要添加libmp3lame第三方库。

添加libmp3lame库方式

下载压缩包 https://sourceforge.net/projects/lame/files/lame/

解压 ,进入lame-3.100目录下,在终端打开

依次执行

1
2
3
./configure --enable-shared
make
make install

安装ffmpeg时, –enable-libmp3lame引入libmp3lame

1
2
3
./configure --enable-shared --enable-libmp3lame
make
# make install

安装完毕之后

1
2
3
4
5
6
7
vim /etc/ld.so.conf

添加
/usr/local/lib/

再执行
ldconfig

`_` 通配符 -- 匹配一个字符

https://learn.microsoft.com/zh-cn/sql/t-sql/language-elements/wildcard-match-one-character-transact-sql?view=sql-server-ver16&redirectedfrom=MSDN

下划线字符 _ 用于匹配涉及模式匹配的字符串比较操作(如 LIKE 和 PATINDEX)中的任何单个字符。

简单示例

以下示例返回以字母 m 开头且第三个字母为 d 的所有数据库名称。 下划线字符指定名称的第二个字符可以是任何字母。 model 数据库和 msdb 数据库均符合此条件。 master 数据库则不符合。

1
2
SELECT name FROM sys.databases
	WHERE name LIKE 'm_d%';
1
2
3
4
name
-----
model
msdb

钉钉开放平台API

https://open.dingtalk.com/document/orgapp/chatbots-send-one-on-one-chat-messages-in-batches

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
public $corpId = 'XXX';
public $AppID = 'XXX';
public $AgentId = 'XXX';
public $ClientID = 'XXX';
public $ClientSecret = 'XXX';


function index($startpage = 0)
{
	echo "111<br>";
	echo "<div id='cc'>333</div>";
	echo "<div id='dd'>333</div>";
	echo '<script src="https://g.alicdn.com/dingding/dingtalk-jsapi/3.0.25/dingtalk.open.js"></script>';
	echo "<script> dd.getAuthCode({ corpId: 'XXX',  success: (res) => { document.getElementById('cc').innerHTML = res.code; }, }); document.getElementById('dd').innerHTML = 'ff'; </script>";
	// echo "<script> dd.replacePage({ url: 'http://www.baidu.com' }); /* dd.closePage(); */ </script>";

	// 根据 code access_token 获取免密用户信息
	// curl -X POST -d "code=XXX" "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=XXX"

	echo "222<br>";
}

function auth($startpage = 0)
{
	echo "555<br>";
	echo "<div id='cc'>444</div>";
	echo "<div id='dd'>444</div>";
	echo '<script src="https://g.alicdn.com/dingding/dingtalk-jsapi/3.0.25/dingtalk.open.js"></script>';
	//echo "<script> dd.getAuthCode({ corpId: 'XXX',  success: (res) => { document.getElementById('cc').innerHTML = res.code; }, }); document.getElementById('dd').innerHTML = 'ff'; </script>";
	// echo "<script> dd.replacePage({ url: 'http://www.baidu.com' }); /* dd.closePage(); */ </script>";
	echo "<script> dd.getAuthCode({ corpId: 'XXX',  success: (res) => { dd.openLink({url: 'https://www.baidu.com' }); dd.closePage(); }, }); document.getElementById('dd').innerHTML = 'ff'; </script>";

	// 根据 code access_token 获取免密用户信息
	// curl -X POST -d "code=XXX" "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=XXX"

	echo "666<br>";
}

function auth2($startpage = 0)
{
	echo "555<br>";
	echo "<div id='cc'>444</div>";
	echo "<div id='dd'>444</div>";
	echo '<script src="https://g.alicdn.com/dingding/dingtalk-jsapi/3.0.25/dingtalk.open.js"></script>';

	$url = "http://n.com/rs/ding/auth2";
	$nonceStr = 'kk';
	$agentId = $this->AgentId;
	$timeStamp = time() * 1000;
	$corpId = $this->corpId;

	$jsticket = 'XXX';

	$plain = "jsapi_ticket=" . $jsticket . "&noncestr=" . $nonceStr . "×tamp=" . $timeStamp . "&url=" . $url;
	echo $plain;

	// TODO
	$sign = sha1($plain);
	var_dump($sign);


	//echo "<script> dd.getAuthCode({ corpId: 'XXX',  success: (res) => { document.getElementById('cc').innerHTML = res.code; }, }); document.getElementById('dd').innerHTML = 'ff'; </script>";
	// echo "<script> dd.replacePage({ url: 'http://www.baidu.com' }); /* dd.closePage(); */ </script>";
	echo "<script> dd.getAuthCode({ corpId: 'XXX',  success: (res) => { dd.openLink({url: 'https://www.baidu.com' }); dd.closePage(); }, }); document.getElementById('dd').innerHTML = 'ff'; </script>";

	// 根据 code access_token 获取免密用户信息
	// curl -X POST -d "code=XXX" "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=XXX"

	echo "666<br>";
}



function gettoken()
{
	return 'XXX';

	$cget = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_GET , DingTalkConstant::$FORMAT_JSON);
	$req = new OapiGettokenRequest();
	$req->setAppkey($this->ClientID);
	$req->setAppsecret($this->ClientSecret);
	$resp = $cget->execute($req, '', "https://oapi.dingtalk.com/gettoken");
	var_dump($resp->access_token);
	var_dump($resp);
}

// 获取jsapiTicket
function jsapiTicket()
{
	$accessToken = $this->gettoken();

	$url = "https://api.dingtalk.com/v1.0/oauth2/jsapiTickets";

	$header = array('Content-Type: application/json', "x-acs-dingtalk-access-token: {$accessToken}");

	$fields = array(
			'1' => '1'
		);
	$postfields = json_encode($fields);
	//var_dump($postfields);
	$res = $this->Wxapi_model->queryUrl($url, $header, $postfields);
	$res = json_decode($res, true);
	var_dump($res);
}


// 获取免密用户信息
function getuserinfo()
{
	$code = $this->input->get('code');

	$accessToken = $this->gettoken();

	$url = "https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token={$accessToken}";

	$header = array('Content-Type: application/json');
	$fields = array('code' => $code);
	$postfields = json_encode($fields);
	$res = $this->Wxapi_model->queryUrl($url, $header, $postfields);
	$res = json_decode($res, true);
	if (isset($res['errcode']) and $res['errcode'] == 0) {
		echo $res['errmsg'], "<br><br>";
		var_dump($res['result']['userid']);
		echo "<br><br>";
		var_dump($res['result']);
		echo "<br><br>";
	}
	var_dump($res);
}


/*
// 批量发送人与机器人会话中机器人消息 样例
curl -X POST -H "x-acs-dingtalk-access-token:"XXX" -H "Content-Type:application/json" -d '{"robotCode":"XXX","userIds":["XXX"],"msgKey":"sampleMarkdown","msgParam":"{\"text\": \"hello text\",\"title\": \"hello title\"}"}' "https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend"

// 批量发送人与机器人会话中机器人消息
curl -X POST -H "x-acs-dingtalk-access-token:"XXX" -H "Content-Type:application/json" -d '{"robotCode":"XXX","userIds":["XXX"],"msgKey":"sampleLink","msgParam":"{\"text\": \"hello text\",\"title\": \"hello title\",\"picUrl\":\"https://n.com/.png\",\"messageUrl\":\"dingtalk://dingtalkclient/action/openapp?XXX\"}"}' "https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend"
*/

// 批量发送人与机器人会话中机器人消息 样例
function batchSend_test()
{
	$accessToken = $this->gettoken();

	$url = "https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend";

	$header = array('Content-Type: application/json', "x-acs-dingtalk-access-token: {$accessToken}");

	$fields = array("robotCode" => "XXX",
			"userIds" => ["XXX"],
			"msgKey" => "sampleMarkdown",
			"msgParam" => json_encode(["text" => "hello text", "title" => "hello title"])
		);
	$postfields = json_encode($fields);
	//var_dump($postfields);
	$res = $this->Wxapi_model->queryUrl($url, $header, $postfields);
	$res = json_decode($res, true);
	var_dump($res);
}

// 批量发送人与机器人会话中机器人消息
function batchSend()
{
	$accessToken = $this->gettoken();

	$url = "https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend";

	$header = array('Content-Type: application/json', "x-acs-dingtalk-access-token: {$accessToken}");

	$fields = array("robotCode" => "XXX",
			"userIds" => ["XXX"],
			"msgKey" => "sampleLink",
			"msgParam" => json_encode(["text" => "hello text", "title" => "hello title",
						"picUrl" => "https://n.com/gztp4.png",
						"messageUrl" => "dingtalk://dingtalkclient/action/openapp?XXX"])
		);
	$postfields = json_encode($fields);
	//var_dump($postfields);
	$res = $this->Wxapi_model->queryUrl($url, $header, $postfields);
	$res = json_decode($res, true);
	var_dump($res);
}



// 发送工作通知
function MessageCorpconversationAsyncsendV2()
{
	$accessToken = $this->gettoken();

	$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);

	$req = new OapiMessageCorpconversationAsyncsendV2Request();
	$req->setAgentId($this->AgentId);
	$req->setUseridList('XXX');
	$req->setToAllUser(false);

	/*
	$msg = array(
		"msgtype" => "text",
		"text" => ["content"=>"12333"],
		);
	*/
	/*
	$msg = array(
		"msgtype" => "link",
		"link" => [
			"picUrl" => "https://n.com/gztp4.png",
			"messageUrl" => "https://n.com",
			"text" => "text",
			"title" => "title"
			]
		);
	*/
	$msg = array(
		"msgtype" => "link",
		"link" => [
			"picUrl" => "https://n.com/gztp4.png",
			"messageUrl" => "dingtalk://dingtalkclient/action/openapp?XXX",
			"text" => "text",
			"title" => "title"
			]
		);
	$req->setMsg($msg);

	$resp = $c->execute($req, $accessToken, "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
	var_dump($resp);
}


// 获取部门列表
function DepartmentListsub($depid = 1)
{
	$accessToken = $this->gettoken();

	$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
	$req = new OapiV2DepartmentListsubRequest();
	$req->setDeptId($depid);
	$req->setLanguage("zh_CN");
	$resp = $c->execute($req, $accessToken, "https://oapi.dingtalk.com/topapi/v2/department/listsub");
	var_dump($resp);
}