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 / 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 / javascript-patterns.md
Last active March 6, 2024 12:18
My favorite Javascript patterns

Useful JS Patterns/Functions

NOTE: for 3D JS patterns see my 3D patterns-page

Besides all the classical designpatterns in js, decorating lodash with new mixins, or a simple underscore object can also be useful.

reactive components #vanillajs #clean #noreact #novue #nosvelte #noframeworks #justproxies #eventdelegation

vanilla DOM components reactified using Proxies, see codepen here

@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 / _installing ALPINE LINUX on any (old) android device using ssh-droid.md
Last active February 22, 2024 11:08
installing ALPINE LINUX on any (old) android device using ssh-droid

installing ALPINE LINUX on any (old) android device using ssh-droid (tested: NEO G4 MINIX)

note: bit of unix-skills (vi e.g.) is needed (a very good investment for your future)

  1. install ssh-droid thru playstore, or download/open its .apk file after googling
  2. open ssh-droid
  3. on another laptop/computer ssh into your android device
  4. type mkdir alpine in your homefolder
  5. download the following shellscript below by typing:
#EXTM3U
#EXTINF:-1,***HasBahCa IPTV*** INGILIZCE - ENGLISH***
http://www.hasbahcaiptv.com/m3u/turkiye.mp4
#EXTINF:-1,4 Music
http://95.172.231.17/flashstream/stream.flv?Preset=7&aspect=16A9&ffPreset=ultrafast&maxwidth=&maxheight=&chid=22
#EXTINF:-1,4 Seven
http://95.172.231.17/flashstream/stream.flv?Preset=7&aspect=16A9&ffPreset=ultrafast&maxwidth=&maxheight=&chid=13
#EXTINF:-1,4 Seven Link 2
http://95.172.231.17/flashstream/stream.flv?Preset=7&aspect=16A9&ffPreset=ultrafast&maxwidth=&maxheight=&chid=47
#EXTINF:-1,5 Star
@coderofsalvation
coderofsalvation / snippy.sh
Last active January 24, 2024 08:56
modified version of snippy which features easier installation, follows symlinks, bashdown templates and automatic detection of cli vs window
#!/bin/bash
# video demo at: http://www.youtube.com/watch?v=90xoathBYfk
# written by "mhwombat": https://bbs.archlinux.org/viewtopic.php?id=71938&p=2
# Based on "snippy" by "sessy"
# (https://bbs.archlinux.org/viewtopic.php?id=71938)
#
# You will also need "dmenu", "xsel" and "xdotool". Get them from your linux
# distro in the usual way.
#
@coderofsalvation
coderofsalvation / sql2dot
Created July 24, 2012 11:31
sql2dot - converts sqldumps to graphiz, in order to render an image showing sql-table & relations
#!/bin/bash
# Copyright 2012, Leon van Kammen (Coder of Salvation), All rights reserved.
#
# this utility can generate database table images from sql-files.
# It converts sqldump into graphviz layout (dot) format.
# Once having a graphviz file, you can convert it to many image formats (svg/png) or view it
# interactively using canviz.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
@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
@coderofsalvation
coderofsalvation / workflow.sh
Created December 20, 2023 08:42
parallel workflow orchestration using wait-cmd in shellscript #bash #parallel #shellscript #speedupCI #windmill #airflow
#!/bin/bash
#
# Q: how can I track & run tasks in parallel (speed up CI pipeline e.g.)
# confidently without introducing platforms like Apache
# Airflow or Windmilll?
#
# A: the 'wait' command in shellscript
#
set -eE && trap "echo '❌ halting flow'" ERR
run(){ time "$@" 2>&1 | sed "s/^/[$1] /g" | tee .log; }
@coderofsalvation
coderofsalvation / README.md
Last active December 19, 2023 08:17
NixOS Lenovo ideapad s540 nvidia GTX1650 powersave

Welcome ideapad s540 GTX1650 Nix-friends (good news ahead)

I've spend way too long to get the NVIDIA-driver to work, as well as taming the overheating problem which has haunted my ideapad forever. I hope this config can save somebody else lots of time (please comment!), as I experienced weird catch22 scenarios because of the dual-video driver.

note: if you laptop still overheats, lower the CPU_SCALING_MAX_FREQ variables.

You can now run apps on the NVIDIA GPU by creating this nvidia-run shellscript-wrapper: