Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Eiyeron
Eiyeron / debug_viz.py
Created August 31, 2023 09:43
Basic geometry debug REPL
import bpy
def add_mesh(name, verts, faces, edges=None, col_name="Collection"):
if edges is None:
edges = []
mesh = bpy.data.meshes.new(name)
obj = bpy.data.objects.new(mesh.name, mesh)
col = bpy.data.collections[col_name]
col.objects.link(obj)
bpy.context.view_layer.objects.active = obj
@Eiyeron
Eiyeron / CMakeLists.txt
Created January 22, 2023 18:07
PlayDate CMake template
cmake_minimum_required(VERSION 3.14)
set(CMAKE_C_STANDARD 11)
set(ENVSDK $ENV{PLAYDATE_SDK_PATH})
if (NOT ${ENVSDK} STREQUAL "")
# Convert path from Windows
file(TO_CMAKE_PATH ${ENVSDK} SDK)
else()
execute_process(
@Eiyeron
Eiyeron / Bubble Fortune
Created April 9, 2021 17:47
Bubble Fortune
- Bubble Fortune -
-------------------
O o . . . .
O o O O . O
. . O . O o O .
O . O . . .
o o o O o . . o o
O . o .
O o O . O O . O
o . O O o O .
@Eiyeron
Eiyeron / 50-dualsense.rules
Created December 2, 2020 11:57
Udev rules to access a dualsense controller in RW
SUBSYSTEMS=="usb", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ce6", GROUP="users", MODE="0660"
@Eiyeron
Eiyeron / import.lua
Last active December 1, 2020 13:32
New Pico-8 exporter (works with meshes bound in [(-1;-1;-1),(1;1;1)] )
function parse_vert(str, i)
local s = sub(str, (i-1)*5+1, (i-1)*5+5)
local v = sub(s, 1, 1)
local res = v.."0x0."..sub(s,2)
return tonum(res)
end
function load_verts(str)
local verts = {}
for v=0,#str/15-1 do
@Eiyeron
Eiyeron / pico-8.txt
Last active May 26, 2020 13:43
Pico-8 themed Dwarf Fortress palette (using extra colors)
[BLACK_R:0]
[BLACK_G:0]
[BLACK_B:0]
[BLUE_R:29]
[BLUE_G:43]
[BLUE_B:83]
[GREEN_R:0]
[GREEN_G:135]
[GREEN_B:81]
[CYAN_R:18]
@Eiyeron
Eiyeron / imgui-gruvbox.cpp
Last active March 21, 2024 03:21
Gruvbox theme for dear imgui
void gruvboxDark()
{
auto &style = ImGui::GetStyle();
style.ChildRounding = 0;
style.GrabRounding = 0;
style.FrameRounding = 0;
style.PopupRounding = 0;
style.ScrollbarRounding = 0;
style.TabRounding = 0;
style.WindowRounding = 0;
@Eiyeron
Eiyeron / ffmpeg_rencode_gpu.bat
Created May 6, 2020 07:47
Batch file to reencode video files in an hopefully Twitter-compatible way
@echo off
set /p quality="Quality: "
ffmpeg -hwaccel nvdec -c:v h264_cuvid -i %1 -c:v h264_nvenc -rc:v vbr_hq -cq:v %quality% -b:v 2500k -maxrate:v 5000k -profile:v high -pix_fmt yuv420p out.mp4
REM Here's the version without GPU-accelerated encoding
REM ffmpeg -i %1 -crf %quality% -b:v 2500k -maxrate:v 5000k -pix_fmt yuv420p out.mp4
#version 150
// Using Kodelife for the realtime preview/test environment but it should work fine on any shader that
// - offers the output's resolution
// - a time clock in seconds
// - an UV mapped on screenspace from [0,0] to [1,1]
uniform float time;
uniform vec2 resolution;
-- accumulative random
-- allows for progressively
-- variating value instead
-- of pure random
function vrnd()
local start = 50
return function()
start = start + rnd(1)* (flr(rnd(2)) == 1 and 1 or -1)
start = mid(40,start,100)
return start