Skip to content

Instantly share code, notes, and snippets.

@danilw
danilw / nvidia-wayland-suspend.txt
Last active March 7, 2025 09:05
Nvidia make suspend work in Linux in Wayland
Source:
https://gist.github.com/jstarcher/abdac9c2c0b5de8b073d527870b73a19
https://bbs.archlinux.org/viewtopic.php?pid=2044189#p2044189
/etc/modprobe.d/nvidia.conf
@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
just notes to not lose:
https://gitlab.freedesktop.org/drm/amd/-/issues
https://gitlab.freedesktop.org/mesa/mesa/-/issues/?label_name%5B%5D=RADV
https://gitlab.freedesktop.org/mesa/mesa/-/issues/12213
amd ring timeout
sudo journalctl -b -1 -o cat --no-pager | grep "amdgpu: ring gfx"
disable GPU recovery by adding amdgpu.gpu_recovery=0 to your kernel boot options (you can verify it's correctly set after a reboot using dmesg)
when the GPU hang happens, invoke 'umr -RS gfx_0.0.0 &> umr_rings.log' (needs to install umr first) and attach umr_rings.log to this ticket
@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)
@danilw
danilw / shadertoy_audio_to_wav.c
Last active May 5, 2022 21:17
save Shadertoy audio to wav file C code
// gcc shadertoy_audio_to_wav.c -lm
// ./a.out
// detailed info about shadertoy audio texture
// https://gist.github.com/soulthreads/2efe50da4be1fb5f7ab60ff14ca434b8
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>