Skip to content

Instantly share code, notes, and snippets.

View sokil's full-sized avatar
🇺🇦
sapere aude

sokil

🇺🇦
sapere aude
View GitHub Profile
@sokil
sokil / rush_pll_test.cpp
Created October 19, 2025 14:23
rush_pll_test.cpp
#include <cstdint>
#include <cstdio>
#define RUSH_REFERENCE_FREQ 50 // MHz
#define RUSH_INTERMEDIATE_FREQ 480 // MHz
#define RUSH_R_DIVIDER 1
#define RUSH_MOD 65536
#define RUSH_R_OUT_DIVIDER 1
#define FPFD (RUSH_REFERENCE_FREQ / RUSH_R_DIVIDER)
@sokil
sokil / elastic.http
Last active October 10, 2025 11:50
Elastic change index mapping
# get valid mapping and fix it
GET /test.activity_log_v1
# create new indewx with fixed mapping
PUT /test.activity_log_v2/
{
"mappings": {
"properties": {
"action": {
"type": "keyword"
@sokil
sokil / ELRS_Lora_SX1276_Pover_Levels.php
Last active July 3, 2025 08:01
ELRS Lora Pover Levels
<?php
$pattern = "| %12s | %12s | %12s | %-8s | %16s | %16s | %18s | %19s | \n";
echo sprintf(
$pattern,
'regPaConfig',
'regPaConfig',
'ELRS Power',
'paSelect',
@sokil
sokil / README.md
Last active February 24, 2024 11:08
BetaFlight

Compile

Compile locally

make arm_sdk_install

Compile using Docker

@sokil
sokil / NginxUnitControl Api.sh
Last active February 24, 2024 11:00
Nginx Unit Control Api
# Set new
curl -XPUT --unix-socket /var/run/control.unit.sock http://localhost/config/applications/app/processes -d 100
# Read current
curl --unix-socket /var/run/control.unit.sock http://localhost/config/applications/app/processes
@sokil
sokil / intelijIdeaJwtHelper.js
Created April 7, 2023 16:44
IntelliJ IDEA Http Client helpers
/**
* Used with JetBrains HTTP Client on OAuth authenticate requests to log unpacked fetched OAuth2 access token and its details
*
* @see https://gitlab.auroraglobal.com/maverix/jetbrains-toolkit
*/
function atob(data) {
if (arguments.length === 0) {
throw new TypeError("1 argument required, but only 0 present.");
}
data = `${data}`;
@sokil
sokil / RootingAndFlashingAndroidTablets.md
Last active April 22, 2023 10:51
Rooting and Flashing Android Tablets

Rooting and Flashing Android Tablets

Glossary

  • PIT-file: file with partitions
  • ADB Sideload: the command that allows you to transfer the Android system installation file (it is always a .zip file) and install it directly on the phone, from the PC.

Flashing TWRP

  1. Install flasher:
@sokil
sokil / KAfka_to_Clickhouse.md
Last active March 13, 2023 10:11
Kafka Connect

ClickHouse

Events from Kafka topic may be consumed by ClickHouse and stored. This may be useful for making projections from events.

ClickHouse's nodes must be added to cluster to use ReplicatedMergeTree.

First, create database my_db.

ClickHouse cluster

@sokil
sokil / jwt_unpack.sh
Last active July 27, 2022 18:51
Unpack JWY in Bash
curl -XPOST -H 'Content-Type: application/x-www-form-urlencoded' \
http://localhost:8080/auth/realms/{realm}/protocol/openid-connect/token \
-d 'grant_type=client_credentials&client_id={client}&client_secret={sectet}' \
2>/dev/null | jq '.access_token | split(".") | .[0],.[1] | @base64d | fromjson'
@sokil
sokil / session.php
Created May 2, 2022 20:13
php session serializer
<?php
function sessionDataUnserialize($serializedData) {
$return_data = array();
$offset = 0;
while ($offset < strlen($serializedData)) {
if (!strstr(substr($serializedData, $offset), "|")) {
throw new Exception("invalid data, remaining: " . substr($serializedData, $offset));
}