Skip to content

Instantly share code, notes, and snippets.

@bozidarsk
bozidarsk / docker-compose.yaml
Last active April 13, 2024 09:11
Docker compose file for a minecraft server.
services:
minecraft:
container_name: "minecraft"
stdin_open: true
tty: true
image: itzg/minecraft-server
ports:
- "25565:25565"
environment:
EULA: "TRUE"
@bozidarsk
bozidarsk / Hook.cs
Created September 28, 2023 04:57
Keyboard and mouse hook for windows.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
public static class Hook
{
public static event Action<uint> OnKeyDown;
public static event Action<uint> OnKeyUp;
@bozidarsk
bozidarsk / Input.cs
Last active October 30, 2023 15:45
Input class for libinput.
using System;
namespace LibInput
{
public static class Input
{
public static bool TryGetKeyUp(out KeyCode key)
{
key = (KeyCode)0;
if (!Event.TryGetEvent(out Event e) || e.Type != EventType.KeyboardKey) { return false; }
@bozidarsk
bozidarsk / Config.cs
Last active August 19, 2023 11:49
Easy way of adding configurations to c# projects.
// #define NO_FILES
// #define NO_CSS
/* or as command line option when compiling '-define:NO_FILES,NO_CSS' */
/*
NO_FILES - no config and no style.css files
NO_CSS - a config file but not a style.css file
the order you call Config.Initialize(ref string[] args):
@bozidarsk
bozidarsk / .gitignore
Last active July 24, 2023 06:08
Global .gitignore file.
*.o
*.obj
*.so
*.a
*.bin
*.exe
*.dll
*.out
out
@bozidarsk
bozidarsk / LayerShell.cs
Last active July 24, 2023 06:07
Gtk3 layer shell bindings for c#.
using System;
using System.Runtime.InteropServices;
namespace Gtk
{
public static class LayerShell
{
[DllImport("gtk-layer-shell")] private static extern uint gtk_layer_get_major_version();
public static uint MajorVersion { get => gtk_layer_get_major_version(); }