Skip to content

Instantly share code, notes, and snippets.

View REASY's full-sized avatar

Artavazd Balaian REASY

View GitHub Profile

RAM

user@host:~/github/numactl/numactl$ lsmem
RANGE                                  SIZE  STATE REMOVABLE   BLOCK
0x0000000000000000-0x000000007fffffff    2G online       yes       0
0x0000000100000000-0x000000e07fffffff  894G online       yes   2-448
0x0000010000000000-0x0000019fffffffff  640G online       yes 512-831

Memory block size:         2G
Total online memory:     1.5T
@REASY
REASY / patch_apk.md
Created February 26, 2025 14:48 — forked from rigwild/patch_apk.md
Full tutorial to patch APKs on Android using apk-mitm and APKLab. Support for bundle APKs.

Patch APK

Full tutorial to patch APKs on Android using apk-mitm and APKLab. Support for bundle APKs.

Pull APK

adb shell pm list packages
adb shell pm path <package_name>
@REASY
REASY / tracing.stp
Last active January 29, 2025 15:50
tracing.stp
probe begin {
printf("[%ld] Start tracing process %d\n", gettimeofday_ms(), target())
}
probe end {
printf("[%ld] End tracing process %d\n", gettimeofday_ms(), target())
}
probe syscall.* {
if (pid() == target()) {
@REASY
REASY / read_column_v2.rs
Created January 24, 2025 14:08
Generilize two methods by using single read_column_v2
use arrow::array::{Array, ArrayBuilder, Float64Builder, Int64Builder, StringBuilder};
use parquet::data_type::DataType;
use parquet::data_type::{ByteArray, ByteArrayType, DoubleType, Int64Type};
use parquet::column::reader::ColumnReaderImpl;
use parquet::schema::types::ColumnDescriptor;
// Private module `sealed`.
mod sealed {
use parquet::data_type::{ByteArrayType, DoubleType, Int64Type};
// Define and implement `Sealed` trait for interested Parquet data types.
@REASY
REASY / read_column_v1.rs
Created January 24, 2025 06:01
Generilize two methods by using single read_column_v1
pub fn read_column_v1<T, B, V, N, F>(
mut typed_rdr: ColumnReaderImpl<T>,
col_desc: &ColumnDescriptor,
batch_size: usize,
append_value_fn: V,
append_null_fn: N,
factory_fn: F,
) -> parquet::errors::Result<Box<dyn Array>>
where
// `T` is the Parquet data type (e.g., `Int64Type`, `Float64Type`) and must implement `DataType`.
@REASY
REASY / two_methods.rs
Created January 24, 2025 03:06
An example of two almost identitcal Rust methods
/*
```Cargo.toml
[package]
name = "arrow-rs-examples"
version = "0.1.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
arrow = "54.0.0"
@REASY
REASY / trait_cannot_be_made_into_object.rs
Created January 14, 2025 04:30
Trait cannot be made into object Rust error
use crate::{GenericError, GenericResult};
use aes_gcm::aead::Aead;
use aes_gcm::{Aes128Gcm, Key, KeyInit, Nonce};
use hocon::{Error, Hocon, HoconLoader};
use log::warn;
use pbkdf2::password_hash::{PasswordHasher, SaltString};
use pbkdf2::Pbkdf2;
use reqwest::blocking::Client as HttpClient;
use reqwest::blocking::ClientBuilder as HttpClientBuilder;
use reqwest::header;
@REASY
REASY / lspci_output_verbose.txt
Last active November 11, 2024 06:51
lspci verbose output
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14d8
Subsystem: ASUSTeK Computer Inc. Device 8877
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Device 14d9
Subsystem: ASUSTeK Computer Inc. Device 8877
Control: I/O- Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
@REASY
REASY / get_cores_from_pod.py
Created March 18, 2024 03:26
get_cores_from_pod.py
def get_cpu_cores_via_cgroups():
# cgroups V1
cfs_period_path = "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
cfs_quota_path = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
# cgroups V2
cpu_max_path = "/sys/fs/cgroup/cpu.max"
cpu_cores = _get_cpu_cores(cfs_period_path, cfs_quota_path, cpu_max_path)
@REASY
REASY / array_of_structs_to_parquet.rs
Last active May 14, 2024 04:01
An example how to convert array of structs to Parquet using arrow-rs
/*
```Cargo.toml
[package]
name = "arrow-rs-examples"
version = "0.1.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]