Skip to content

Instantly share code, notes, and snippets.

@Toliak
Toliak / README.md
Last active March 6, 2025 11:50
Attachments to the Valgrind issue comment https://bugs.kde.org/show_bug.cgi?id=339160#c4

Hello. I encountered to the same problem while analyzing Nomad application via Callgrind tool.

Bug description

Valgrind versions tested:

  • valgrind-3.24.0 (Arch Linux, pacman) commit 2d09ef48e from the master branch.

Reproduction command and the resulting log:

@Toliak
Toliak / README.md
Last active March 4, 2025 10:13
Better logs (or just different) for Callgrind

Description

Patch for Valgrind commit 2d09ef48e2. Also works on tag VALGRIND_3_24_0

Provides logs for callgrind in the format:

  • Function entering
+ <Stack position> [<Module name>] <Function name> (<source line of the beginning of the called function, if debug symbols provided>)
@Toliak
Toliak / RESEARCH.md
Last active November 27, 2024 12:38
Huawei Matebook D16 RLEF-X NVMe Laptop Disk is read-only after sleep problem research and fix

I have bought laptop Huawei Matebook D16 RLEF-X. Tried to use Arch Linux and encountered with the problem:

  1. Turn on the suspend mode (sudo systemctl suspend)
  2. Close the laptop lid
  3. Wait a few minutes
  4. Open the laptop back
  5. Use mount to see that the disk is read-only. Moreover, it determines like read-only, however, it is just broken. No zsh history, no executables, no way to poweroff without power button long-press.
@Toliak
Toliak / shame.py
Last active February 14, 2023 10:16
Python runtime bytecode patch example
import functools
import struct
import types
import dis
def _patch_code(code: types.CodeType):
# Call function with 0 arguments
function_call_bytearray = bytearray(dis.opmap['CALL_FUNCTION'].to_bytes(1, byteorder='little') + b'\x00')
@Toliak
Toliak / caveats.lua
Last active February 4, 2021 09:31
MTASA has some interesting caveats with NPC damage synchronization and processLineOfSight function
SERVER_SIDE = guiGetScreenSize == nil
CLIENT_SIDE = guiGetScreenSize ~= nil
---------------
-- LIFECYCLE --
---------------
if SERVER_SIDE then
addEventHandler('onResourceStart', resourceRoot, function()
@Toliak
Toliak / Guide.md
Last active November 19, 2023 10:12
Пошаговая инструкция по сборке и тестированию

CMakeLists.txt

Прописывается основная информация для сборки через CMake.

cmake_minimum_required(VERSION 3.4)    # Минимальная версия CMake

set(CMAKE_CXX_STANDARD 17)             # Стандарт C++
set(CMAKE_CXX_STANDARD_REQUIRED ON)    # Обязательность установки указанного стандарта (если OFF (по умолчанию), то воспринимается как совет)
@Toliak
Toliak / touchpad.md
Last active November 8, 2023 09:01
Фичи для тачпада

Настройка touchpad'а на Manjaro

Данный апгрейд позволит вам использовать touchpad для переключения рабочих столов, окон и для подобных действий

Добавление группы

sudo gpasswd -a $USER input
@Toliak
Toliak / .bashrc
Created June 19, 2019 13:24
Useful aliases for arch linux
alias ll="ls -la"
alias pac="sudo pacman --noconfirm"
alias yao="yaourt --noconfirm"
alias give-me-upgrade="sudo pacman --noconfirm -Syyuu && yaourt --noconfirm -Syyuua"
alias give-me-ssh="ssh-add $(ls ~/.ssh | egrep "^([^\.]+)$" | grep -v known_hosts)"
@Toliak
Toliak / encodeString-filesize-fix.lua
Last active February 22, 2020 15:29
MTA encodeString filesize fix
local KEY = "sampletext"
addEventHandler("onResourceStart", resourceRoot, function()
-- ENCODE
local file = File.open("test.txt")
local raw = file:read(file.size)
file:close()
local len = #raw
local lent = {}
@Toliak
Toliak / vk-read.js
Last active June 17, 2018 17:13
Reads last VK message or amount of messages
function vk_read(token, id) {
if (!typeof(token) === "string") throw "TypeError: Expected string at 1 argument";
if (!typeof(id) === "number") throw "TypeError: Expected number at 2 argument";
// Упрощение AJAX запроса
let ajax = function(method, url, data) {
let xhr = new XMLHttpRequest();
// формируем запрос
let send = "";