Skip to content

Instantly share code, notes, and snippets.

View h4tr3d's full-sized avatar

Alexander Drozdov h4tr3d

View GitHub Profile
@h4tr3d
h4tr3d / JsonData.gs
Last active September 18, 2024 04:38
Google SpreadSheet JSON processing
// Based on: https://stackoverflow.com/a/76915043/1828241
// 1. Open Spread Sheet
// 2. Go Menu → Extensions → App Scripts
// 3. Create new script, rename it to JsonData.gs
// 4. Put this code, save
// 5. Return back to Spread Sheet, entry formula as usial: `=JsonData(A1; "field_name")`
// For compres JSON and nested fields script must be adjusted
function JsonData(jsonText, key) {
try {
var data = JSON.parse(jsonText);
@h4tr3d
h4tr3d / SerialSend.c
Created July 6, 2024 04:34
SerialSend (2024)
// [SerialSend.c]
// Эта программа посылает текст или файл через последовательный порт
// Автор Ted Burke, последнее обновление 8-4-2015
//
// Обновление:
// 2024-06-07: Alexander Drozdoff <[email protected]>:
// - Добавлено отправка данных из файла as-is
// - Добавлен режим /read_back для вычитывания после
// отправки данных из порта. Полезно для синхронных
// устройство которые отсылают эхо, но которые блокируются
@h4tr3d
h4tr3d / gist:8494613f7d4e50d082f33cdba316c95d
Created May 22, 2024 02:58
OpenCV2 and OpenCL capabilities dump
#include <opencv2/opencv.hpp>
#include <opencv2/core/ocl.hpp>
void opencv_opencl_dump()
{
std::vector<cv::ocl::PlatformInfo> platform_info;
cv::ocl::getPlatfomsInfo(platform_info);
std::cout << "OpenCL infos: " << platform_info.size() << '\n';
for (auto &&item : platform_info) {
std::cout << " - Name: " << item.name() << '\n'
@h4tr3d
h4tr3d / marshal_v_sg4k_3g_uart_crc.md
Last active January 30, 2022 05:49
Marshal V-SG4K UART protocol CRC calculation

Protocol described in the official PDF mention CRC byte that complete each request and replay. But omit algorithm for it calculation.

After some researches, something sounds like true was found:

#include <iostream>
#include <cstdlib>
@h4tr3d
h4tr3d / yuvrgb.md
Created October 28, 2021 05:37 — forked from yohhoy/yuvrgb.md
RGB <=> YCbCr(YPbPr) color space conversion
Y  = a * R + b * G + c * B
Cb = (B - Y) / d
Cr = (R - Y) / e
BT.601 BT.709 BT.2020
a 0.299 0.2126 0.2627
b 0.587 0.7152 0.6780
@h4tr3d
h4tr3d / alacrity.toml
Last active October 16, 2024 04:31
Alacrity terminal configuration
import = ["~/.config/alacritty/alacritty-theme/themes/konsole_linux.toml"]
live_config_reload = true
[cursor]
blink_interval = 500
blink_timeout = 0
thickness = 0.40
[cursor.style]
shape = "Underline"
@h4tr3d
h4tr3d / 99-99-aur.hook
Last active June 7, 2022 00:23
AUR basic integrity check
# /usr/share/libalpm/hooks/99-99-aur.hook
# /etc/pacman.d/hooks/99-99-aur.hook
[Trigger]
Operation = Upgrade
Type = Package
Target = *
[Action]
Description = "Check non-repo packages integrity"
When = PostTransaction
@h4tr3d
h4tr3d / userChrome.css
Last active January 21, 2020 14:39
My interface customizations for Firefox to live without Classic Theme Restorer
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
.tabbrowser-tab:not([pinned]):not([selected]) {
min-width: initial !important;
overflow: hidden;
}
.tabbrowser-tab:not([pinned]) {
min-width: initial !important;
}
@h4tr3d
h4tr3d / qtc-display-all-project-files.md
Last active January 21, 2020 14:49
Qt Creator: show all project files in stocked CMake plugin in Hackers way

Not a question, just a life-hack :-)

Changes, that allows showing all project files in project view is discarded. Clarification that Project View is not a Project View but Build System View is added to the documentation. So, now there is no way to propagate CMakeProjectManager2 changes to the upstream at all.

But we can still display all files using stock plugin and existing functionality. Just hack it using fake CMAKE_TOOLCHAIN_FILE...

Idea:

  • using file(GLOB_RECURSE ...) scan project tree for files
@h4tr3d
h4tr3d / git-selective-merge.md
Created December 20, 2016 10:05 — forked from katylava/git-selective-merge.md
Git selective merge

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

> git co -b temp