启动的时候 按任意键 进入u-boot 交互模式
查看系统环境变量
printenv

在线更新 u-boot

# 设置server ip
setenv serverip 192.168.0.147
# 通过tftp载入镜像
# tftp <内存地址> <文件名>
tftp 82000000 u-boot_SK4102_hi3531_RTL8363.bin
tftp 82000000 u-boot_KMD4101_hi3531_1000m.bin
# 先在ram中调试运行,OK了在重新ftp下载,写入flash
go 0x82000000

# 测试 ok 后,写入 nand,注意要重新载入一次,因为运行后有变化
tftp 82000000 u-boot_KMD4101_hi3531_1000m.bin
nand erase 0 200000
nand write 82000000 0 200000
阅读全文 »

std::shared_ptr<spdlog::logger> m_logger;

try
{
// Create a daily logger - a new file is created every day on 2:30am, save 60 days log
auto logger = spdlog::daily_logger_mt("daily_logger", "logs/daily", 23, 59, false, 60);
g_logger->set_level(spdlog::level::level_enum(logLevel));
logger->flush_on(spdlog::level::info);
logger->info("infor message");
logger->error("Some error message with arg: {}", 1);
logger->critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42);

spdlog::info("Hello, {}!", "World");
logger->info("Hello {} {} !!", "param1", 123.4);

spdlog::warn("Easy padding in numbers like {:08d}", 12);
spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42);
spdlog::info("Support for floats {:03.2f}", 1.23456);
spdlog::info("Positional args are {1} {0}..", "too", "supported");
spdlog::info("{:<30}", "left aligned");

logger->flush();
}
catch (const spdlog::spdlog_ex& ex)
{
std::cout << "Log initialization failed: " << ex.what() << std::endl;
}

// 如果存在会返回实例,否则返回空
m_logger = spdlog::get("daily_logger");
if (m_logger == nullptr)
{
m_logger = spdlog::daily_logger_mt("daily_logger", "logs/daily", 23, 59, false, 60);
g_logger->set_level(spdlog::level::level_enum(logLevel));
g_logger->flush_on(spdlog::level::level_enum(logLevel));
m_logger->info("m_logger is started.");

}

// Release and close all loggers
spdlog::drop_all();

// 或者单独drop某个logger
spd::drop("console");
spd::drop("basic_logger");

模板路径

%USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates

%USERPROFILE%\Documents\Visual Studio 2019\Templates\ItemTemplates

Project and item templates

BeautifulSoup + requests 简单网页

selenium
web driver chrome two site below is same
https://chromedriver.chromium.org/
https://sites.google.com/chromium.org/driver/

driver.find_element_by_id("some_id")
driver.find_element_by_name("some_name")
driver.find_element_by_tag_name("some_tag")
driver.find_element_by_css_selector("some_selector")
driver.find_element_by_class_name("some_class")
driver.find_element_by_link_text("some_text")
driver.find_element_by_partial_link_text("some_other_text")
driver.find_element_by_xpath("some_xpath")

爬虫检测

爬虫需要遵守 robot 协议

selenium webdriver 有哪些爬虫特征,可以直接打开这个页面去检测:Antibot

  • Chrome 正受到自动测试软件的控制。
    options.add_experimental_option('excludeSwitches', ['enable-automation'])
  • WebDriver (New) present (failed)
    options.add_argument('--disable-blink-features=AutomationControlled')
  • “webDriver”: true, “webDriverValue”: true
    隐藏浏览器指纹, 安装 nodejs 后执行下面语句,获取 stealth.min.js 脚本,打开页面之前,运行这个脚本,就可以成功隐藏浏览器指纹了。
    npx extract-stealth-evasions
    with open('./js/stealth.min.js') as f:
    js = f.read()

    browser.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
    "source": js
    })

xpath

The XPath is the language used to select elements in an HTML page. XPath can be used to locate any element on a page based on its tag name, ID, CSS class, and so on. There are two types of XPath in Selenium.

Absolute XPath
Relative XPath

Absolute Xpath is the simplest form of XPath in Selenium. It starts with a single slash ‘/’ and provides the absolute path of an element in the entire DOM.

/html//div/div/div/div[1]/div/a/img

In the case of relative XPath in Selenium, the XPath expression starts from the middle of the DOM structure. It is represented by a double slash ‘//’ denoting the current node.

//img[@alt=’LambdaTest’]

private bool windowCreate = true ;
...
protected override void OnActivated(EventArgs e)
{
if (windowCreate)
{
base .Visible = false ;
windowCreate = false ;
}
base .OnActivated(e);
}

使用 Qt 提供的集合类传递数据,例如:QVector

qRegisterMetaType<QVector<uchar> >("QVector<uchar>");

signals:
void signal_decode_one_frame(QVector<uchar>);

public slots:
// 一帧图像信号响应显示槽;
void on_slot_decode_one_frame(QVector<uchar> image);


bool bRet = connect(this,SIGNAL(signal_decode_one_frame(QVector<uchar>)),this,SLOT(on_slot_decode_one_frame(QVector<uchar>)),Qt::QueuedConnection);
assert(bRet);

QVector<uchar> imgbuf;
imgbuf.reserve(bufsize);

memcpy(imgbuf.data(), (uchar *)m_auto_array_rgb.data(), bufsize);
emit signal_decode_one_frame(imgbuf);

CInfoWnd* wnd = new CInfoWnd( main_wnd );
wnd->setAttribute( Qt::WA_DeleteOnClose, true );
wnd->show();

delete wnd;
//or
wnd.deleteLater();


合并 youtube 下载的视频和音频

ffmpeg -i 1.webm -i 1.m4a -c copy -map 0:v:0 -map 1:a:0 2.mkv

调试程序,看到的 PTS 是一个 64位的计数器,每一帧 +1, 没做进一步调查。