Skip to content

Instantly share code, notes, and snippets.

View fearofcode's full-sized avatar
🎵
Take that chance / All day long / Fucking up so fucking strong

Warren Henning fearofcode

🎵
Take that chance / All day long / Fucking up so fucking strong
View GitHub Profile
@fearofcode
fearofcode / README.md
Last active September 28, 2025 00:27
DPI-aware Odin Dear imgui setup using odin-imgui

imgui setup:

  • Download Inconsolata from https://fonts.google.com/specimen/Inconsolata and extract its file Inconsolata-Regular.ttf to a directory called assets if you want the assets/Inconsolata-Regular.ttf font the code uses to work as is

  • Clone https://gitlab.com/L-4/odin-imgui to a submodule: git submodule add [email protected]:L-4/odin-imgui.git odin-imgui

  • Clone dear_bindings to a submodule: git submodule add [email protected]:dearimgui/dear_bindings.git dear_bindings

  • Make a python venv and install dear_bindings requirements (ply):

    • python3 -m venv venv
    • source venv/bin/activate
    • cd dear_bindings
@fearofcode
fearofcode / debug_ui_microui_opengl.odin
Created September 11, 2025 03:58
Simple microui Odin OpenGL basic example
package main
import "core:fmt"
import glm "core:math/linalg/glsl"
import gl "vendor:OpenGL"
import mu "vendor:microui"
Microui_Vertex :: struct {
pos : glm.vec2,
@fearofcode
fearofcode / benchmark.cpp
Created March 7, 2025 00:47
either this benchmark is fucked or C++ style I/O is slow as shit
#include <iostream>
#include <chrono>
#include <vector>
#include <fstream>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;
using namespace std::chrono;
@fearofcode
fearofcode / raylib_zig_high_dpi_ttf.zig
Created February 18, 2025 01:38
conditional high DPI window + proper text on retina display with Raylib and zig
const rl = @cImport(@cInclude("raylib.h"));
const std = @import("std");
fn isHighDpi() bool {
rl.SetConfigFlags(rl.FLAG_WINDOW_HIDDEN);
rl.InitWindow(100, 100, "");
const high_dpi = rl.GetWindowScaleDPI().x > 1.0;
rl.CloseWindow();
return high_dpi;
@fearofcode
fearofcode / autocrafter.py
Last active November 9, 2024 05:15
Send space to semi-AFK equipment bench in Satisfactory (Satisfactory window does not need to be active)
import ctypes
from ctypes import wintypes
import time
import sys
# Windows API constants
WM_KEYDOWN = 0x0100
WM_KEYUP = 0x0101
VK_SPACE = 0x20
@fearofcode
fearofcode / export.py
Last active September 17, 2024 00:52
Simple anki export of a Plover steno dictionary using the genanki (https://github.com/kerrickstaley/genanki) library
# Copyright (C) 2024 Warren Henning
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@fearofcode
fearofcode / pollkeys.cpp
Created May 17, 2024 01:24 — forked from lierdakil/pollkeys.cpp
Linux polling all key event devices for key presses (minimalist example)
// Note: uses C++17 fs features; build with
// g++ -std=c++17 event-reader.cpp -lstdc++fs
//
// Licensed under the following terms:
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
// Version 2, December 2004
//
// Copyright (C) 2004 Sam Hocevar <[email protected]>
//
// Everyone is permitted to copy and distribute verbatim or modified
@fearofcode
fearofcode / stacked_widget_example.py
Last active October 19, 2023 04:21
example of changing currently displayed widgets/layout in PyQt6 using QStackedWidget
import sys
from PyQt6.QtWidgets import (
QApplication,
QCheckBox,
QLabel,
QLineEdit,
QRadioButton, )
from PyQt6.QtWidgets import QHBoxLayout, QFormLayout, QStackedWidget, QListWidget, QWidget
@fearofcode
fearofcode / lispy.py
Created August 12, 2022 22:01
https://norvig.com/lispy2.html with its test suite updated to work on Python 3
"""
Scheme Interpreter in Python
(c) Peter Norvig, 2010; See http://norvig.com/lispy2.html
Fixes to run on Python 3 and minor style tweaks from Warren Henning, 2022 <[email protected]>
"""
import cmath
import math
@fearofcode
fearofcode / Default (Windows).default-keymap
Last active July 9, 2022 22:57
basic Sublime Text 4 Clojure setup: Clojure-Sublimed + LSP
[
// Evaluate
{"keys": ["ctrl+enter"],
"command": "clojure_sublimed_eval",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Evaluate Buffer
{"keys": ["ctrl+b"],
"command": "clojure_sublimed_eval_buffer",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},