Categories
cmd

修改香橙派蓝牙设备名字

蓝牙设备默认时设备名字 通过nmtui 设置设备网络名字即可

并且nmtui可以设置要连接的设备wifi

也可以通过设置 bluetoothctl的system-alias (无效)

Categories
bluetooth

香橙派 ble蓝牙设置

执行蓝牙命令前先确保蓝牙服务开启

执行蓝牙命令进入蓝牙控制台

bluetoothctl

列出蓝牙适配器

list

显示某一个蓝牙设备状态

show

修改设备名字(无效)

system-alias ${name}

蓝牙设备上电

power on

开启蓝牙可发现

discoverable on

设置蓝牙可发现超时时间(0为永不超时)

discoverable-timeout 0

设置蓝牙可匹配

pairable on

设置开启蓝牙广告advertise

advertise on

至此设备ble蓝牙已开启

Categories
python

香橙派ble蓝牙 python

安装依赖包

sudo apt-get update
sudo apt-get install bluetooth bluez libbluetooth-dev libusb-dev libdbus-1-dev

确保蓝牙开启

sudo systemctl enable bluetooth
sudo systemctl start bluetooth

bluetoothctl 是一个点对点蓝牙控制工具

gatttool 是一个ble蓝牙控制工具

sudo apt-get install bluez-tools
gatttool -b <设备地址> --interactive

python 代码:

sudo apt-get install python3-pip
pip3 install bluepy
from bluepy.btle import Scanner, DefaultDelegate
import time

class ScanDelegate(DefaultDelegate):
    def handleDiscovery(self, dev, isNewDev, isNewData):
        if isNewDev:
            print("Discovered device")
            print("  Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi))
        elif isNewData:
            print("  Updated data: %s" % dev.scanData)
            print("  Manufacturer data: %s" % dev.manufacturerData)        # Optional: manufacturer data if available. 0x0000FFFF is the default for BLE devices. 0xFFFF is the default for Beacons. 0x004C is the default for iBeacons. 0x0215 is the default for AltBeacons. 0x0242 is the default for Estimote beacons. 0x0015 is the default for Eddystone beacons. 0x02AA is the default for Apple beacons. 0x0118 is the default for Samsung beacons. 0x02AA is the default for Apple beacons. 0x0118 is the default for Samsung beacons. 0x02AA is the default for Apple beacons. 0x0118 is the default for Samsung beacons. 0x02AA is the default for Apple beacons. 0x0118 is the default for Samsung beacons. 0x02AA is the default for Apple beacons. 0x0118 is the default for Samsung beacons. 0x02AA is the default for Apple beacons. 0x0118 is the default for Samsung

相关链接

https://blog.csdn.net/weixin_30598047/article/details/156319564

Categories
cmd

香橙派设置wifi热点

  • hostapd:用于创建 WiFi 热点
  • dnsmasq:提供 DNS 和 DHCP 服务
  • git:用于下载 create_ap 工具
sudo apt update &&
sudo apt upgrade -y
sudo apt install -y hostapd dnsmasq git

若已经有 create_ap 命令 可跳过

# 克隆仓库
git clone https://github.com/oblique/create_ap.git
cd create_ap
# 安装工具
sudo make install

查看系统中的无线网卡(通常为 wlan0 或 wlx 开头):

找到类似 wlan0 的无线接口名称(确保你的 Orange Pi 5 Max 已安装 WiFi 驱动,能识别无线网卡)。

ip link show


确认有线网卡名称(用于共享网络,通常为 eth0或lo):

ip -br addr show

基本命令格式(替换为你的信息):

sudo create_ap [无线网卡] [有线网卡] [热点名称] [热点密码]
示例(假设无线网卡为 wlan0,有线网卡为 eth0):
sudo create_ap wlan0 eth0 OrangePi_Hotspot 12345678

热点名称:OrangePi_Hotspot(可自定义)
密码:12345678(至少 8 位,可自定义)

先停止当前运行的热点(按 Ctrl+C)。

创建系统服务实现自启:

创建服务文件

sudo nano /etc/systemd/system/orangepi-hotspot.service

粘贴以下内容(根据你的网卡和热点信息修改):

[Unit]
Description=Orange Pi WiFi Hotspot
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/create_ap wlan0 eth0 OrangePi_Hotspot 12345678
Restart=always
[Install]
WantedBy=multi-user.target


启用并启动服务:

sudo systemctl enable orangepi-hotspot
sudo systemctl start orangepi-hotspot

热点启动失败:

检查无线网卡是否被占用(如已连接其他 WiFi),先断开:

sudo nmcli device disconnect wlan0

确认 hostapd 服务未冲突:

sudo systemctl stop hostapd

设备无法连接:

密码长度是否至少 8 位
尝试更换信道:

sudo create_ap wlan0 eth0 OrangePi_Hotspot 12345678 --channel 6

无网络访问:

确认有线网卡 eth0 已连接互联网
检查 IP 转发是否开启:

sudo sysctl -w net.ipv4.ip_forward=1

font awesome

https://fontawesome.com/v4/icons/

线上对比网站

Categories
java

ruoyi-mall

上架流程

上架

下单流程

流程

退款流程

退款

Categories
php

php 闭包传值处理

方法 1:使用 use 关键字按引用传递(最直接的方法)

这是最常用和最直接的方法。通过在使用 use 时在变量前加上 & 符号,你可以按引用传递变量。这意味着闭包内外的变量指向同一个内存地址,在闭包内修改它,外部的值也会同步改变。php复制下载

$externalValue = 10;
$anotherVariable = "Hello";

$myClosure = function() use (&$externalValue, $anotherVariable) {
    // 修改按引用传递的变量
    $externalValue += 50; // 这会影响外部的 $externalValue
    
    // 这是按值传递的,修改它不会影响外部的 $anotherVariable
    $anotherVariable .= " World"; 
    
    echo "Inside closure: externalValue = $externalValue, anotherVariable = $anotherVariable\n";
};

$myClosure(); // 输出:Inside closure: externalValue = 60, anotherVariable = Hello World

echo "Outside: externalValue = $externalValue\n"; // 输出:Outside: externalValue = 60
echo "Outside: anotherVariable = $anotherVariable\n"; // 输出:Outside: anotherVariable = Hello




关键点:

  • use (&$variable):按引用传递,内部修改影响外部。
  • use ($variable):按值传递(默认),内部修改影响外部。闭包使用的是它创建时该变量的一个副本
Categories
windows server

IIS 更换SSL证书

通过 certd 获取证书crt和私钥key

通过命令生成PFX文件(大部分win server 需要用旧算法生成)

openssl pkcs12 -macalg SHA1 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -export -out ./cert1.pfx -inkey ./cert.key -in ./cert.pem -passout pass:abc123

参数解释

-macalg SHA1 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES

指定旧算法兼容windows server

-export -out ./cert1.pfx

指定输出的文件

-inkey ./cert.key -in ./cert.pem

指定私钥 指定证书

-passout pass:abc123

指定pfx密码

windows server 操作

打开mmc

进入MMC

添加和删除管理单元 选择证书服务

添加完证书服务后

选择个人证书

执行导入

选择PFX文件

密码为生成PFX的密码 且设置为可导出

设置为个人分类后完成

设置友好名称

打开IIS

选择服务器根证书 确保有新添加的证书

选择我的网站 点击右边的绑定

选择我的服务端口

选择另新证书点击确定

Categories
Uncategorized

Rust raspberry GPIO

[dependencies] gpio-cdev = “0.4”

Categories
rust

Rust 安装

curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

. “$HOME/.cargo/env”