Skip to content

Instantly share code, notes, and snippets.

View gabonator's full-sized avatar
👨‍🏭
at work

Gabriel Valky gabonator

👨‍🏭
at work
View GitHub Profile
@gabonator
gabonator / Classes.h
Created August 5, 2023 08:52
hcs200 decoder test for la104/rftool
#pragma once
#include "Types.h"
class CPoint {
public:
int x, y; // TODO: !!!
CPoint()
{
}
CPoint(int _x, int _y) :
@gabonator
gabonator / kibaja.js
Created July 26, 2023 10:32
elastic search test
// Create sample elastic search database for kibana
// To add new endpoint into kibana:
// Menu (top left) -> Stack management -> Index patterns (Kibana) ->
// Create index pattern (top right) -> "test_endpoint3" -> Timestamp field -> Create index pattern
// To check recent data:
// Menu (top left) -> Discover -> "test_endpoint3"
// To allow elastic search listening on 0.0.0.0 interface add:
// -Djava.net.preferIPv4Stack=true
// to
@gabonator
gabonator / bmc_entity_manager.sh
Last active July 25, 2023 08:26
bmc entity manager setup script
# Install BMC entity manager and activates some randomly chosen configuration
# Adds fake temperature sensor
# setup for Ubuntu 23 with GCC-13
#
set -e -x
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get install -y libpam0g-dev libsystemd-dev python3 python3-pip python3-inflection python3-mako python3-yaml g++-13 gcc-13 libi2c-dev libboost-all-dev libdbus-1-dev ninja-build cmake libssl-dev libtinyxml2-dev
sudo apt-get install -y libgtest-dev
@gabonator
gabonator / gccstdversion.sh
Last active July 12, 2023 13:38
gcc check standard version
# Requesting c++20 standard in gcc commandline does not ensure that it is supported or will be used,
# dumping the __cplusplus reveals that gcc completely ignores this request without any warning or error
# Such problems leads to similar error messages:
# main.cpp:1:24: error: ‘bit_cast’ is not a member of ‘std’; did you mean ‘bad_cast’?
#
#
# This shell script prints
# #define __cplusplus 202002L
# or
# #define __cplusplus 201709L
@gabonator
gabonator / gtest.sh
Created June 29, 2023 09:46
google test cross compile minimal setup with cmake
cat > main.cpp <<- EOM
#include <gtest/gtest.h>
TEST(group, name)
{
printf("Hello!\n");
}
EOM
cat > CMakeLists.txt <<- EOM
FROM node:10-alpine
RUN mkdir -p /src/app
WORKDIR /src/app
COPY package.json /src/app/package.json
RUN npm install
COPY . /src/app
EXPOSE 3000
@gabonator
gabonator / rle.c
Created February 14, 2023 10:05
run length encoder/decoder
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "testrle.h"
typedef uint8_t UINT8;
typedef int INTN;
typedef void VOID;
#define ASSERT assert
@gabonator
gabonator / makefs.sh
Created February 14, 2023 10:04
make fat12/fat16/fat32 fs image
set -e
set -x
# FAT12 - min 64KB:
# dd if=/dev/zero of=test.img count=64 bs=1K
# mkfs.vfat -v -F 12 -S 512 -s 4 test.img
# FAT16 - min 9MB:
# dd if=/dev/zero of=test.img count=9 bs=1M
# mkfs.vfat -v -F 16 -S 512 -s 4 test.img
# FAT32 - min 256MB (cannot allocate):
# dd if=/dev/zero of=test.img count=256 bs=1M
@gabonator
gabonator / code.cpp
Created February 11, 2023 14:46
Novation mini mk3 hack - image editor
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
extern "C" uint32_t LED_BUFFER[];
extern "C" uint8_t MODE;
extern "C" int32_t TICKMS;
enum {Width = 32};
uint32_t image[Width][8] = {0};
uint32_t color = 0xab00cd;
@gabonator
gabonator / code.c
Created February 8, 2023 17:27
Novation mini mk3 hack - simple editor
#include <stdint.h>
#define LED_BUFFER ((uint32_t*)0x20000304)
#define REFRESH_BUFFER ((uint32_t*)0x20006754)
uint8_t buttonMap[8][8];
uint8_t image[8][8];
uint32_t getPixel(int x, int y)
{