Skip to content

Instantly share code, notes, and snippets.

View dirkk0's full-sized avatar

Dirk Krause dirkk0

View GitHub Profile
@dirkk0
dirkk0 / snap.py
Created June 6, 2025 14:19
Blender script to make new objects snap to the grid (because the asset browser doesn't do this)
import bpy
import math
# Define grid size
GRID_SIZE = 1.0
# Track previously known object names
last_object_names = set(obj.name for obj in bpy.context.scene.objects)
def snap_to_grid(obj, grid_size=GRID_SIZE):
@dirkk0
dirkk0 / test.html
Created May 28, 2025 08:04
Pico.css plus zero-md with dark/light mode
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pico + zero-md</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
@dirkk0
dirkk0 / test.html
Created April 14, 2025 10:16
Basic dockview page with ESM (and without React)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="google" content="notranslate" />
<title>Dockview ESM Example</title>
<style>
body {
@dirkk0
dirkk0 / home.html
Created May 31, 2024 09:07
Minimal Flask-Login
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Home</title>
</head>
<body>
<nav>
@dirkk0
dirkk0 / blender_addon_ege.py
Created November 26, 2023 17:47
Easy glTF/glb Exporter Blender addon
bl_info = {
"name": "Easy glTF/glb Exporter",
"blender": (2, 80, 0),
"category": "Experiment",
"author": "Dirk Krause",
}
import bpy, os
class EgePanel(bpy.types.Panel):
@dirkk0
dirkk0 / main.js
Last active June 4, 2025 14:49
nodejs websocket with ws and http - full minimal example
// starter was this very helpful post from @lpinca
// https://github.com/websockets/ws/issues/2052#issuecomment-1142529734
// installation: npm install ws
const WebSocketServer = require("ws");
const http = require('http');
const PORT = process.env.PORT || 8084;
@dirkk0
dirkk0 / agent.gd
Created May 9, 2023 19:23
navigation server example for Godot 3.52
extends KinematicBody
onready var navigation = $"../Navigation"
var target # = $"../Position3D"
var speed = 10.0
var path = []
var path_index = 0
var pois = []
@dirkk0
dirkk0 / texteditor.html
Last active March 27, 2023 08:01
webview-node text editor example
<html>
<style>
#text {
width: 100%;
height: 90%;
}
</style>
<body>
@dirkk0
dirkk0 / server.js
Created July 23, 2022 09:38
minimal nodejs webserver without modules but with CORS
"use strict";
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
// via
// https://stackoverflow.com/questions/16333790/node-js-quick-file-server-static-files-over-http