Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
using namespace std;
#include <cstdlib>
#include <string>
#include <vector>
unsigned char parse_hex(char c)
{
if ('0' <= c && c <= '9') return c - '0';
@AndreiCherniaev
AndreiCherniaev / myAbsSub
Created January 11, 2024 12:08
myAbsSub
//return result of (a-b) without sign
#define myAbsSub(a,b) (a)>(b)? ((a)-(b)) : ((b)-(a))
#include <iostream>
int main()
{
uint16_t ttt= (((uint16_t)0x00 & 0x7F)<<8 | (uint16_t)(int8_t)0xA7);
printf("%u", ttt);
return 0;
}
typedef union{
uint16_t u16;
uint8_t u8s[2];
}uint8_16_t;
const uint8_16_t val= {.u8s={0xAA, 0xBB}};
cmake_minimum_required(VERSION 3.16)
project(linklib_example LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core )
напрямую направить ядру запрос о перезагрузке устройства с помощью sysrq
#!/system/bin/sh
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger