Skip to content

Instantly share code, notes, and snippets.

View m1nuz's full-sized avatar

Mykhailo Piddubnyi m1nuz

View GitHub Profile
@m1nuz
m1nuz / CMakeLists.txt
Last active September 27, 2021 18:07
/dev/kmsg reader
cmake_minimum_required(VERSION 3.18.0)
project(kmsgreader VERSION 0.1.0)
set(APP_NAME "kmsgreader")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_executable(${APP_NAME}
kmsgreader.c
@m1nuz
m1nuz / sdl2_opengl_4_5_triangle.cpp
Created August 25, 2017 22:01
Miminal C++ SDL2 OpenGL 4.5 example
//
// Miminal C++ SDL2 OpenGL 4.5 example
//
// by Poddubny Michael
//
// Download OpenGL header:
// wget https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h
//
// Compile:
// g++ -std=c++11 sdl2_opengl_4_5_triangle.cpp -I. -lSDL2 -o sdl2_opengl_4_5_triangle
@m1nuz
m1nuz / str_replace.c
Last active August 29, 2015 14:20
str_replace in C
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#ifndef ABS
#define ABS(v) ((v) < 0 ? -(v) : (v))
#endif
char *
str_replace_once_fast(const char *orig, size_t orig_size,
@m1nuz
m1nuz / simple-x11-window.c
Created March 12, 2015 09:37
Simple X11 window
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
bool quited = false;
void on_delete(Display * display, Window window)
{
XDestroyWindow(display, window);
@m1nuz
m1nuz / rwtext.c
Last active August 29, 2015 14:09 — forked from snipsnipsnip/rwgetc.c
// feof equivalent for SDL_rwops
int rweof(SDL_RWops *ctx) {
return SDL_RWsize(ctx) == SDL_RWtell(ctx);
}
// fgetc equivalent for SDL_rwops
int rwgetc(SDL_RWops *rw) {
char c;
return SDL_RWread(rw, &c, 1, 1) == 1 ? c : EOF;