Skip to content

Instantly share code, notes, and snippets.

View IgorKha's full-sized avatar
😄
If it works, then I did it. If it doesn't work, then someone else did it.

IgorKha

😄
If it works, then I did it. If it doesn't work, then someone else did it.
View GitHub Profile
@IgorKha
IgorKha / rk3308_otp_parser.py
Created March 15, 2025 12:51
This module parses NVMEM data according to RK3308 Device Tree Specification.
"""
Rockchip RK3308 NVMEM Parser
This module parses NVMEM data according to RK3308 Device Tree Specification.
Key memory regions:
- CPU ID: offset 0x07, length 0x10 (16 bytes)
- CPU leakage: offset 0x17 (1 byte)
- Logic leakage: offset 0x18 (1 byte)
ref: https://github.com/u-boot/u-boot/blob/15d6518c942f0da13f9a7ceeadbd925c3317ec8d/arch/arm/mach-rockchip/board.c#L396C5-L396C23
@IgorKha
IgorKha / remote_copy.sh
Last active March 7, 2025 17:47
Great for deploying "dev" applications to IoT devices or single-board computers.
#!/usr/bin/env bash
# This script is used to deploy the application files to a remote device.
# It can be used to deploy the application to a device with a public IP address
# or a device in a local network. The script will connect to the device using SSH
# and copy the files to the target directory. It will also restart the service
# on the remote device to apply the changes.
# The script can be used to deploy the application to a Raspberry Pi, BeagleBone, NaPi
# or any other device that runs a Linux distribution with SSH support.
# Great for deploying applications to IoT devices or single-board computers.
@IgorKha
IgorKha / docker-compose.yml
Last active February 16, 2025 23:13
phpbb3.3.x docker container build, phpbb docker compose
---
services:
phpbb:
build: .
container_name: phpbb
restart: unless-stopped
ports:
- "8080:80"
volumes:
- phpbb-data:/var/www/html
import psutil
def bytes2human(n):
# http://code.activestate.com/recipes/578019
# >>> bytes2human(10000)
# '9.8K'
# >>> bytes2human(100001221)
# '95.4M'
symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
@IgorKha
IgorKha / docker-compose.yml
Created January 21, 2024 06:51
grafana-telegraf-influx example
# Influxdb init
# docker-compose up influxdb_cli
# Ctrl + c after init db
# and run
# docker-compose up -d
version: "3"
services:
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Usage: $0 <serial_number> <duration_in_seconds> <note>"
echo "note: optional parameter"
echo "Example: $0 SN0001 10 \"Test 1\""
exit 1
fi
serialnumber="$1"
@IgorKha
IgorKha / RCW-Hex-to-Binary-Converter.html
Last active March 18, 2025 17:51
RCW Hex to Binary Converter
<!DOCTYPE html>
<html>
<head>
<title>RCW Hex to Binary Converter</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
#!/bin/bash
PREFIX_ETH=${1:-"eth"}
ncpus=$(grep -ciw ^processor /proc/cpuinfo)
test "$ncpus" -gt 1 || exit 1
n=0
for irq in $(cat /proc/interrupts | grep "$PREFIX_ETH" | awk '{print $1}' | tr -d ":")
do
f="/proc/irq/$irq/smp_affinity"
@IgorKha
IgorKha / net.sh
Last active December 28, 2022 15:47
show interface params
#!/usr/bin/env bash
help() {
echo
echo "Usage: $0 -i [network-interface]* -t [seconds] -q (show softirq)"
echo "Example: $0 -i eth0* -t 1 -q"
echo
echo "*required option"
echo
echo "interfaces on this host: $(ls /sys/class/net/ | awk '{printf "%s,",$1}')"
@IgorKha
IgorKha / dd_bench.sh
Last active December 25, 2022 22:12
benchmark with "dd" for rockpis and others
# CPU
time dd if=/dev/zero bs=1MB count=200 | sha512sum
# disk write
time dd if=/dev/zero of=test.img oflag=direct bs=128k count=1k conv=fdatasync
# disk read
echo 3 | sudo tee /proc/sys/vm/drop_caches
time dd if=test.img of=/dev/null bs=128k conv=fdatasync