Skip to content

Instantly share code, notes, and snippets.

View coderofsalvation's full-sized avatar

Coder of Salvation / Leon van Kammen coderofsalvation

View GitHub Profile
@coderofsalvation
coderofsalvation / watch.sh
Last active February 14, 2025 09:23
shellscript which forwards filesystem inotify events to webpage [inotify-tools + websocat]
#!/bin/sh
echo '
<h1>/tmp watcher</h1>
<pre>
try: $ touch /tmp/FOO
$ chmod +x /tmp/FOO
$ xattr -s foo -V bar /tmp/FOO
</pre>
diff --git a/src/milkyplay/PlayerBase.h b/src/milkyplay/PlayerBase.h
index 5f48517..b14013b 100644
--- a/src/milkyplay/PlayerBase.h
+++ b/src/milkyplay/PlayerBase.h
@@ -196,7 +196,9 @@ public:
virtual mp_sint32 adjustFrequency(mp_uint32 frequency);
virtual mp_sint32 setBufferSize(mp_uint32 bufferSize);
-
+
@coderofsalvation
coderofsalvation / .bashrc
Last active December 6, 2024 13:37
autoenv/direnv in one shell function
# minimalist version of https://github.com/hyperupcall/autoenv
cd(){
test -f .env.leave && source .env.leave # cleanup environment
builtin cd ${1:+"$@"} && {
test -f .env && source .env # setup environment / run scripts e.g.
test -d .git && git remote -v # react to implicit metadata
ls # list directories
}
}
@coderofsalvation
coderofsalvation / spec.md
Last active September 25, 2024 10:50
SuperShape MimeType + FileType Specification 0.1

3D Supershape FileFormat

  • fileformat: textual comma-separated floats
  • file extension: .ss3d ss2d
  • mimetype: model/supershape3D, model/supershape2D


render of values 7,1,1,20.45,-0.33,-3.54,6,1,1,-0.96,4.46,0.52,200

@coderofsalvation
coderofsalvation / multiversion-nix-package.md
Created September 16, 2024 08:45
run multiple version of nix package

flake

$ nix run --extra-experimental-features flakes blender-bin#blender_4_0

channels

$ nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable
@coderofsalvation
coderofsalvation / LDBrain.js
Created June 6, 2024 10:02
superfast cli/speech completion via levensteihn distance #NOLLM
function LDbrain(opts) {
const trainingData = [];
function trainKeyValue(key, properties) {
trainingData.push({ k: key, ...properties });
}
function train(data) {
for (let k in data) {
// wrap string in functions, so they can still be lazily evaluated with template vars
@coderofsalvation
coderofsalvation / URI.gd
Last active May 17, 2024 08:02
URI.gd: a Godot URL Parser #gdscript #openweb #https (document.location js-like object for Godot)
# URI/URL parser
#
# author: Leon van Kammen (coderofsalvation)
# SPDX-License-Identifier: MIT
# date: 16-05-2024
# comments: https://gist.github.com/coderofsalvation/b2b111a2631fbdc8e76d6cab3bea8f17
#
# Participants of the Open Web think & communicate in URI's: now with Godot (>=4) too!
# This class will not win the beauty contest related to RFC 3986, but here goes:
#
@coderofsalvation
coderofsalvation / load_remote_GLTF_extras_metadata.gd
Last active May 8, 2024 10:15
programmatically read extras / custom properties from remote GLTF in Godot 4 gdscript
# For more sophisticated use of loading remote GLTF (with extras) use the xrfragment.org spec & xrfragment.gd script
# XRFRAGMENT.ORG is a mini-spec which standardizes 3D metadata without fileformat or platform lock-in
#
# Usage:
#
# load("https://xrfragment.org/index.glb")
# var doc = GLTFDocument.new()
# var state = GLTFState.new()
# #state.set_handle_binary_image(GLTFState.HANDLE_BINARY_EMBED_AS_BASISU) # Fixed in new Godot version (4.3 as I see) https://github.com/godotengine/godot/blob/17e7f85c06366b427e5068c5b3e2940e27ff5f1d/scene/resources/portable_compressed_texture.cpp#L116
# var error = doc.append_from_buffer(body, "", state)
@coderofsalvation
coderofsalvation / README.md
Last active March 1, 2024 19:20
Open Cubic Player Nix-file attempt (newbie needs help, this nix-file is stuck on libancient)

Due to lack of nix-skills I gave up on compiling it via nix (and ideally submitting it upstream). For now, I'm just using the AWESOME ocp player via this ~/bin/ocp shellscript:

#!/bin/bash
nix_windows(){
  test -d ~/apps/ocp || {
    mkdir ~/apps/ocp
 cd ~/apps/ocp
@coderofsalvation
coderofsalvation / nix-create-a-package-cheatsheet-2024.md
Last active January 6, 2024 09:58
nix create/tweak a package cheatsheet

Update a sha256/Hash

$ nix store prefetch-file <url>                                                                                        

build a derivation

  1. get default.nix from nixpkgs master-repo
  2. run the command below