Skip to content

Instantly share code, notes, and snippets.

View larytet's full-sized avatar

Arkady Miasnikov larytet

View GitHub Profile
@larytet
larytet / get_exe_name.c
Last active November 11, 2023 02:33
Get absolute path of the executable in the Linux kernel, context of do_exec() kprobe/SystemTap
static char* get_exe_name(int pid, char *buffer, int buffer_size)
{
char *result = NULL;
struct mm_struct* mm = current->mm;
if (mm)
{
int lock_result = down_read_trylock(&mm->mmap_sem);
if ((lock_result) && (mm->exe_file))
{
We can't make this file beautiful and searchable because it's too large.
2022-05-12 00:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 02:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 04:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 06:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 08:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 10:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 12:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 14:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 16:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
2022-05-12 18:00:00.000000 TerraUSD stablecoin depegs RELEVANT IMPORTANT NEUTRAL
We can't make this file beautiful and searchable because it's too large.
12/05/2022 00:00:00,12/05/2022 00:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 02:00:00,12/05/2022 02:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 04:00:00,12/05/2022 04:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 06:00:00,12/05/2022 06:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 08:00:00,12/05/2022 08:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 10:00:00,12/05/2022 10:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 12:00:00,12/05/2022 12:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 14:00:00,12/05/2022 14:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 16:00:00,12/05/2022 16:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
12/05/2022 18:00:00,12/05/2022 18:00:00,3,3,Bullish,Grayscale wins lawsuit ETF SEC
@larytet
larytet / lockfree_hashtable.c
Last active September 13, 2023 14:58
A simple hashtable for Linux kernel drivers
/**
* Lockfree is a set of lockfree containers for Linux and Linux kernel
* Copyright (C) <2017> Arkady Miasnikov
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@larytet
larytet / scylladb-coding-task.md
Last active January 11, 2022 09:58
Throttling bandwidth with Go

Throttling bandwidth with Go

Imagine a service that is serving big log files over raw TCP, you decided to implement simple QoS for an existing server.

The goal of the task is to create small Go package that would allow for throttling bandwidth for TCP connections.

Requirements:

  • keep it simple
  • think of it as open-source software that builds upon existing solutions
@larytet
larytet / get_inode.c
Last active December 10, 2021 02:39
Get inode and file given FD in the Linux kernel
static void get_inode(u64 fd, struct file **p_file, struct inode **p_inode)
{
struct file *file = NULL;
struct inode *f_inode = NULL;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,7,0))
file = fget_raw(fd); // do not forget to fput(file)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,255))
{
struct files_struct *files = current->files;
if (files) // This is always the case, but I am not taking chances

video and latency

  • Vehicle moving at the speed of 130 km/h moves 3cm/ms Typical reaction time of a driver is 500ms-1s. We want to target 1-5% of the driver reaction time (regulaton will say it's word for sure if the remote driving gets popular). This is 5-50ms round trip. For slower moving vehicles like forklifts the network latency can in the 100-500ms range? Under 5ms roundtrip latency is not realistic in the modern generally available IP networks (proprietary microwave relay here?).
  • We need to deliver high quality video only for the area where the driver has his eyes on.
  • We shall ensure under 5ms latency between recognition of a saccade and displaying a high resolution image in the right place.
  • The car can record 360 degrees view in high resolution, but send only low resolution stream for all or most areas.
  • We want to minimize the network latency and impact of the network congestion. One of the ways to do this is to require 100% visibility for the microwave transmitters.
-----BEGIN CERTIFICATE-----
MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ
RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD
VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX
DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y
ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy
VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr
mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr
IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK
mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu
-----BEGIN CERTIFICATE-----
MIIJRzCCBy+gAwIBAgITIAAJCdv4ae0wATxOVgAAAAkJ2zANBgkqhkiG9w0BAQsFADCBizELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jhd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