Skip to content

Instantly share code, notes, and snippets.

View colesnicov's full-sized avatar

Colesnicov Denis Petrovich colesnicov

  • Czech Republic, Tachov
View GitHub Profile
#include <filesystem>
#include <imgui.h>
#define BIT(x) (1 << x)
std::pair<bool, uint32_t> DirectoryTreeViewRecursive(const std::filesystem::path& path, uint32_t* count, int* selection_mask)
{
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth;
bool any_node_clicked = false;
@colesnicov
colesnicov / totp.c
Created May 22, 2024 19:38 — forked from Flix01/totp.c
totp.c
// Original code: https://gist.github.com/syzdek/eba233ca33e1b5a45a99
// Original code license:
/*
* TOTP: Time-Based One-Time Password Algorithm
* Copyright (c) 2015, David M. Syzdek <david@syzdek.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@colesnicov
colesnicov / kmstest.c
Created May 14, 2024 12:55 — forked from dvdhrm/kmstest.c
DRM KMS Test
#define EGL_EGLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <errno.h>
#include <gbm.h>
#include <GL/gl.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
#include <stdlib.h>
@colesnicov
colesnicov / queue.js
Created October 11, 2022 20:37
javascript implementation of queue with extended functionality
/*
* The MIT License
*
* Copyright 2022 denis.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@colesnicov
colesnicov / newPager.js
Last active September 25, 2022 18:13
HTML Paginator in pure JS
/*
The MIT License
Copyright 2022 Denis Colesnicov.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@colesnicov
colesnicov / CMakeLists.txt
Created April 18, 2022 16:09
Jak vkladat Kconfig soubory
set(ENV{PROJ_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
@colesnicov
colesnicov / gist:e1a49409d92ae013a6b2bcf6580ccaea
Last active December 23, 2020 12:49
How to program AVR devices. Terminal commands...
Priklad: avrdude -v -p<MCU> -c<PROGRAMMER> -P<PORT> -b<BITRATE> -Uflash:w:<FILE>:i
Priklad pro programovani ATMEGA328P s pomoci arduino jako ISP programator.
MCU=atmega328p
PROGRAMMER=STK500v1 (aka arduino as ISP)
PORT=/dev/ttyUSB0
BITRATE=19200
avrdude -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -Uflash:w:<file.hex>:i
@colesnicov
colesnicov / atmega328pb.markdown
Created December 6, 2020 13:52 — forked from goncalor/atmega328pb.markdown
How to add support for ATmega328PB to arv-gcc and avrdude

Adding support for ATmega328PB to arv-gcc and avrdude

avr-gcc

  1. Download ATmega's support pack from Microchip's website
  2. Unzip the relevant files

unzip -j Atmel.ATmega_DFP.x.y.zzz.atpack \

@colesnicov
colesnicov / pgm.hpp
Created January 12, 2020 20:03
With these functions, any data can be cleaned from the PGM space.
/**
* @licence WTFPL
*
*/
#pragma once
#include "avr/pgmspace.h"
template<typename T> void PROGMEM_readAnything(const T * source, T& dest)