Skip to content

Instantly share code, notes, and snippets.

@danilw
danilw / svg-to-shadertoy.py
Created November 22, 2025 13:15 — forked from Ninja-Koala/svg-to-shadertoy.py
Convert a svg path to a shadertoy shader
# svg to curves path https://www.shadertoy.com/view/Wtt3Wl
#!/usr/bin/python3
import os
import sys
import numpy as np
def read_value(string, index):
#go to the beginning of the value
while svg_content[index] not in numerals:
@danilw
danilw / openwrt_update_conf .txt
Created November 2, 2025 01:06
when openwrt after update does not load - broken config
yes I did backup configs before update
I updated from openwrt 20 to 24
used squashfs-sysupgrade.bin
... and after update it boot and look like react as usual
but - no internet - not even DHCP ip working
can not get IP
setting IP to static on PC like 192.168.1.153
@danilw
danilw / nvidia-wayland-suspend.txt
Last active February 13, 2026 22:16
Nvidia make suspend work in Linux in Wayland (GNOME)
Nvidia make suspend work in Linux in Wayland (GNOME)
MAIN POINT
adding these kernel boot parameters is enough to save vram on nvidia:
________
Boot grub kernel boot parameters:
nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_TemporaryFilePath="/var/tmp" nvidia.NVreg_PreserveVideoMemoryAllocations=1
________
@danilw
danilw / server.py
Created November 10, 2024 20:47
Python 3 https server
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
# python3 server.py
import http.server
import ssl
def get_ssl_context(certfile, keyfile):
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
@danilw
danilw / text_edit.py
Last active November 30, 2024 01:49
text_edit.py Python text editor with pass encryption with UTF-8 text support
#!/bin/python3
# text_edit.py
# Python text editor (from random Tinker based code) with pass encryption, with UTF-8 text support(non ASCII)
# usage:
# pip3 install pycryptodome
# python3 text_edit.py
# P.S. password strength:
@danilw
danilw / godot4_depth_fog.gdshader
Created January 17, 2024 21:34
Godot 4 depth fog on unshaded
// depth fog is something like this
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx,unshaded;
uniform sampler2D depth_tex:hint_depth_texture;
void vertex() {
}
#!/usr/bin/env python3
# DO NOT USE
# WARNING - THIS IS JUNK, MADE FOR ONE USE MAY NOT WORK.
# Expected to work only with 3-length 1024 tokens range.
# WARNING shadertoy PRIVATE API_key
# https://www.shadertoy.com/view/cdXyWr
@danilw
danilw / gaming_on_linux_wine_fixes.txt
Last active February 24, 2026 12:44
my notes for reddit responses to copy
just notes to not lose:
inxi -Fxxxzr
watch -n 1 nvidia-smi
https://www.gnu.org/software/parallel/parallel_examples.html
lots of good bash command examples
amd ring timeout
@danilw
danilw / minimal-win32-glslsound.c
Created January 2, 2023 23:47
example of generating Shadertoy audio texture and use of mmsystem.h in Windows OS
// this example of generating Shadertoy audio texture and use of mmsystem.h
// https://docs.microsoft.com/en-us/windows/win32/api/mmsystem/
// code made by ttg https://github.com/therontarigo
// It compiles in mingw and runs in WINE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mmsystem.h>
#include <GL/gl.h>
@danilw
danilw / cfloats.py
Created November 12, 2022 20:44
Shadertoy ML/Neural shaders optimization script
import re
import os
import sys
# this script to convert floats in GLSL code to "less variative constants"
# set b_scale = <VALUE> example 64.0
# floats in range 0-1 will be rescaled with float step 1/64 or 1/(b_scale step)