Skip to content

Instantly share code, notes, and snippets.

@cmargroff
cmargroff / nde.ohm
Created November 23, 2024 00:09
a rough ohm parse script for nandeck
NDE {
Script = (Statement | AnyDirective)*
spaceNoNL = ~"\n" "\x00".."\x20"
spacesNoNL = spaceNoNL*
delim = spacesNoNL ( ",") spacesNoNL
// imported from ES5
lineTerminator = "\n" | "\r" | "\u2028" | "\u2029"
lineTerminatorSequence = "\n" | "\r" ~"\n" | "\u2028" | "\u2029" | "\r\n"
@cmargroff
cmargroff / EditorPluginExtensions.cs
Created March 2, 2024 05:21
Godot editor plugin extensions for getting the top menu bar items to add your own menu items
using Godot;
// This was tested against 4.2.stable.mono
#if TOOLS
[Tool]
public static class EditorPluginExtensions
{
public static PopupMenu GetTopMenuItem(this EditorPlugin editorPlugin, string name)
{
var root = EditorInterface.Singleton.GetBaseControl();
@cmargroff
cmargroff / Ellipse.gd
Created September 20, 2023 01:51
Ellipse node for Godot Visual Shader
@tool
class_name VisualShaderNodeEllipse
extends VisualShaderNodeCustom
func _get_name():
return "Ellipse"
func _get_category():
return ""
@cmargroff
cmargroff / Polygon.gd
Created September 18, 2023 19:21
Polygon node for Godot Visual Shader
@tool
class_name VisualShaderNodePolygon
extends VisualShaderNodeCustom
func _get_name():
return "Polygon"
func _get_category():
return ""
@cmargroff
cmargroff / UV_Rotate.gd
Last active September 18, 2023 19:26
A UV Rotate convenience node for Godot Visual Shader
@tool
class_name VisualShaderNodeUvRotate
extends VisualShaderNodeCustom
func _get_name():
return "UV Rotate"
func _get_description():
return ""
@cmargroff
cmargroff / agnoster.theme.ps1
Last active September 21, 2022 13:34
Agnoster for Powershell [WIP]
# base code
Set-Alias ll ls
Set-Alias touch New-Item
Del alias:cd -Force
Set-Alias cd push-location -Force
# theme code
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
$e = [char]0x1b
$reset = "$e[0m"
(function(w, d){
const style = d.createElement('style');
style.innerText = ".oob { outline: 1px solid #f00 !important; }";
d.head.appendChild(style);
const nodes = d.querySelectorAll("*");
let vpw = window.innerWidth;
w.addEventListener('resize', resize)
let timer;
CanvasRenderingContext2D.prototype.roundedRect = function(x: number, y: number, width: number, height: number, radius: number) {
const points = [
[x + radius, y + radius],
[x + width - radius, y + radius],
[x + width - radius, y + height - radius],
[x + radius, y + height - radius]
]
let startAngle = 1 * Math.PI
points.forEach((set, i) => {
this.arc(set[0], set[1], radius, startAngle, startAngle + 0.5 * Math.PI)
@cmargroff
cmargroff / node-windows-loadavg.js
Created August 6, 2018 19:51
emulates loadavg for windows platforms
var lastCpus = [];
var lastTimestamp = 0;
const { performance } = require('perf_hooks');
function AvgList(limit){
this.measures = [];
this.totalTime = 0;
this.limit = limit;
this.push = function(measure){
if ((this.totalTime + measure.delta) > this.limit) {
// ==UserScript==
// @name Pkmn Cards Proxy Print Layout
// @namespace https://pkmncards.com/
// @version 0.2.2
// @description Format print layout better
// @author Chris Margroff
// @match https://pkmncards.com/proxy/*
// @grant none
// ==/UserScript==