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
@colesnicov
colesnicov / recepty.md
Last active February 16, 2025 16:13
Recepty
@colesnicov
colesnicov / DropShadows.cpp
Created January 1, 2025 18:50 — forked from kpcftsz/DropShadows.cpp
K.I.S.S. Dear ImGui drop shadows - dead simple
/*
* This function assumes the existence of an active Dear ImGui window
*/
void RenderDropShadow(ImTextureID tex_id, float size, ImU8 opacity)
{
ImVec2 p = ImGui::GetWindowPos();
ImVec2 s = ImGui::GetWindowSize();
ImVec2 m = {p.x + s.x, p.y + s.y};
float uv0 = 0.0f; // left/top region
float uv1 = 0.333333f; // leftward/upper region
@colesnicov
colesnicov / ImRotateDemo.cpp
Last active December 30, 2024 21:11 — forked from carasuca/ImRotateDemo.cpp
Rotating text and icon demo for dear imgui
#include "imgui_internal.h"
int rotation_start_index;
void ImRotateStart()
{
rotation_start_index = ImGui::GetWindowDrawList()->VtxBuffer.Size;
}
ImVec2 ImRotationCenter()
{
@colesnicov
colesnicov / systemDAsUser.service
Created December 23, 2024 16:06 — forked from torch2424/systemDAsUser.service
Run a systemd service as a user
# How to create systemd services: http://neilwebber.com/notes/2016/02/10/making-a-simple-systemd-file-for-raspberry-pi-jessie/
# Digital ocean on a mongodb service: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
[Unit]
Description=Run SystemD as users
After=network.target
[Service]
Type=simple
User=[USER HERE]
WorkingDirectory=[USER HOME]
@colesnicov
colesnicov / docker.md
Last active December 14, 2024 21:37
Jak pracovat s docker

vytvoreni dockeru

docker run -d -ti <image> /bin/bash

Napriklad:

@colesnicov
colesnicov / std::vector.md
Last active November 17, 2024 16:03
C++ Tips

Tipy a triky s std::vector

Odstraneni prvku

Spravna cesta jak odstranit prvek z vectoru..

#!/bin/sh
PREFIX=$HOME/wayland-install
aptitude update
aptitude install build-essential autoconf automake libtool libpthread-stubs0-dev git-core libx11-dev x11proto-dri2-dev x11proto-gl-dev libxext-dev libxxf86vm-dev libxdamage-dev libxfixes-dev libexpat1-dev libxt-dev libxi-dev libxmu-dev libudev-dev libgl1-mesa-dev libx11-xcb-dev libxcb-render0-dev libpng-dev libpixman-1-dev python libffi-dev libgdk-pixbuf-dev libglib2.0-dev libpoppler-glib-dev
aptitude build-dep mesa
wget http://cgit.freedesktop.org/mesa/drm/snapshot/drm-2.4.15.tar.gz
tar -xzf drm-2.4.15.tar.gz
@colesnicov
colesnicov / raspi-monitor
Created June 9, 2024 15:15 — forked from simlun/raspi-monitor
Script to enable and disable the HDMI signal of the Raspberry PI
#!/bin/bash -e
# /usr/local/sbin/raspi-monitor
# Script to enable and disable the HDMI signal of the Raspberry PI
# Inspiration: http://www.raspberrypi.org/forums/viewtopic.php?t=16472&p=176258
CMD="$1"
function on {
/opt/vc/bin/tvservice --preferred
@colesnicov
colesnicov / rpi-hdmi.sh
Created June 9, 2024 15:14 — forked from AGWA/rpi-hdmi.sh
Enable and disable the HDMI port on the Raspberry Pi: `rpi-hdmi on` to turn on, `rpi-hdmi off` to turn off. X is properly reinitialized when re-enabling.
#!/bin/sh
# Enable and disable HDMI output on the Raspberry Pi
is_off ()
{
tvservice -s | grep "TV is off" >/dev/null
}
case $1 in
#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;