Skip to content

Instantly share code, notes, and snippets.

View p1xelHer0's full-sized avatar
🔺

Pontus p1xelHer0

🔺
  • Stockholm
  • 16:44 (UTC +02:00)
View GitHub Profile
@p1xelHer0
p1xelHer0 / neovide.reg
Created April 18, 2025 10:09
Windows Registry Edit to add "Edit with Neovide" to the right click menu for files, directories and when click empty background in a directory
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Neovide]
@="Edit with Neovide"
"Icon"="\"C:\\Program Files\\Neovide\\neovide.exe\""
[HKEY_CLASSES_ROOT\*\shell\Neovide\command]
@="\"C:\\Program Files\\Neovide\\neovide.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\Neovide]
package game
import "core:c"
import "core:fmt"
import "core:math"
import "core:math/rand"
import "core:slice"
import "core:image/png"
import SDL "vendor:sdl3"
@p1xelHer0
p1xelHer0 / lsp.lua
Created February 17, 2025 19:22
HLSL Tools LSP for Neovim
vim.filetype.add({
extension = {
hlsl = "hlsl",
},
})
if not require("lspconfig.configs").hlsl_tools then
require("lspconfig.configs").hlsl_tools = {
default_config = {
cmd =
@p1xelHer0
p1xelHer0 / try_parse.ml
Created December 1, 2024 19:56
OCaml Scanf parsing
(* I overuse these two badboys *)
let parse fmt map line = try Some (Scanf.sscanf line fmt map) with _ -> None
let rec try_parse parsers line =
match parsers with
| [] -> failwith ("could not parse: " ^ line)
| parse :: parsers -> (
match parse line with
| None -> try_parse parsers line
| Some result -> result
@p1xelHer0
p1xelHer0 / flake.nix
Created November 6, 2024 19:54
Haskell flake
{
description = "Haskell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/haskell-updates";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
Pos :: [2]int
Component :: enum u16 {
PLAYER,
COLLISION,
PUSH,
SPRITE,
}
Entity :: struct {
@p1xelHer0
p1xelHer0 / miniaudio_from_memory.odin
Created April 21, 2024 10:45
Play audio files from memory with Odin #load
package audio
import "core:fmt"
// https://miniaud.io/docs/
import ma "vendor:miniaudio"
// 0 - Use native channel count of the device
AUDIO_CHANNELS :: 0
AUDIO_SAMPLE_RATE :: 0
{
description = "dungeoncrawler";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
@p1xelHer0
p1xelHer0 / FFI-2.md
Created January 3, 2024 11:58
Gerbil macOS ncurses FFI

macOS Ventura 13.6.2

Gerbil v0.18-62-gf7d8efcf on Gambit v4.9.5-78-g8b18ab69

λ echo $CC
gcc-13

Running brew info ncurses gives us the following part:

@p1xelHer0
p1xelHer0 / FFI.md
Created January 2, 2024 07:26
Gerbil ncurses FFI macOS

So, I am a little bit (very) new to C, "systems programming" and the tools surrounding C. I thought it would be fun to try to make a little ncurses thing with Gerbil!

I've installed gcc version 12.3.0 (with Nix if that matters) and ncurses6 with Homebrew. This would be instead of using clang provided by macOS by default? I think I read in the docs that gcc is preferred. Is this still the case on macOS?

I've compiled a C-program using ncurses with gcc and got it to run using the following:

gcc `ncurses6-config --cflags --libs` test.c -o test.out