Linux 音频录制 Pulse Alsa

查看设备信息

如果使用Alsa设备

arecord -l

如果需要用到 Pulse 的源

pactl list sources

Arecord 录制

arecord -f S32_LE -r 48000 -c 2 -t wav test.wav

S32_LE 指的是小端存储,32有符号(Signed)整型 此外常用的还有S16_LE, S24_LE(24位总是外界播放不了),FLOAT_LE(32位浮点)

FFmpeg 压缩录制

ffmpeg -f pulse -i alsa_input.usb-Topping_E2x2-00.multichannel-input -c:a aac -b:a 192k output.m4a

修改alsa_input后的名字,来自pactl list sources的源名字

若要录制mp3

ffmpeg -f pulse -i alsa_input.usb-Topping_E2x2-00.multichannel-input -c:a libmp3lame -b:a 320k output.mp3

Docker 镜像备份

容器转换为镜像

docker commit [Container_id] [Name:v1.0(tag)] 

提取镜像到文件

docker export [Name:v1.0] [Name2:v1.0] > backup.tar

导入镜像

docker import backup.tar

Docker 安装部署

安装

根据官网设置https://docs.docker.com/engine/install/ubuntu/ 顺序安装

Docker-compose

二进制安装可行,python安装不稳定

wget https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-linux-x86_64

复制到Path路径内

sudo cp -arf docker-compose-linux-x86_64 /usr/bin/docker-compose

赋予可执行权限

sudo chmod +x /usr/bin/docker-compose

普通用户组权限

需要普通用户直接使用 Docker,则可更改权限组

sudo usermod -aG docker [your_name]

通常重启刷新权限组

网络流量查看 Linux iftop

指令

提前 apt 安装即可 eth0 是网卡型号 表示统计 30s 之内的单次输出流量

sudo iftop -i eth0 -t -s 30 -L 100

help

iftop: display bandwidth usage on an interface by host

Synopsis: iftop -h [-npblNBP] [-i interface] [-f filter code]
[-F net/mask] [-G net6/mask6]

-h display this message
-n don't do hostname lookups
-N don't convert port numbers to services
-p run in promiscuous mode (show traffic between other
hosts on the same network segment)
-b don't display a bar graph of traffic
-B Display bandwidth in bytes
-i interface listen on named interface
-f filter code use filter code to select packets to count
(default: none, but only IP packets are counted)
-F net/mask show traffic flows in/out of IPv4 network
-G net6/mask6 show traffic flows in/out of IPv6 network
-l display and count link-local IPv6 traffic (default: off)
-P show ports as well as hosts
-m limit sets the upper limit for the bandwidth scale
-c config file specifies an alternative configuration file
-t use text interface without ncurses

Sorting orders:
-o 2s Sort by first column (2s traffic average)
-o 10s Sort by second column (10s traffic average) [default]
-o 40s Sort by third column (40s traffic average)
-o source Sort by source address
-o destination Sort by destination address

The following options are only available in combination with -t
-s num print one single text output afer num seconds, then quit
-L num number of lines to print

iftop, version 1.0pre4
copyright (c) 2002 Paul Warren <pdw@ex-parrot.com> and contributors

硬盘管理 HDD Linux

查看Smart

安装相关工具

sudo apt install smartmontools

运行

sudo smartctl -a /dev/sda

可查看设备 sda 的SMART参数

查看硬盘和分区情况

sudo fdisk -l

简单查看硬盘使用和挂载情况

df -h

BT Transmission 种子创建

transmission-create

transmission-create -p -o "/downloads/make_torrents/Spotlight Piano.torrent" -t https://tracker.*****.*****/announce.php -s 2048 "/downloads/complete/Spotlight Piano - from Fracture Sounds"

备份手机资料小记

文件系统下寻找备份

腾讯Tencent文件位置

\Android\data\com.tencent.mobileqq\Tencent\QQfile_recv\Android\data\com.tencent.mm 是微信和QQ下载的文件位置

\Tencent 需要检查QQ下载的图片

\Picture\MicroMsg 是微信的图片位置

图片文件

\DCIM 大多数相机的储存位置

曲目 和 录音

\Music\Sounds 分别找到

Nginx Apache2 反向代理 SSL

Apache2

<VirtualHost *:443>
DocumentRoot /var/www/html
ServerName pan.voidspace.cn
SSLEngine on
SSLCertificateFile "/root/.acme.sh/voidspace.cn_ecc/*****.cer"
SSLCertificateKeyFile "/root/.acme.sh/*****.key"
ErrorLog /var/www/logs/443panerror.log
CustomLog /var/www/logs/443panaccess.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
SSLProxyEngine On
ProxyPreserveHost On
SSLProxyVerify none
# 不验证后端服务器的证书
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
AllowEncodedSlashes NoDecode
ProxyPass "/" "https://127.0.0.1:5212/" nocanon

</VirtualHost>

Nginx

server{
listen 443 ssl;
listen [::]:443 ssl;
listen 777 ssl;
listen [::]:777 ssl;
#对应你的域名
server_name tasks.voidspace.cn;
gzip on;
gzip_comp_level 4;
gzip_types application/javascript text/css application/json;
gzip_vary on;
gzip_static on;
ssl_certificate /home/orangepi/.acme.sh/*****.cer;
ssl_certificate_key /home/orangepi/.acme.sh/*****.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
#如果是静态文件,直接指向目录,如果是动态应用,用proxy_pass转发一下
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_pass http://localhost:58088;
}
}

Linux Deploy 提权

提权指令

在安卓设备上,为apache2的www-data用户提升到系统管理网络的用户权限上,使得可以进行反代和访问网络

usermod -a -G aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin,aid_net_bw_stats,aid_net_bw_acct,aid_readproc www-data

查看目录占用空间 Vizex

安装

要求python > 3.7

pip install vizex

查看文件目录下情况

vizexdf -ads size

查看系统储存设备占用

vizex --details
0%