Skip to content

Instantly share code, notes, and snippets.

View nklbdev's full-sized avatar

nklbdev nklbdev

View GitHub Profile
@nklbdev
nklbdev / wasd_controls.js
Created October 5, 2025 11:16
Blockbench WASD controls plugin for v5 with RMB and mouse lock
(() => {
const deletables = [];
let rightMouseDown = false;
BBPlugin.register("wasd_controls", {
title: "WASD Controls",
icon: "sports_esports",
author: "JannisX11, caioraphael1, nklbdev",
description: "Adds a WASD controlled viewport navigation mode",
about:
@nklbdev
nklbdev / mops.js
Last active August 2, 2025 18:04
MOPS - Manifold Operations (Blockbench plugin powered by Manifold-3D library)
const manifoldModule = function (moduleArg = {}) { /* Edited bindings to WASM from https://www.npmjs.com/package/manifold-3d */ };
/// <reference path="../../types/index.d.ts" />
const THREE_IMPL = globalThis.THREE;
let Manifold;
let GlMesh;
console.log({ manifoldModule });
manifoldModule({ locateFile: () => "...path to real wasm file... /blockbench-plugins/plugins/mops/src/manifold.wasm" })
.then(module => {
@nklbdev
nklbdev / main.ts
Last active July 31, 2025 22:23
BOPS (Boolean Operations) - plugin for Blockbench
/**
* @author nklbdev
* @github https://github.com/nklbdev
*/
// TODO Add ability to replace first operand with result
// TODO Add shortcuts
// TODO Add error handling (like "NotManifold")
/// <reference types="blockbench-types" />
@nklbdev
nklbdev / true_parallax.gd
Last active July 31, 2025 21:38
True parallax script for Godot 4
## This script adds parallax functionality to any Node2D.
## But be careful, some Node2D descendants may work in a special way
## with the position and global_position properties,
## or have other conflicts with the logic of this script.[br]
##
## [b]How to use[/b]: Add this script to any [Node2D],
## such as [TileMapLayer] or [Sprite2D], or to [Node2D] itself.
## Or move the main sections of the code to your own script.[br]
## After that, this node will have new properties that allow you
## to configure parallax and see it working in the editor just like in the game.[br]
@nklbdev
nklbdev / run_as_with_saved_creds.ps1
Created July 21, 2023 18:49
PowerShell script to run a command as another user with saved credentials
# Usage:
#
# Call it without any args except path to file to save credential.
# The script will show a window for entering credentials and save them to a file in encrypted form.
# > powershell -File run_as_with_saved_creds.ps1 creds.txt
#
# Call it with arguments after path to file with saved credential.
# The script will execute the command as the user whose credentials have been saved in the file.
# > powershell -File run_as_with_saved_creds.ps1 creds.txt some commands and args
@nklbdev
nklbdev / Option.cs
Created March 2, 2023 16:40
Option pattern C# implementation
public interface IOption<T> : IEnumerable<T>
{
bool IsSome { get; }
T Value { get; }
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
public static class Option
{
public static IOption<T> Some<T>(T value) => new Some<T>(value);
@nklbdev
nklbdev / FunctionalBuilder.cs
Last active December 13, 2019 06:43
Primitive universal functional builder
public static class Building
{
public static Func<T> Provide<T>(Func<T> provider) => provider;
public static Func<T> Provide<T>(T value) => () => value;
public static Func<T> With<T>(this Func<T> provider, Action<T> modifier) =>
With(provider, modifier, out _);
public static Func<T> With<T>(this Func<T> provider, Action<T> modifier, out Func<T> thisStep)
{
@nklbdev
nklbdev / README.md
Last active April 29, 2018 18:54
Lua events

SIMPLE EVENTS FOR LUA

Description will be added later