Skip to content

Instantly share code, notes, and snippets.

@matwey
matwey / Makefile
Last active November 24, 2023 15:34
Linux kernel module example
obj-m := library.o
default:
$(MAKE) -C /home/matwey/lab/linux/ M=$(PWD) modules
builtin:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
$(MAKE) -C /home/matwey/lab/linux/ M=$(PWD) clean
@matwey
matwey / main.c
Created January 24, 2023 17:02
Convert raw AVR binary firmware to ELF format loadable to QEMU
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/mman.h>
# nm qe
400.0000 35.1122
401.0000 35.1142
402.0000 35.2593
403.0000 35.3961
404.0000 35.7155
405.0000 35.7028
406.0000 35.8889
407.0000 36.0927
408.0000 36.2966
# nm qe
400.0000 35.1122
401.0000 35.1142
402.0000 35.2593
403.0000 35.3961
404.0000 35.7155
405.0000 35.7028
406.0000 35.8889
407.0000 36.0927
408.0000 36.2966
cmake_minimum_required (VERSION 3.1)
project(checkcheck LANGUAGES C CXX VERSION 0.1.0)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_C_STANDARD 99)
include(CheckSymbolExists)
include(GNUInstallDirs)
include(GenerateExportHeader)
@matwey
matwey / main.cpp
Last active February 16, 2022 10:04
vulkan
#include <iostream>
#include <vulkan/vulkan.h>
#include "sample.h"
int main(int argc, char** argv) {
VkResult result = VK_SUCCESS;
VkApplicationInfo app_info{};
VkInstanceCreateInfo create_info{};
@matwey
matwey / fetch.sh
Last active July 4, 2021 08:27
Aerostat fetch
#!/bin/sh
set -x
set -e
curl 'https://www.radiorus.ru/brand/57083/episodes/json?offset=0' 2>/dev/null | jq -r '.episodes | .[] | .audioIds[0].sources.download' | wget -c --content-disposition --read-timeout=15 -i -
@matwey
matwey / test.py
Last active December 10, 2020 16:30
BLE LED
#!/usr/bin/env python
import time
import gatt
manager = gatt.DeviceManager(adapter_name='hci0')
def array2raw(arr):
raw = b"".join(map(lambda x: x.to_bytes(1, byteorder='big'), arr))
return raw
@matwey
matwey / collectd.pcap
Created October 21, 2020 16:19
collectd aes256
@matwey
matwey / dump.py
Last active September 11, 2020 09:32
dump/load IsolationForest to/from ONNX
#!/usr/bin/env python3
import numpy as np
from sklearn.ensemble import IsolationForest
# Need skl2onnx 1.7.1+
from skl2onnx import convert_sklearn
from skl2onnx import to_onnx
rng = np.random.default_rng()