Skip to content

Instantly share code, notes, and snippets.

View cfillion's full-sized avatar

Christian Fillion cfillion

View GitHub Profile
@cfillion
cfillion / alias.zig
Last active January 26, 2025 15:00
Type alias for Zig bindings
fn Alias(a: type, b: type) type {
return struct {
fn fixType(t: anytype) void {
var info = @typeInfo(t.*);
switch(info) {
.Pointer => |*ptr| {
if(ptr.child == a) {
ptr.child = b;
ptr.alignment = @alignOf(a);
}
@cfillion
cfillion / colortheme
Created October 4, 2024 05:55
colortheme 20100705-1 (Build Date: Thu 21 Aug 2014 01:54:45 AM EDT) http://bbs.archlinux.org/viewtopic.php?id=5925 script to show Your terminal color scheme, unicode and ascii version
#!/bin/bash
# Original: http://frexx.de/xterm-256-notes/
# http://frexx.de/xterm-256-notes/data/colortable16.sh
# Modified by Aaron Griffin
# and further by Kazuo Teramoto
case "${1}" in
#help
*h|*help)
echo "uses unicode version as default"
-- @version 1.0.1
-- @changelog Add whitespace tolerance
-- @author cfillion
package.path = reaper.ImGui_GetBuiltinPath() .. '/?.lua'
local ImGui = require 'imgui' '0.9'
local SCRIPT_NAME = 'imgui.lua 0.9 upgrader'
local FLT_MIN, FLT_MAX = ImGui.NumericLimits_Float()
local ctx = ImGui.CreateContext(SCRIPT_NAME)
@cfillion
cfillion / openocd-LPC546xx.cfg
Last active May 30, 2024 07:45
OpenOCD script for LPC546xx via MCU-Link2 (w/o flash support)
set CHIPNAME LPC546xx
set CPUTAPID 0x10CAA02B
adapter driver cmsis-dap
transport select swd
adapter speed 3000
# gdb_memory_map enable
# gdb_flash_program enable
@cfillion
cfillion / gfx-replay.lua
Last active January 23, 2024 22:01
Record and replay gfx code
-- GFXREPLAY_RECORD = true
-- gfx = dofile('/path/to/gfx-replay.lua')
GFX2IMGUI_DEBUG = GFX2IMGUI_DEBUG or false
GFX2IMGUI_MAX_DRAW_CALLS = GFX2IMGUI_MAX_DRAW_CALLS or 1<<13
GFX2IMGUI_NO_BLIT_PREMULTIPLY = GFX2IMGUI_NO_BLIT_PREMULTIPLY or false
GFX2IMGUI_NO_LOG = GFX2IMGUI_NO_LOG or false
local ImGui = {}
for name, func in pairs(reaper) do
@cfillion
cfillion / syntax-highlighting.user.js
Last active April 13, 2024 11:11
Syntax highlighting on the REAPER forum
// ==UserScript==
// @name Syntax highlighting
// @namespace https://cfillion.ca
// @version 1.0.3
// @author cfillion
// @include https://forum.cockos.com/showthread.php*
// @include https://forum.cockos.com/showpost.php*
// @include https://forum.cockos.com/editpost.php*
// @include https://forum.cockos.com/newreply.php*
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.3/highlight.min.js
--dofile(reaper.GetResourcePath() ..
--'/Scripts/ReaTeam Extensions/API/imgui.lua')('0.7')
r = reaper
local demo, cache = {}, {}
function demo.EachEnum(enum)
local enum_cache = cache[enum]
if not enum_cache then
enum_cache = {}
cache[enum] = enum_cache
@cfillion
cfillion / sws_preview_test.lua
Last active March 21, 2024 05:51
SWS preview API test
-- ARCHIVED VERSION
-- latest maintained version is on the ReaTeam Reascripts repository
package.path = reaper.ImGui_GetBuiltinPath() .. '/?.lua'
local ImGui = require 'imgui' '0.9'
local SCRIPT_NAME = 'SWS CF_Preview API demo'
local FLT_MIN, FLT_MAX = ImGui.NumericLimits_Float()
local ctx = ImGui.CreateContext(SCRIPT_NAME)
local sans_serif = ImGui.CreateFont('sans-serif', 13)
@cfillion
cfillion / ja_JP.UTF-8.md
Last active March 13, 2025 14:50
Solution for locale and character encoding issues in Japanese games on Steam Deck

Problem 1

Cannot access filenames containing non-ASCII characters.

Steam Deck's SteamOS 3 provides only one locale named en_US.utf8 (as configured in /etc/locale.gen) but /etc/locale.conf sets LANG to en_US.UTF-8. They don't match, so the effective locale for programs is C and the character set becomes limited to ASCII.

Set the game's launch options in Steam to LANG=en_US.utf8 %command% to solve this.

To fix this for all applications running in desktop mode (eg. to correctly extract games), create a file named ~/.config/plasma-workspace/env/utf8.sh containing (restart desktop mode to apply):

@cfillion
cfillion / reaper_widemsg.cpp
Created May 6, 2022 14:51
Hack to allow input of any characters in Unicode windows
// cl /nologo /O2 reaper_widemsg.cpp User32.lib /link /DLL /OUT:reaper_widemsg.dll
#include <cstdint>
#define REAPERAPI_IMPLEMENT
#include "reaper_plugin_functions.h"
template<typename T>
bool patch(const uintptr_t addr, const T newCode, T *backup = nullptr)
{