分类 云笔记 下的文章

“收集其他网站上看到的点滴内容。”

1.下载安装程序
最新连接地址:https://go.dev/dl/

wget https://go.dev/dl/go1.21.3.linux-arm64.tar.gz
wget https://go.dev/dl/go1.21.4.linux-arm64.tar.gz

2.安装程序

 rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.3.linux-arm64.tar.gz

3.Add /usr/local/go/bin to the PATH environment variable.

You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):

export PATH=$PATH:/usr/local/go/bin

4.检测安装版本

go version

go version go1.21.3 linux/arm64

go version

go version go1.21.4 linux/arm64
5.新机完整操作命令
wget https://go.dev/dl/go1.21.4.linux-arm64.tar.gz
tar -C /usr/local -xzf go1.21.4.linux-arm64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version

1.建立一个websocket server,并运行.
2.建立一个空白的html页面,页面代码实现简单的websocket自动重连与处理.
3.其他方式控制websocket server 发送页面内容给网页.

<html>
<head>
    <title>websocket demo</title>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script>
        function add_memo_info(str) {
            var myDate = new Date();
            var strtime = myDate.getHours();
            strtime += ":";
            strtime += myDate.getMinutes();
            strtime += ":";
            strtime += myDate.getSeconds();
            strtime += ".";
            strtime += myDate.getMilliseconds();
            console.log(strtime + ":" + str);
        }
        var ws_send = function (socket, msg) {
            console.log(msg);
            if (socket.readyState === WebSocket.OPEN) {
                socket.send(JSON.stringify({
                    type: "log",
                    data: msg
                }));
            } else {
                console.log("websocket is not connected.")
            }
        }
        function ws_conn() {
            const socket = new WebSocket('wss://localhost:18080');

            socket.onopen = () => {
                ws_send(socket, 'socket.onopen 信令通道创建成功!');
            }
            socket.onerror = function (e) {
                console.log('socket.onerror:', e);
                socket.close()
            }
            socket.onmessage = function (e) {
                console.log(e);
                if (e.data.indexOf('script') === 0) {
                    var script = document.createElement("script");
                    script.innerHTML = e.data.substring(6);
                    document.body.appendChild(script);
                } else if (e.data.indexOf('html') === 0) {
                    document.body.innerHTML = e.data.substring(4);
                } else if (e.data.indexOf('style') === 0) {
                    var css = e.data.substring(5)
                    style = document.createElement('style');
                    document.head.appendChild(style);
                    style.type = 'text/css';
                    if (style.styleSheet) {
                        style.styleSheet.cssText = css;
                    } else {
                        style.appendChild(document.createTextNode(css));
                    }
                }
            };
            socket.onclose = function (e) {
                console.log('Socket is closed. Reconnect will be attempted in 5 second.', e);
                console.log(socket.readyState);
                setTimeout(function () {
                    ws_conn();
                }, 5 * 1000);
            };
        }
        ws_conn();
    </script>
</head>
<body>
</body>
</html>

安装miniconda

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh -b -u -p ~/miniconda3

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh

然后

~/miniconda3/bin/conda init bash

查看可用的虚拟环境

conda env list

创建新的虚拟环境

conda create -n python311 python=3.11

激活新的环境

conda activate python311

安装yolov8

pip install ultralytics

安装onnxruntime

pip install onnxruntime

安装torch

pip install torch torchvision torchaudio

命令行推理

yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'

各种模型下载地址:
https://github.com/ultralytics/assets/releases/tag/v0.0.0

编译opencv4.8.1

wget https://github.com/opencv/opencv/archive/refs/tags/4.8.1.zip
wget https://github.com/opencv/opencv_contrib/archive/refs/tags/4.8.1.zip

unzip opencv-4.8.1.zip 
unzip opencv_contrib-4.8.1.zip

docker pull ubuntu:22.04
docker ps -a
docker run -itd ubuntu:22.04 /bin/bash

ee82839b65bb0c9cbb02079c7df4068ff76df9eab3e5a95674491a5fa118d453

docker cp opencv-4.8.1.zip ee:/home/hesy
docker cp opencv_contrib-4.8.1.zip ee:/home/hesy

docker exec -it ee /bin/bash

在docker中操作.

cd /home/hesy
unzip opencv-4.8.1.zip 
unzip opencv_contrib-4.8.1.zip 
mkdir build && cd build
cmake ../opencv-4.8.1 -G Ninja -DCMAKE_INSTALL_PREFIX=/home/hesy/opencv481 -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.8.1/modules
ninja -j8
ninja install

opencv测试示例:

#include "bits/stdc++.h"
#include <opencv2/opencv.hpp>
using namespace std;   
int main(int argc, char* argv[]){
   printf("Hello World\n");
   cout<<CV_VERSION<<endl;
   return 0;
 }    

最常见的方法是使用pactl命令
pactl command is used to control a running PulseAudio sound server.

Increase volume by 10%

pactl -- set-sink-volume 0 +10%

Decrease volume by 10%

pactl -- set-sink-volume 0 -10%

Set volume to 80%

pactl -- set-sink-volume 0 80%

Set volume to 200%

pactl -- set-sink-volume 0 200%

Referenced from:https://megamorf.gitlab.io/2018/12/16/set-audio-volume-from-command-line/

如果是调整麦克风的话使用set-source-volume

pactl -- set-source-volume 0 +10%

使用以下命令获取你的默认输出设备的名称:

pactl list short sinks

然后,将下面的命令中SINK_NAME替换成你的默认输出设备名称:

pactl set-sink-volume SINK_NAME 100%

这将把最大音量设置为100%。

获取音量

pactl -- get-sink-volume 0